Added participant and other stuff
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a082ff1bb115495438c0dbd2a47e2b0f
|
||||
folderAsset: yes
|
||||
timeCreated: 1525971172
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,318 +0,0 @@
|
||||
#ifndef AVATAR_UTIL_CG_INCLUDED
|
||||
#define AVATAR_UTIL_CG_INCLUDED
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
#define SAMPLE_MODE_COLOR 0
|
||||
#define SAMPLE_MODE_TEXTURE 1
|
||||
#define SAMPLE_MODE_TEXTURE_SINGLE_CHANNEL 2
|
||||
#define SAMPLE_MODE_PARALLAX 3
|
||||
#define SAMPLE_MODE_RSRM 4
|
||||
|
||||
#define MASK_TYPE_NONE 0
|
||||
#define MASK_TYPE_POSITIONAL 1
|
||||
#define MASK_TYPE_REFLECTION 2
|
||||
#define MASK_TYPE_FRESNEL 3
|
||||
#define MASK_TYPE_PULSE 4
|
||||
|
||||
#define BLEND_MODE_ADD 0
|
||||
#define BLEND_MODE_MULTIPLY 1
|
||||
|
||||
#ifdef LAYERS_1
|
||||
#define LAYER_COUNT 1
|
||||
#elif LAYERS_2
|
||||
#define LAYER_COUNT 2
|
||||
#elif LAYERS_3
|
||||
#define LAYER_COUNT 3
|
||||
#elif LAYERS_4
|
||||
#define LAYER_COUNT 4
|
||||
#elif LAYERS_5
|
||||
#define LAYER_COUNT 5
|
||||
#elif LAYERS_6
|
||||
#define LAYER_COUNT 6
|
||||
#elif LAYERS_7
|
||||
#define LAYER_COUNT 7
|
||||
#elif LAYERS_8
|
||||
#define LAYER_COUNT 8
|
||||
#endif
|
||||
|
||||
#define DECLARE_LAYER_UNIFORMS(index) \
|
||||
int _LayerSampleMode##index; \
|
||||
int _LayerBlendMode##index; \
|
||||
int _LayerMaskType##index; \
|
||||
fixed4 _LayerColor##index; \
|
||||
sampler2D _LayerSurface##index; \
|
||||
float4 _LayerSurface##index##_ST; \
|
||||
float4 _LayerSampleParameters##index; \
|
||||
float4 _LayerMaskParameters##index; \
|
||||
float4 _LayerMaskAxis##index;
|
||||
|
||||
DECLARE_LAYER_UNIFORMS(0)
|
||||
DECLARE_LAYER_UNIFORMS(1)
|
||||
DECLARE_LAYER_UNIFORMS(2)
|
||||
DECLARE_LAYER_UNIFORMS(3)
|
||||
DECLARE_LAYER_UNIFORMS(4)
|
||||
DECLARE_LAYER_UNIFORMS(5)
|
||||
DECLARE_LAYER_UNIFORMS(6)
|
||||
DECLARE_LAYER_UNIFORMS(7)
|
||||
|
||||
struct VertexOutput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 texcoord : TEXCOORD0;
|
||||
float3 worldPos : TEXCOORD1;
|
||||
float3 worldNormal : TEXCOORD2;
|
||||
float3 viewDir : TEXCOORD3;
|
||||
float4 vertColor : COLOR;
|
||||
|
||||
#if NORMAL_MAP_ON || PARALLAX_ON
|
||||
float3 worldTangent : TANGENT;
|
||||
float3 worldBitangent : TEXCOORD5;
|
||||
#endif
|
||||
};
|
||||
|
||||
float _Alpha;
|
||||
int _BaseMaskType;
|
||||
float4 _BaseMaskParameters;
|
||||
float4 _BaseMaskAxis;
|
||||
fixed4 _DarkMultiplier;
|
||||
fixed4 _BaseColor;
|
||||
sampler2D _AlphaMask;
|
||||
float4 _AlphaMask_ST;
|
||||
sampler2D _AlphaMask2;
|
||||
float4 _AlphaMask2_ST;
|
||||
sampler2D _NormalMap;
|
||||
float4 _NormalMap_ST;
|
||||
sampler2D _ParallaxMap;
|
||||
float4 _ParallaxMap_ST;
|
||||
sampler2D _RoughnessMap;
|
||||
float4 _RoughnessMap_ST;
|
||||
float4x4 _ProjectorWorldToLocal;
|
||||
|
||||
VertexOutput vert(appdata_full v)
|
||||
{
|
||||
VertexOutput o;
|
||||
UNITY_INITIALIZE_OUTPUT(VertexOutput, o);
|
||||
|
||||
o.texcoord = v.texcoord.xy;
|
||||
o.worldPos = mul(unity_ObjectToWorld, v.vertex);
|
||||
o.vertColor = v.color;
|
||||
o.viewDir = normalize(_WorldSpaceCameraPos.xyz - o.worldPos);
|
||||
o.worldNormal = normalize(mul(unity_ObjectToWorld, float4(v.normal, 0.0)).xyz);
|
||||
|
||||
#if NORMAL_MAP_ON || PARALLAX_ON
|
||||
o.worldTangent = normalize(mul(unity_ObjectToWorld, float4(v.tangent.xyz, 0.0)).xyz);
|
||||
o.worldBitangent = normalize(cross(o.worldNormal, o.worldTangent) * v.tangent.w);
|
||||
#endif
|
||||
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
#ifndef NORMAL_MAP_ON
|
||||
#define COMPUTE_NORMAL IN.worldNormal
|
||||
#else
|
||||
#define COMPUTE_NORMAL normalize(mul(lerp(float3(0, 0, 1), surfaceNormal, normalMapStrength), tangentTransform))
|
||||
#endif
|
||||
|
||||
float3 ComputeColor(
|
||||
VertexOutput IN,
|
||||
float2 uv,
|
||||
#if PARALLAX_ON || NORMAL_MAP_ON
|
||||
float3x3 tangentTransform,
|
||||
#endif
|
||||
#ifdef NORMAL_MAP_ON
|
||||
float3 surfaceNormal,
|
||||
#endif
|
||||
sampler2D surface,
|
||||
float4 surface_ST,
|
||||
fixed4 color,
|
||||
int sampleMode,
|
||||
float4 sampleParameters
|
||||
) {
|
||||
if (sampleMode == SAMPLE_MODE_TEXTURE) {
|
||||
float2 panning = _Time.g * sampleParameters.xy;
|
||||
return tex2D(surface, (uv + panning) * surface_ST.xy + surface_ST.zw).rgb * color.rgb;
|
||||
}
|
||||
else if (sampleMode == SAMPLE_MODE_TEXTURE_SINGLE_CHANNEL) {
|
||||
float4 channelMask = sampleParameters;
|
||||
float4 channels = tex2D(surface, uv * surface_ST.xy + surface_ST.zw);
|
||||
return dot(channels, channelMask) * color.rgb;
|
||||
}
|
||||
#ifdef PARALLAX_ON
|
||||
else if (sampleMode == SAMPLE_MODE_PARALLAX) {
|
||||
float parallaxMinHeight = sampleParameters.x;
|
||||
float parallaxMaxHeight = sampleParameters.y;
|
||||
float parallaxValue = tex2D(_ParallaxMap, TRANSFORM_TEX(uv, _ParallaxMap)).r;
|
||||
float scaledHeight = lerp(parallaxMinHeight, parallaxMaxHeight, parallaxValue);
|
||||
float2 parallaxUV = mul(tangentTransform, IN.viewDir).xy * scaledHeight;
|
||||
return tex2D(surface, (uv * surface_ST.xy + surface_ST.zw) + parallaxUV).rgb * color.rgb;
|
||||
}
|
||||
#endif
|
||||
else if (sampleMode == SAMPLE_MODE_RSRM) {
|
||||
float roughnessMin = sampleParameters.x;
|
||||
float roughnessMax = sampleParameters.y;
|
||||
#ifdef ROUGHNESS_ON
|
||||
float roughnessValue = tex2D(_RoughnessMap, TRANSFORM_TEX(uv, _RoughnessMap)).r;
|
||||
float scaledRoughness = lerp(roughnessMin, roughnessMax, roughnessValue);
|
||||
#else
|
||||
float scaledRoughness = roughnessMin;
|
||||
#endif
|
||||
|
||||
#ifdef NORMAL_MAP_ON
|
||||
float normalMapStrength = sampleParameters.z;
|
||||
#endif
|
||||
float3 viewReflect = reflect(-IN.viewDir, COMPUTE_NORMAL);
|
||||
float viewAngle = viewReflect.y * 0.5 + 0.5;
|
||||
return tex2D(surface, float2(scaledRoughness, viewAngle)).rgb * color.rgb;
|
||||
}
|
||||
return color.rgb;
|
||||
}
|
||||
|
||||
float ComputeMask(
|
||||
VertexOutput IN,
|
||||
#ifdef NORMAL_MAP_ON
|
||||
float3x3 tangentTransform,
|
||||
float3 surfaceNormal,
|
||||
#endif
|
||||
int maskType,
|
||||
float4 layerParameters,
|
||||
float3 maskAxis
|
||||
) {
|
||||
if (maskType == MASK_TYPE_POSITIONAL) {
|
||||
float centerDistance = layerParameters.x;
|
||||
float fadeAbove = layerParameters.y;
|
||||
float fadeBelow = layerParameters.z;
|
||||
float3 objPos = mul(unity_WorldToObject, float4(IN.worldPos, 1.0)).xyz;
|
||||
float d = dot(objPos, maskAxis);
|
||||
if (d > centerDistance) {
|
||||
return saturate(1.0 - (d - centerDistance) / fadeAbove);
|
||||
}
|
||||
else {
|
||||
return saturate(1.0 - (centerDistance - d) / fadeBelow);
|
||||
}
|
||||
}
|
||||
else if (maskType == MASK_TYPE_REFLECTION) {
|
||||
float fadeStart = layerParameters.x;
|
||||
float fadeEnd = layerParameters.y;
|
||||
#ifdef NORMAL_MAP_ON
|
||||
float normalMapStrength = layerParameters.z;
|
||||
#endif
|
||||
float power = layerParameters.w;
|
||||
float3 viewReflect = reflect(-IN.viewDir, COMPUTE_NORMAL);
|
||||
float d = max(0.0, dot(viewReflect, maskAxis));
|
||||
return saturate(1.0 - (d - fadeStart) / (fadeEnd - fadeStart));
|
||||
}
|
||||
else if (maskType == MASK_TYPE_FRESNEL) {
|
||||
float power = layerParameters.x;
|
||||
float fadeStart = layerParameters.y;
|
||||
float fadeEnd = layerParameters.z;
|
||||
#ifdef NORMAL_MAP_ON
|
||||
float normalMapStrength = layerParameters.w;
|
||||
#endif
|
||||
float d = saturate(1.0 - max(0.0, dot(IN.viewDir, COMPUTE_NORMAL)));
|
||||
float p = pow(d, power);
|
||||
return saturate(lerp(fadeStart, fadeEnd, p));
|
||||
}
|
||||
else if (maskType == MASK_TYPE_PULSE) {
|
||||
float distance = layerParameters.x;
|
||||
float speed = layerParameters.y;
|
||||
float power = layerParameters.z;
|
||||
float3 objPos = mul(unity_WorldToObject, float4(IN.worldPos, 1.0)).xyz;
|
||||
float d = dot(objPos, maskAxis);
|
||||
float theta = 6.2831 * frac((d - _Time.g * speed) / distance);
|
||||
return saturate(pow((sin(theta) * 0.5 + 0.5), power));
|
||||
}
|
||||
else {
|
||||
return 1.0;
|
||||
}
|
||||
}
|
||||
|
||||
float3 ComputeBlend(float3 source, float3 blend, float mask, int blendMode) {
|
||||
if (blendMode == BLEND_MODE_MULTIPLY) {
|
||||
return source * (blend * mask);
|
||||
}
|
||||
else {
|
||||
return source + (blend * mask);
|
||||
}
|
||||
}
|
||||
|
||||
float4 ComputeSurface(VertexOutput IN)
|
||||
{
|
||||
#if PROJECTOR_ON
|
||||
float3 projectorPos = mul(_ProjectorWorldToLocal, float4(IN.worldPos, 1.0)).xyz;
|
||||
if (abs(projectorPos.x) > 1.0 || abs(projectorPos.y) > 1.0 || abs(projectorPos.z) > 1.0)
|
||||
{
|
||||
discard;
|
||||
}
|
||||
float2 uv = projectorPos.xy * 0.5 + 0.5;
|
||||
#else
|
||||
float2 uv = IN.texcoord.xy;
|
||||
#endif
|
||||
|
||||
fixed4 c = _BaseColor;
|
||||
IN.worldNormal = normalize(IN.worldNormal);
|
||||
|
||||
#if PARALLAX_ON || NORMAL_MAP_ON
|
||||
float3x3 tangentTransform = float3x3(IN.worldTangent, IN.worldBitangent, IN.worldNormal);
|
||||
#endif
|
||||
|
||||
#ifdef NORMAL_MAP_ON
|
||||
float3 surfaceNormal = UnpackNormal(tex2D(_NormalMap, TRANSFORM_TEX(uv, _NormalMap)));
|
||||
#endif
|
||||
|
||||
#if PARALLAX_ON || NORMAL_MAP_ON
|
||||
#ifndef NORMAL_MAP_ON
|
||||
#define COLOR_INPUTS IN, uv, tangentTransform
|
||||
#define MASK_INPUTS IN
|
||||
#else
|
||||
#define COLOR_INPUTS IN, uv, tangentTransform, surfaceNormal
|
||||
#define MASK_INPUTS IN, tangentTransform, surfaceNormal
|
||||
#endif
|
||||
#else
|
||||
#define COLOR_INPUTS IN, uv
|
||||
#define MASK_INPUTS IN
|
||||
#endif
|
||||
|
||||
#define LAYER_COLOR(index) ComputeColor(COLOR_INPUTS, _LayerSurface##index, _LayerSurface##index##_ST, _LayerColor##index, _LayerSampleMode##index, _LayerSampleParameters##index)
|
||||
#define LAYER_MASK(index) ComputeMask(MASK_INPUTS, _LayerMaskType##index, _LayerMaskParameters##index, _LayerMaskAxis##index##.xyz)
|
||||
#define LAYER_BLEND(index, c) ComputeBlend(c, LAYER_COLOR(index), LAYER_MASK(index), _LayerBlendMode##index)
|
||||
|
||||
c.rgb = LAYER_BLEND(0, c.rgb);
|
||||
#if LAYER_COUNT > 1
|
||||
c.rgb = LAYER_BLEND(1, c.rgb);
|
||||
#endif
|
||||
#if LAYER_COUNT > 2
|
||||
c.rgb = LAYER_BLEND(2, c.rgb);
|
||||
#endif
|
||||
#if LAYER_COUNT > 3
|
||||
c.rgb = LAYER_BLEND(3, c.rgb);
|
||||
#endif
|
||||
#if LAYER_COUNT > 4
|
||||
c.rgb = LAYER_BLEND(4, c.rgb);
|
||||
#endif
|
||||
#if LAYER_COUNT > 5
|
||||
c.rgb = LAYER_BLEND(5, c.rgb);
|
||||
#endif
|
||||
#if LAYER_COUNT > 6
|
||||
c.rgb = LAYER_BLEND(6, c.rgb);
|
||||
#endif
|
||||
#if LAYER_COUNT > 7
|
||||
c.rgb = LAYER_BLEND(7, c.rgb);
|
||||
#endif
|
||||
|
||||
#ifdef VERTALPHA_ON
|
||||
float scaledValue = IN.vertColor.a * 2.0;
|
||||
float alpha0weight = max(0.0, 1.0 - scaledValue);
|
||||
float alpha2weight = max(0.0, scaledValue - 1.0);
|
||||
float alpha1weight = 1.0 - alpha0weight - alpha2weight;
|
||||
c.a = _Alpha * c.a * (tex2D(_AlphaMask, TRANSFORM_TEX(uv, _AlphaMask)).r * alpha1weight + tex2D(_AlphaMask2, TRANSFORM_TEX(uv, _AlphaMask2)).r * alpha2weight + alpha0weight) * ComputeMask(MASK_INPUTS, _BaseMaskType, _BaseMaskParameters, _BaseMaskAxis);
|
||||
#else
|
||||
c.a = _Alpha * c.a * tex2D(_AlphaMask, TRANSFORM_TEX(uv, _AlphaMask)).r * IN.vertColor.a * ComputeMask(MASK_INPUTS, _BaseMaskType, _BaseMaskParameters, _BaseMaskAxis);
|
||||
#endif
|
||||
c.rgb = lerp(c.rgb, c.rgb * _DarkMultiplier, IN.vertColor.r);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 80b6b34e742970d4bb0cdef9c74b04ae
|
||||
timeCreated: 1525971186
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,141 +0,0 @@
|
||||
Shader "OvrAvatar/AvatarSurfaceShader" {
|
||||
Properties{
|
||||
// Global parameters
|
||||
_Alpha("Alpha", Range(0.0, 1.0)) = 1.0
|
||||
_DarkMultiplier("Dark Multiplier", Color) = (0.6, 0.6, 0.6, 1.0)
|
||||
_BaseColor("Base Color", Color) = (0.0, 0.0, 0.0, 0.0)
|
||||
_BaseMaskType("Base Mask Type", Int) = 0
|
||||
_BaseMaskParameters("Base Mask Parameters", Vector) = (0, 0, 0, 0)
|
||||
_BaseMaskAxis("Base Mask Axis", Vector) = (0, 1, 0, 0)
|
||||
_AlphaMask("Alpha Mask", 2D) = "white" {}
|
||||
_NormalMap("Normal Map", 2D) = "" {}
|
||||
_ParallaxMap("Parallax Map", 2D) = "" {}
|
||||
_RoughnessMap("Roughness Map", 2D) = "" {}
|
||||
|
||||
// Layer 0 parameters
|
||||
_LayerSampleMode0("Layer Sample Mode 0", Int) = 0
|
||||
_LayerBlendMode0("Layer Blend Mode 0", Int) = 0
|
||||
_LayerMaskType0("Layer Mask Type 0", Int) = 0
|
||||
_LayerColor0("Layer Color 0", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface0("Layer Surface 0", 2D) = "" {}
|
||||
_LayerSampleParameters0("Layer Sample Parameters 0", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters0("Layer Mask Parameters 0", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis0("Layer Mask Axis 0", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 1 parameters
|
||||
_LayerSampleMode1("Layer Sample Mode 1", Int) = 0
|
||||
_LayerBlendMode1("Layer Blend Mode 1", Int) = 0
|
||||
_LayerMaskType1("Layer Mask Type 1", Int) = 0
|
||||
_LayerColor1("Layer Color 1", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface1("Layer Surface 1", 2D) = "" {}
|
||||
_LayerSampleParameters1("Layer Sample Parameters 1", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters1("Layer Mask Parameters 1", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis1("Layer Mask Axis 1", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 2 parameters
|
||||
_LayerSampleMode2("Layer Sample Mode 2", Int) = 0
|
||||
_LayerBlendMode2("Layer Blend Mode 2", Int) = 0
|
||||
_LayerMaskType2("Layer Mask Type 2", Int) = 0
|
||||
_LayerColor2("Layer Color 2", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface2("Layer Surface 2", 2D) = "" {}
|
||||
_LayerSampleParameters2("Layer Sample Parameters 2", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters2("Layer Mask Parameters 2", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis2("Layer Mask Axis 2", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 3 parameters
|
||||
_LayerSampleMode3("Layer Sample Mode 3", Int) = 0
|
||||
_LayerBlendMode3("Layer Blend Mode 3", Int) = 0
|
||||
_LayerMaskType3("Layer Mask Type 3", Int) = 0
|
||||
_LayerColor3("Layer Color 3", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface3("Layer Surface 3", 2D) = "" {}
|
||||
_LayerSampleParameters3("Layer Sample Parameters 3", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters3("Layer Mask Parameters 3", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis3("Layer Mask Axis 3", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 4 parameters
|
||||
_LayerSampleMode4("Layer Sample Mode 4", Int) = 0
|
||||
_LayerBlendMode4("Layer Blend Mode 4", Int) = 0
|
||||
_LayerMaskType4("Layer Mask Type 4", Int) = 0
|
||||
_LayerColor4("Layer Color 4", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface4("Layer Surface 4", 2D) = "" {}
|
||||
_LayerSampleParameters4("Layer Sample Parameters 4", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters4("Layer Mask Parameters 4", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis4("Layer Mask Axis 4", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 5 parameters
|
||||
_LayerSampleMode5("Layer Sample Mode 5", Int) = 0
|
||||
_LayerBlendMode5("Layer Blend Mode 5", Int) = 0
|
||||
_LayerMaskType5("Layer Mask Type 5", Int) = 0
|
||||
_LayerColor5("Layer Color 5", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface5("Layer Surface 5", 2D) = "" {}
|
||||
_LayerSampleParameters5("Layer Sample Parameters 5", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters5("Layer Mask Parameters 5", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis5("Layer Mask Axis 5", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 6 parameters
|
||||
_LayerSampleMode6("Layer Sample Mode 6", Int) = 0
|
||||
_LayerBlendMode6("Layer Blend Mode 6", Int) = 0
|
||||
_LayerMaskType6("Layer Mask Type 6", Int) = 0
|
||||
_LayerColor6("Layer Color 6", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface6("Layer Surface 6", 2D) = "" {}
|
||||
_LayerSampleParameters6("Layer Sample Parameters 6", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters6("Layer Mask Parameters 6", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis6("Layer Mask Axis 6", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 7 parameters
|
||||
_LayerSampleMode7("Layer Sample Mode 7", Int) = 0
|
||||
_LayerBlendMode7("Layer Blend Mode 7", Int) = 0
|
||||
_LayerMaskType7("Layer Mask Type 7", Int) = 0
|
||||
_LayerColor7("Layer Color 7", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface7("Layer Surface 7", 2D) = "" {}
|
||||
_LayerSampleParameters7("Layer Sample Parameters 7", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters7("Layer Mask Parameters 7", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis7("Layer Mask Axis 7", Vector) = (0, 1, 0, 0)
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue" = "Transparent"
|
||||
"RenderType" = "Transparent"
|
||||
}
|
||||
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZWrite Off
|
||||
LOD 200
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "FORWARD"
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "ForwardBase"
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#pragma only_renderers d3d11 gles3 gles
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.0
|
||||
#pragma multi_compile PROJECTOR_OFF PROJECTOR_ON
|
||||
#pragma multi_compile NORMAL_MAP_OFF NORMAL_MAP_ON
|
||||
#pragma multi_compile PARALLAX_OFF PARALLAX_ON
|
||||
#pragma multi_compile ROUGHNESS_OFF ROUGHNESS_ON
|
||||
#pragma multi_compile VERTALPHA_OFF VERTALPHA_ON
|
||||
#pragma multi_compile LAYERS_1 LAYERS_2 LAYERS_3 LAYERS_4 LAYERS_5 LAYERS_6 LAYERS_7 LAYERS_8
|
||||
|
||||
#include "Assets/Oculus/Avatar/Resources/Materials/AvatarMaterialStateShader.cginc"
|
||||
|
||||
float4 frag(VertexOutput IN) : COLOR
|
||||
{
|
||||
return ComputeSurface(IN);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
FallBack "Diffuse"
|
||||
CustomEditor "AvatarMaterialEditor"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73f67c4e7bf718b4385aa6b1f8a06591
|
||||
timeCreated: 1525971190
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,79 +0,0 @@
|
||||
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
||||
|
||||
Shader "OvrAvatar/AvatarSurfaceShaderPBS" {
|
||||
Properties{
|
||||
// Global parameters
|
||||
_Alpha("Alpha", Range(0.0, 1.0)) = 1.0
|
||||
_Albedo("Albedo (RGB)", 2D) = "" {}
|
||||
_Surface("Metallic (R) Occlusion (G) and Smoothness (A)", 2D) = "" {}
|
||||
}
|
||||
SubShader{
|
||||
Tags {
|
||||
"Queue" = "Transparent"
|
||||
"RenderType" = "Transparent"
|
||||
}
|
||||
|
||||
Pass {
|
||||
ZWrite On
|
||||
Cull Off
|
||||
ColorMask 0
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.0
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f {
|
||||
float4 position : SV_POSITION;
|
||||
};
|
||||
v2f vert(appdata_full v) {
|
||||
// Output
|
||||
v2f output;
|
||||
output.position = UnityObjectToClipPos(v.vertex);
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 frag(v2f input) : COLOR {
|
||||
return 0;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
|
||||
LOD 200
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
// Physically based Standard lighting model, and enable shadows on all light types
|
||||
#pragma surface surf Standard vertex:vert nolightmap alpha noforwardadd
|
||||
|
||||
float _Alpha;
|
||||
sampler2D _Albedo;
|
||||
float4 _Albedo_ST;
|
||||
sampler2D _Surface;
|
||||
float4 _Surface_ST;
|
||||
|
||||
struct Input {
|
||||
float2 texcoord;
|
||||
};
|
||||
|
||||
void vert(inout appdata_full v, out Input o) {
|
||||
UNITY_INITIALIZE_OUTPUT(Input, o);
|
||||
o.texcoord = v.texcoord.xy;
|
||||
}
|
||||
|
||||
void surf (Input IN, inout SurfaceOutputStandard o) {
|
||||
o.Albedo = tex2D(_Albedo, TRANSFORM_TEX(IN.texcoord, _Albedo)).rgb;
|
||||
float4 surfaceParams = tex2D(_Surface, TRANSFORM_TEX(IN.texcoord, _Surface));
|
||||
o.Metallic = surfaceParams.r;
|
||||
o.Occlusion = surfaceParams.g;
|
||||
o.Smoothness = surfaceParams.a;
|
||||
o.Alpha = _Alpha;
|
||||
}
|
||||
|
||||
#pragma only_renderers d3d11 gles3 gles
|
||||
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e52aa58207bbf24d8eb8ec969e9ae88
|
||||
timeCreated: 1525971190
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,39 +0,0 @@
|
||||
Shader "OvrAvatar/AvatarSurfaceShaderPBSV2" {
|
||||
Properties {
|
||||
_AlbedoMultiplier ("Albedo Multiplier", Color) = (1,1,1,1)
|
||||
_Albedo ("Albedo (RGB)", 2D) = "white" {}
|
||||
_Metallicness("Metallicness", 2D) = "grey" {}
|
||||
_GlossinessScale ("Glossiness Scale", Range(0,1)) = 0.5
|
||||
}
|
||||
SubShader {
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 200
|
||||
|
||||
CGPROGRAM
|
||||
// Physically based Standard lighting model, and enable shadows on all light types
|
||||
#pragma surface surf Standard fullforwardshadows
|
||||
|
||||
// Use shader model 3.0 target, to get nicer looking lighting
|
||||
#pragma target 3.0
|
||||
|
||||
sampler2D _Albedo;
|
||||
sampler2D _Metallicness;
|
||||
|
||||
struct Input {
|
||||
float2 uv_Albedo;
|
||||
};
|
||||
|
||||
float _GlossinessScale;
|
||||
float4 _AlbedoMultiplier;
|
||||
|
||||
void surf (Input IN, inout SurfaceOutputStandard o) {
|
||||
fixed4 c = tex2D (_Albedo, IN.uv_Albedo) * _AlbedoMultiplier;
|
||||
o.Albedo = c.rgb;
|
||||
o.Metallic = tex2D (_Metallicness, IN.uv_Albedo).r;
|
||||
o.Smoothness = _GlossinessScale;
|
||||
o.Alpha = 1.0;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
FallBack "Diffuse"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 176faebcc612eb147900defeda2149cb
|
||||
timeCreated: 1525971187
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,175 +0,0 @@
|
||||
Shader "OvrAvatar/AvatarSurfaceShaderSelfOccluding" {
|
||||
Properties{
|
||||
// Global parameters
|
||||
_Alpha("Alpha", Range(0.0, 1.0)) = 1.0
|
||||
_DarkMultiplier("Dark Multiplier", Color) = (0.6, 0.6, 0.6, 1.0)
|
||||
_BaseColor("Base Color", Color) = (0.0, 0.0, 0.0, 0.0)
|
||||
_BaseMaskType("Base Mask Type", Int) = 0
|
||||
_BaseMaskParameters("Base Mask Parameters", Vector) = (0, 0, 0, 0)
|
||||
_BaseMaskAxis("Base Mask Axis", Vector) = (0, 1, 0, 0)
|
||||
_AlphaMask("Alpha Mask", 2D) = "white" {}
|
||||
_NormalMap("Normal Map", 2D) = "" {}
|
||||
_ParallaxMap("Parallax Map", 2D) = "" {}
|
||||
_RoughnessMap("Roughness Map", 2D) = "" {}
|
||||
|
||||
// Layer 0 parameters
|
||||
_LayerSampleMode0("Layer Sample Mode 0", Int) = 0
|
||||
_LayerBlendMode0("Layer Blend Mode 0", Int) = 0
|
||||
_LayerMaskType0("Layer Mask Type 0", Int) = 0
|
||||
_LayerColor0("Layer Color 0", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface0("Layer Surface 0", 2D) = "" {}
|
||||
_LayerSampleParameters0("Layer Sample Parameters 0", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters0("Layer Mask Parameters 0", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis0("Layer Mask Axis 0", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 1 parameters
|
||||
_LayerSampleMode1("Layer Sample Mode 1", Int) = 0
|
||||
_LayerBlendMode1("Layer Blend Mode 1", Int) = 0
|
||||
_LayerMaskType1("Layer Mask Type 1", Int) = 0
|
||||
_LayerColor1("Layer Color 1", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface1("Layer Surface 1", 2D) = "" {}
|
||||
_LayerSampleParameters1("Layer Sample Parameters 1", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters1("Layer Mask Parameters 1", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis1("Layer Mask Axis 1", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 2 parameters
|
||||
_LayerSampleMode2("Layer Sample Mode 2", Int) = 0
|
||||
_LayerBlendMode2("Layer Blend Mode 2", Int) = 0
|
||||
_LayerMaskType2("Layer Mask Type 2", Int) = 0
|
||||
_LayerColor2("Layer Color 2", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface2("Layer Surface 2", 2D) = "" {}
|
||||
_LayerSampleParameters2("Layer Sample Parameters 2", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters2("Layer Mask Parameters 2", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis2("Layer Mask Axis 2", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 3 parameters
|
||||
_LayerSampleMode3("Layer Sample Mode 3", Int) = 0
|
||||
_LayerBlendMode3("Layer Blend Mode 3", Int) = 0
|
||||
_LayerMaskType3("Layer Mask Type 3", Int) = 0
|
||||
_LayerColor3("Layer Color 3", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface3("Layer Surface 3", 2D) = "" {}
|
||||
_LayerSampleParameters3("Layer Sample Parameters 3", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters3("Layer Mask Parameters 3", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis3("Layer Mask Axis 3", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 4 parameters
|
||||
_LayerSampleMode4("Layer Sample Mode 4", Int) = 0
|
||||
_LayerBlendMode4("Layer Blend Mode 4", Int) = 0
|
||||
_LayerMaskType4("Layer Mask Type 4", Int) = 0
|
||||
_LayerColor4("Layer Color 4", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface4("Layer Surface 4", 2D) = "" {}
|
||||
_LayerSampleParameters4("Layer Sample Parameters 4", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters4("Layer Mask Parameters 4", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis4("Layer Mask Axis 4", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 5 parameters
|
||||
_LayerSampleMode5("Layer Sample Mode 5", Int) = 0
|
||||
_LayerBlendMode5("Layer Blend Mode 5", Int) = 0
|
||||
_LayerMaskType5("Layer Mask Type 5", Int) = 0
|
||||
_LayerColor5("Layer Color 5", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface5("Layer Surface 5", 2D) = "" {}
|
||||
_LayerSampleParameters5("Layer Sample Parameters 5", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters5("Layer Mask Parameters 5", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis5("Layer Mask Axis 5", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 6 parameters
|
||||
_LayerSampleMode6("Layer Sample Mode 6", Int) = 0
|
||||
_LayerBlendMode6("Layer Blend Mode 6", Int) = 0
|
||||
_LayerMaskType6("Layer Mask Type 6", Int) = 0
|
||||
_LayerColor6("Layer Color 6", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface6("Layer Surface 6", 2D) = "" {}
|
||||
_LayerSampleParameters6("Layer Sample Parameters 6", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters6("Layer Mask Parameters 6", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis6("Layer Mask Axis 6", Vector) = (0, 1, 0, 0)
|
||||
|
||||
// Layer 7 parameters
|
||||
_LayerSampleMode7("Layer Sample Mode 7", Int) = 0
|
||||
_LayerBlendMode7("Layer Blend Mode 7", Int) = 0
|
||||
_LayerMaskType7("Layer Mask Type 7", Int) = 0
|
||||
_LayerColor7("Layer Color 7", Color) = (1.0, 1.0, 1.0, 1.0)
|
||||
_LayerSurface7("Layer Surface 7", 2D) = "" {}
|
||||
_LayerSampleParameters7("Layer Sample Parameters 7", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskParameters7("Layer Mask Parameters 7", Vector) = (0, 0, 0, 0)
|
||||
_LayerMaskAxis7("Layer Mask Axis 7", Vector) = (0, 1, 0, 0)
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"Queue" = "Transparent"
|
||||
"RenderType" = "Transparent"
|
||||
}
|
||||
|
||||
Pass
|
||||
{
|
||||
ZWrite On
|
||||
Cull Off
|
||||
ColorMask 0
|
||||
Offset 1, 1
|
||||
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.0
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 position : SV_POSITION;
|
||||
};
|
||||
|
||||
v2f vert(appdata_full v)
|
||||
{
|
||||
// Output
|
||||
v2f output;
|
||||
output.position = UnityObjectToClipPos(v.vertex);
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 frag(v2f input) : COLOR
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
ZWrite Off
|
||||
LOD 200
|
||||
|
||||
Pass
|
||||
{
|
||||
Name "FORWARD"
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "ForwardBase"
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#pragma only_renderers d3d11 gles3 gles
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.0
|
||||
#pragma multi_compile PROJECTOR_OFF PROJECTOR_ON
|
||||
#pragma multi_compile NORMAL_MAP_OFF NORMAL_MAP_ON
|
||||
#pragma multi_compile PARALLAX_OFF PARALLAX_ON
|
||||
#pragma multi_compile ROUGHNESS_OFF ROUGHNESS_ON
|
||||
#pragma multi_compile VERTALPHA_OFF VERTALPHA_ON
|
||||
#pragma multi_compile LAYERS_1 LAYERS_2 LAYERS_3 LAYERS_4 LAYERS_5 LAYERS_6 LAYERS_7 LAYERS_8
|
||||
|
||||
#include "Assets/Oculus/Avatar/Resources/Materials/AvatarMaterialStateShader.cginc"
|
||||
|
||||
float4 frag(VertexOutput IN) : SV_Target
|
||||
{
|
||||
return ComputeSurface(IN);
|
||||
}
|
||||
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
|
||||
FallBack "Diffuse"
|
||||
CustomEditor "AvatarMaterialEditor"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 69f342b79d37541489919a19cfd8a924
|
||||
timeCreated: 1525971190
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ced8ef067736a0b468cde573cc63e3ec
|
||||
folderAsset: yes
|
||||
timeCreated: 1525971173
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,217 +0,0 @@
|
||||
//
|
||||
// *** OvrAvatar Mobile Combined Mesh shader ***
|
||||
// *** Texture array approach for rendering a combined mesh avatar ***
|
||||
//
|
||||
// This is a Unity vertex-fragnment shader implementation for our 1.5 skin shaded avatar look.
|
||||
// The benefit of using this version is performance as it bypasses the PBR lighting model and
|
||||
// so is generally recommended for use on mobile.
|
||||
//
|
||||
// This is the texture array version of the shader, which will draw all pre-combined
|
||||
// components in one draw call. This is coupled with OvrAvatarMaterialManager to populate the
|
||||
// shader properties.
|
||||
//
|
||||
// Shader keywords:
|
||||
// - SECONDARY_LIGHT_ON SECONDARY_LIGHT_OFF
|
||||
// Enable SECONDARY_LIGHT_ON for a second "light" as expressed by _SecondaryLightDirection
|
||||
// and _SecondaryLightColor to influence the standard rim effect. This is designed for use in video watching
|
||||
// experiences to sample the screen color and apply this to the rim term.
|
||||
// - NO_BACKLIGHT_ON NO_BACKLIGHT_OFF
|
||||
// This effect is active by default: NO_BACKLIGHT_OFF is the default and enables the effect. Enable NO_BACKLIGHT_ON
|
||||
// to disable illumination from the rear of the main light direction. This mobile shader supports one directional
|
||||
// light. This can cause the un-illuminated side of the avatar to lose definition.
|
||||
//
|
||||
// Notes:
|
||||
// - The primary light in your scene will be used to calculate lighting.
|
||||
// - We don't have a mouth bone, but the vertex shader will animate the vertices around the mouth
|
||||
// area according to the _Voice value. This should be set according to local microphone value
|
||||
// range between 0-1.
|
||||
|
||||
Shader "OvrAvatar/Avatar_Mobile_CombinedMesh"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("Main Texture Array", 2DArray) = "white" {}
|
||||
_NormalMap("Normal Map Array", 2DArray) = "bump" {}
|
||||
_RoughnessMap("Roughness Map Array", 2DArray) = "black" {}
|
||||
|
||||
_Dimmer("Dimmer", Range(0.0,1.0)) = 1.0
|
||||
_Alpha("Alpha", Range(0.0,1.0)) = 1.0
|
||||
|
||||
_Voice("Voice", Range(0.0,1.0)) = 1.0
|
||||
[HideInInspector] _MouthPosition("Mouth position", Vector) = (0,0,0,1)
|
||||
[HideInInspector] _MouthDirection("Mouth direction", Vector) = (0,0,0,1)
|
||||
[HideInInspector] _MouthEffectDistance("Mouth Effect Distance", Float) = 0.03
|
||||
[HideInInspector] _MouthEffectScale("Mouth Effect Scaler", Float) = 1
|
||||
|
||||
// Index into the texture array needs an offset for precision
|
||||
_Slices("Texture Array Slices", int) = 4.97
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "ForwardBase" "Queue" = "Transparent" "RenderType" = "Transparent" "IgnoreProjector" = "True"
|
||||
}
|
||||
LOD 100
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
Cull Back
|
||||
ColorMask RGB
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.5
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma multi_compile SECONDARY_LIGHT_OFF SECONDARY_LIGHT_ON
|
||||
#pragma multi_compile BACKLIGHT_OFF BACKLIGHT_ON
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityLightingCommon.cginc"
|
||||
|
||||
UNITY_DECLARE_TEX2DARRAY(_MainTex);
|
||||
UNITY_DECLARE_TEX2DARRAY(_NormalMap);
|
||||
uniform float4 _NormalMap_ST;
|
||||
UNITY_DECLARE_TEX2DARRAY(_RoughnessMap);
|
||||
|
||||
uniform int _Slices;
|
||||
|
||||
uniform float4 _BaseColor[5];
|
||||
uniform float _DiffuseIntensity[5];
|
||||
uniform float _RimIntensity[5];
|
||||
uniform float _BacklightIntensity[5];
|
||||
uniform float _ReflectionIntensity[5];
|
||||
|
||||
uniform float3 _SecondaryLightDirection;
|
||||
uniform float4 _SecondaryLightColor;
|
||||
|
||||
uniform float _Dimmer;
|
||||
uniform float _Alpha;
|
||||
|
||||
uniform float _Voice;
|
||||
uniform float4 _MouthPosition;
|
||||
uniform float4 _MouthDirection;
|
||||
uniform float _MouthEffectDistance;
|
||||
uniform float _MouthEffectScale;
|
||||
|
||||
static const fixed MOUTH_ZSCALE = 0.5f;
|
||||
static const fixed MOUTH_DROPOFF = 0.01f;
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex: POSITION;
|
||||
float3 normal: NORMAL;
|
||||
float4 tangent: TANGENT;
|
||||
float2 texcoord: TEXCOORD0;
|
||||
float4 vertexColor : COLOR0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float3 uv : TEXCOORD0;
|
||||
float4 posWorld: TEXCOORD1;
|
||||
float3 normalDir: TEXCOORD2;
|
||||
float3 tangentDir: TEXCOORD3;
|
||||
float3 bitangentDir: TEXCOORD4;
|
||||
};
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
|
||||
// Mouth vertex animation with voip
|
||||
float4 worldVert = mul(unity_ObjectToWorld, v.vertex);;
|
||||
float3 delta = _MouthPosition - worldVert;
|
||||
delta.z *= MOUTH_ZSCALE;
|
||||
float dist = length(delta);
|
||||
float scaledMouthDropoff = _MouthEffectScale * MOUTH_DROPOFF;
|
||||
float scaledMouthEffect = _MouthEffectScale * _MouthEffectDistance;
|
||||
float displacement = _Voice * smoothstep(scaledMouthEffect + scaledMouthDropoff, scaledMouthEffect, dist);
|
||||
worldVert.xyz -= _MouthDirection * displacement;
|
||||
v.vertex = mul(unity_WorldToObject, worldVert);
|
||||
|
||||
// Calculate tangents for normal mapping
|
||||
o.normalDir = normalize(UnityObjectToWorldNormal(v.normal));
|
||||
o.tangentDir = normalize(mul(unity_ObjectToWorld, half4(v.tangent.xyz, 0.0)).xyz);
|
||||
o.bitangentDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w);
|
||||
|
||||
o.posWorld = worldVert;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv.xy = v.texcoord;
|
||||
o.uv.z = v.vertexColor.x * _Slices;
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : COLOR
|
||||
{
|
||||
// Light direction
|
||||
float3 lightDirection = _WorldSpaceLightPos0.xyz;
|
||||
|
||||
// Unpack normal map
|
||||
float3 transformedNormalUV = i.uv;
|
||||
transformedNormalUV.xy = float2(TRANSFORM_TEX(i.uv.xy, _NormalMap));
|
||||
float3 normalMap = UNITY_SAMPLE_TEX2DARRAY(_NormalMap, transformedNormalUV).rgb * 2 - 1;
|
||||
|
||||
// Calculate normal
|
||||
float3x3 tangentTransform = float3x3(i.tangentDir, i.bitangentDir, i.normalDir);
|
||||
float3 normalDirection = normalize(mul(normalMap.rgb, tangentTransform));
|
||||
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
|
||||
|
||||
// Apply view, normal, and lighting dependent terms
|
||||
float VdotN = saturate(dot(viewDirection, normalDirection));
|
||||
float NdotL = saturate(dot(normalDirection, lightDirection));
|
||||
|
||||
float LightColorNdotL = NdotL * _LightColor0;
|
||||
|
||||
// Sample the default reflection cubemap using the reflection vector
|
||||
float3 worldReflection = reflect(-viewDirection, normalDirection);
|
||||
half4 skyData = UNITY_SAMPLE_TEXCUBE(unity_SpecCube0, worldReflection);
|
||||
// Decode cubemap data into actual color
|
||||
half3 reflectionColor = DecodeHDR(skyData, unity_SpecCube0_HDR);
|
||||
|
||||
// Calculate color for each component
|
||||
float4 col;
|
||||
// Get index into texture array
|
||||
int componentIndex = floor(i.uv.z + 0.5);
|
||||
// Diffuse texture sample
|
||||
col = UNITY_SAMPLE_TEX2DARRAY(_MainTex, i.uv);
|
||||
// Multiply in color tint (don't need to deal with gamma/linear here as conversion already done)
|
||||
col.rgb *= _BaseColor[componentIndex];
|
||||
// Main light
|
||||
col.rgb += _DiffuseIntensity[componentIndex] * LightColorNdotL;
|
||||
#ifdef NO_BACKLIGHT_ON
|
||||
//NO_BACKLIGHT_ON disables the rear illumination
|
||||
#else
|
||||
// Illuminate from behind
|
||||
float3 reverseLightDirection = lightDirection * -1;
|
||||
float NdotInvL = saturate(dot(normalDirection, normalize(reverseLightDirection)));
|
||||
col.rgb += (_DiffuseIntensity[componentIndex] * _BacklightIntensity[componentIndex]) * NdotInvL * _LightColor0;
|
||||
#endif
|
||||
// Rim term
|
||||
#ifdef SECONDARY_LIGHT_ON
|
||||
// Secondary light proxy (direction and color) passed into the rim term
|
||||
NdotL = saturate(dot(normalDirection, _SecondaryLightDirection));
|
||||
col.rgb += pow(1.0 - VdotN, _RimIntensity[componentIndex]) * NdotL * _SecondaryLightColor;
|
||||
#else
|
||||
col.rgb += pow(1.0 - VdotN, _RimIntensity[componentIndex]) * LightColorNdotL;
|
||||
#endif
|
||||
// Reflection
|
||||
col.rgb += reflectionColor * UNITY_SAMPLE_TEX2DARRAY(_RoughnessMap, i.uv).a * _ReflectionIntensity[componentIndex];
|
||||
|
||||
// Global dimmer
|
||||
col.rgb *= _Dimmer;
|
||||
// Global alpha
|
||||
col.a *= _Alpha;
|
||||
#if !defined(UNITY_COLORSPACE_GAMMA)
|
||||
col.rgb = GammaToLinearSpace(col.rgb);
|
||||
#endif
|
||||
// Return clamped final color
|
||||
return saturate(col);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37d2b8298f61cd2469465fc36108675d
|
||||
timeCreated: 1526311739
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,165 +0,0 @@
|
||||
//
|
||||
|
||||
// *** OvrAvatar Mobile Single Component Loading shader ***
|
||||
|
||||
//
|
||||
|
||||
// Cut-down single component version of the avatar shader to be used during loading.
|
||||
|
||||
// See main mobile shader for implementation notes.
|
||||
|
||||
|
||||
|
||||
Shader "OvrAvatar/Avatar_Mobile_Loader"
|
||||
|
||||
{
|
||||
|
||||
Properties
|
||||
|
||||
{
|
||||
|
||||
_NormalMap("Normal Map", 2D) = "bump" {}
|
||||
|
||||
|
||||
|
||||
_BaseColor("Color Tint", Color) = (1.0,1.0,1.0,1.0)
|
||||
|
||||
_Dimmer("Dimmer", Range(0.0,1.0)) = 1.0
|
||||
|
||||
_LoadingDimmer("Loading Dimmer", Range(0.0,1.0)) = 1.0
|
||||
|
||||
_Alpha("Alpha", Range(0.0,1.0)) = 1.0
|
||||
|
||||
|
||||
|
||||
_DiffuseIntensity("Diffuse Intensity", Range(0.0,1.0)) = 0.3
|
||||
|
||||
_RimIntensity("Rim Intensity", Range(0.0,10.0)) = 5.0
|
||||
|
||||
_BacklightIntensity("Backlight Intensity", Range(0.0,1.0)) = 1.0
|
||||
|
||||
|
||||
|
||||
_Voice("Voice", Range(0.0,1.0)) = 0.0
|
||||
|
||||
[HideInInspector] _MouthPosition("Mouth position", Vector) = (0,0,0,1)
|
||||
|
||||
[HideInInspector] _MouthDirection("Mouth direction", Vector) = (0,0,0,1)
|
||||
|
||||
[HideInInspector] _MouthEffectDistance("Mouth Effect Distance", Float) = 0.03
|
||||
|
||||
[HideInInspector] _MouthEffectScale("Mouth Effect Scaler", Float) = 1
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
SubShader
|
||||
|
||||
{
|
||||
|
||||
Pass
|
||||
|
||||
{
|
||||
|
||||
Tags
|
||||
|
||||
{
|
||||
|
||||
"LightMode" = "ForwardBase" "Queue" = "Transparent" "RenderType" = "Transparent" "IgnoreProjector" = "True"
|
||||
|
||||
}
|
||||
|
||||
LOD 100
|
||||
|
||||
ZWrite On
|
||||
|
||||
ZTest LEqual
|
||||
|
||||
Cull Back
|
||||
|
||||
ColorMask RGB
|
||||
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
CGPROGRAM
|
||||
|
||||
#pragma vertex vert
|
||||
|
||||
#pragma fragment frag
|
||||
|
||||
#pragma target 3.5
|
||||
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
|
||||
#pragma multi_compile NO_BACKLIGHT_OFF NO_BACKLIGHT_ON
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
#include "UnityLightingCommon.cginc"
|
||||
|
||||
|
||||
|
||||
uniform sampler2D _NormalMap;
|
||||
|
||||
uniform float4 _NormalMap_ST;
|
||||
|
||||
|
||||
|
||||
uniform float4 _BaseColor;
|
||||
|
||||
uniform float _Dimmer;
|
||||
|
||||
uniform float _LoadingDimmer;
|
||||
|
||||
uniform float _Alpha;
|
||||
|
||||
|
||||
|
||||
uniform float _RimIntensity;
|
||||
|
||||
uniform float _DiffuseIntensity;
|
||||
|
||||
uniform float _BacklightIntensity;
|
||||
|
||||
|
||||
|
||||
uniform float _Voice;
|
||||
|
||||
uniform float4 _MouthPosition;
|
||||
|
||||
uniform float4 _MouthDirection;
|
||||
|
||||
uniform float _MouthEffectDistance;
|
||||
|
||||
uniform float _MouthEffectScale;
|
||||
|
||||
|
||||
|
||||
static const fixed MOUTH_ZSCALE = 0.5f;
|
||||
|
||||
static const fixed MOUTH_DROPOFF = 0.01f;
|
||||
|
||||
|
||||
|
||||
struct appdata
|
||||
|
||||
{
|
||||
|
||||
float4 vertex: POSITION;
|
||||
|
||||
float3 normal: NORMAL;
|
||||
|
||||
float4 tangent: TANGENT;
|
||||
|
||||
float4 uv: TEXCOORD0;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct v2f
|
||||
|
||||
{
|
||||
|
||||
float4 pos : SV_POSITION;
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 822f5e641dc5dd54ca9555b727b3277f
|
||||
timeCreated: 1526311739
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,204 +0,0 @@
|
||||
// *** OvrAvatar Mobile Single Component shader ***
|
||||
//
|
||||
// This is a Unity vertex-fragnment shader implementation for our 1.5 skin shaded avatar look.
|
||||
// The benefit of using this version is performance as it bypasses the PBR lighting model and
|
||||
// so is generally recommended for use on mobile.
|
||||
//
|
||||
// Shader keywords:
|
||||
// - SECONDARY_LIGHT_ON SECONDARY_LIGHT_OFF
|
||||
// Enable SECONDARY_LIGHT_ON for a second "light" as expressed by _SecondaryLightDirection
|
||||
// and _SecondaryLightColor to influence the standard rim effect. This is designed for use in video watching
|
||||
// experiences to sample the screen color and apply this to the rim term.
|
||||
// - NO_BACKLIGHT_ON NO_BACKLIGHT_OFF
|
||||
// This effect is active by default: NO_BACKLIGHT_OFF is the default and enables the effect. Enable NO_BACKLIGHT_ON
|
||||
// to disable illumination from the rear of the main light direction. This mobile shader supports one directional
|
||||
// light. This can cause the un-illuminated side of the avatar to lose definition.
|
||||
// Notes:
|
||||
// - The primary light in your scene will be used to calculate lighting.
|
||||
// - We don't have a mouth bone, but the vertex shader will animate the vertices around the mouth
|
||||
// area according to the _Voice value. This should be set according to local microphone value
|
||||
// range between 0-1.
|
||||
|
||||
Shader "OvrAvatar/Avatar_Mobile_SingleComponent"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex("Main Texture", 2D) = "white" {}
|
||||
_NormalMap("Normal Map", 2D) = "bump" {}
|
||||
_RoughnessMap("Roughness Map", 2D) = "black" {}
|
||||
|
||||
_BaseColor("Color Tint", Color) = (1.0,1.0,1.0,1.0)
|
||||
_Dimmer("Dimmer", Range(0.0,1.0)) = 1.0
|
||||
_Alpha("Alpha", Range(0.0,1.0)) = 1.0
|
||||
|
||||
_DiffuseIntensity("Diffuse Intensity", Range(0.0,1.0)) = 0.3
|
||||
_RimIntensity("Rim Intensity", Range(0.0,10.0)) = 5.0
|
||||
_BacklightIntensity("Backlight Intensity", Range(0.0,1.0)) = 1.0
|
||||
_ReflectionIntensity("Reflection Intensity", Range(0.0,1.0)) = 0.0
|
||||
|
||||
_Voice("Voice", Range(0.0,1.0)) = 0.0
|
||||
[HideInInspector] _MouthPosition("Mouth position", Vector) = (0,0,0,1)
|
||||
[HideInInspector] _MouthDirection("Mouth direction", Vector) = (0,0,0,1)
|
||||
[HideInInspector] _MouthEffectDistance("Mouth Effect Distance", Float) = 0.03
|
||||
[HideInInspector] _MouthEffectScale("Mouth Effect Scaler", Float) = 1
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Pass
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"LightMode" = "ForwardBase" "Queue" = "Transparent" "RenderType" = "Transparent" "IgnoreProjector" = "True"
|
||||
}
|
||||
LOD 100
|
||||
ZWrite On
|
||||
ZTest LEqual
|
||||
Cull Back
|
||||
ColorMask RGB
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
#pragma target 3.5
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
#pragma multi_compile SECONDARY_LIGHT_OFF SECONDARY_LIGHT_ON
|
||||
#pragma multi_compile NO_BACKLIGHT_OFF NO_BACKLIGHT_ON
|
||||
#include "UnityCG.cginc"
|
||||
#include "UnityLightingCommon.cginc"
|
||||
|
||||
uniform sampler2D _MainTex;
|
||||
uniform sampler2D _NormalMap;
|
||||
uniform float4 _NormalMap_ST;
|
||||
uniform sampler2D _RoughnessMap;
|
||||
uniform float4 _BaseColor;
|
||||
uniform float _DiffuseIntensity;
|
||||
uniform float _RimIntensity;
|
||||
uniform float _BacklightIntensity;
|
||||
uniform float _ReflectionIntensity;
|
||||
|
||||
uniform float3 _SecondaryLightDirection;
|
||||
uniform float4 _SecondaryLightColor;
|
||||
|
||||
uniform float _Dimmer;
|
||||
uniform float _Alpha;
|
||||
|
||||
uniform float _Voice;
|
||||
uniform float4 _MouthPosition;
|
||||
uniform float4 _MouthDirection;
|
||||
uniform float _MouthEffectDistance;
|
||||
uniform float _MouthEffectScale;
|
||||
|
||||
static const fixed MOUTH_ZSCALE = 0.5f;
|
||||
static const fixed MOUTH_DROPOFF = 0.01f;
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex: POSITION;
|
||||
float3 normal: NORMAL;
|
||||
float4 tangent: TANGENT;
|
||||
float4 uv: TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 posWorld: TEXCOORD1;
|
||||
float3 normalDir: TEXCOORD2;
|
||||
float3 tangentDir: TEXCOORD3;
|
||||
float3 bitangentDir: TEXCOORD4;
|
||||
};
|
||||
|
||||
v2f vert(appdata v)
|
||||
{
|
||||
v2f o;
|
||||
|
||||
// Mouth vertex animation with voip
|
||||
float4 worldVert = mul(unity_ObjectToWorld, v.vertex);;
|
||||
float3 delta = _MouthPosition - worldVert;
|
||||
delta.z *= MOUTH_ZSCALE;
|
||||
float dist = length(delta);
|
||||
float scaledMouthDropoff = _MouthEffectScale * MOUTH_DROPOFF;
|
||||
float scaledMouthEffect = _MouthEffectScale * _MouthEffectDistance;
|
||||
float displacement = _Voice * smoothstep(scaledMouthEffect + scaledMouthDropoff, scaledMouthEffect, dist);
|
||||
worldVert.xyz -= _MouthDirection * displacement;
|
||||
v.vertex = mul(unity_WorldToObject, worldVert);
|
||||
|
||||
// Calculate tangents for normal mapping
|
||||
o.normalDir = normalize(UnityObjectToWorldNormal(v.normal));
|
||||
o.tangentDir = normalize(mul(unity_ObjectToWorld, half4(v.tangent.xyz, 0.0)).xyz);
|
||||
o.bitangentDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w);
|
||||
|
||||
o.posWorld = worldVert;
|
||||
o.pos = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag(v2f i) : COLOR
|
||||
{
|
||||
// Light directions
|
||||
float3 lightDirection = _WorldSpaceLightPos0.xyz;
|
||||
|
||||
// Calculate normal
|
||||
float3 normalMap = tex2D(_NormalMap, TRANSFORM_TEX(i.uv, _NormalMap)) * 2 - 1;
|
||||
float3x3 tangentTransform = float3x3(i.tangentDir, i.bitangentDir, i.normalDir);
|
||||
float3 normalDirection = normalize(mul(normalMap.rgb, tangentTransform));
|
||||
float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
|
||||
|
||||
// Apply view, normal, and lighting dependent terms
|
||||
float VdotN = saturate(dot(viewDirection, normalDirection));
|
||||
float NdotL = saturate(dot(normalDirection, lightDirection));
|
||||
float LightColorNdotL = NdotL * _LightColor0;
|
||||
|
||||
// Sample the default reflection cubemap using the reflection vector
|
||||
float3 worldReflection = reflect(-viewDirection, normalDirection);
|
||||
half4 skyData = UNITY_SAMPLE_TEXCUBE(unity_SpecCube0, worldReflection);
|
||||
// Decode cubemap data into actual color
|
||||
half3 reflectionColor = DecodeHDR(skyData, unity_SpecCube0_HDR);
|
||||
|
||||
// Calculate color
|
||||
float4 col;
|
||||
// Diffuse texture sample
|
||||
col = tex2D(_MainTex, i.uv);
|
||||
#if !defined(UNITY_COLORSPACE_GAMMA)
|
||||
_BaseColor.rgb = LinearToGammaSpace(_BaseColor.rgb);
|
||||
#endif
|
||||
// Multiply in color tint
|
||||
col.rgb *= _BaseColor;
|
||||
// Main light
|
||||
col.rgb += _DiffuseIntensity * LightColorNdotL;
|
||||
#ifdef NO_BACKLIGHT_ON
|
||||
//NO_BACKLIGHT_ON disables the rear illumination
|
||||
#else
|
||||
// Illuminate main light from behind of NO_BACKLIGHT_ON is disabled
|
||||
float3 reverseLightDirection = lightDirection * -1;
|
||||
float NdotInvL = saturate(dot(normalDirection, normalize(reverseLightDirection)));
|
||||
col.rgb += (_DiffuseIntensity * _BacklightIntensity) * NdotInvL *_LightColor0;
|
||||
#endif
|
||||
// Rim term
|
||||
#ifdef SECONDARY_LIGHT_ON
|
||||
// Secondary light proxy (direction and color) passed into the rim term
|
||||
NdotL = saturate(dot(normalDirection, _SecondaryLightDirection));
|
||||
col.rgb += pow(1.0 - VdotN, _RimIntensity) * NdotL * _SecondaryLightColor;
|
||||
#else
|
||||
col.rgb += pow(1.0 - VdotN, _RimIntensity) * LightColorNdotL;
|
||||
#endif
|
||||
// Reflection
|
||||
col.rgb += reflectionColor * tex2D(_RoughnessMap, i.uv).a * _ReflectionIntensity;
|
||||
|
||||
// Global dimmer
|
||||
col.rgb *= _Dimmer;
|
||||
// Global alpha
|
||||
col.a *= _Alpha;
|
||||
#if !defined(UNITY_COLORSPACE_GAMMA)
|
||||
col.rgb = GammaToLinearSpace(col.rgb);
|
||||
#endif
|
||||
// Return clamped final color
|
||||
return saturate(col);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c26fc51e445dcfd4db09305d861dc11c
|
||||
timeCreated: 1526311739
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,108 +0,0 @@
|
||||
//
|
||||
// OvrAvatar PC single component shader
|
||||
//
|
||||
// This is a Unity Surface shader implementation for our 1.5 skin shaded avatar look.
|
||||
// The benefit of using this version is that it uses the full Unity PBR lighting under the hood.
|
||||
// The Mobile shader is strongly recommended for use on mobile platforms for performance.
|
||||
//
|
||||
// Notes:
|
||||
// - Use Mobile shader if you need mouth vertex movement.
|
||||
|
||||
Shader "OvrAvatar/Avatar_PC_SingleComponent"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
[NoScaleOffset] _MainTex("Color (RGB)", 2D) = "white" {}
|
||||
[NoScaleOffset] _NormalMap("Normal Map", 2D) = "bump" {}
|
||||
[NoScaleOffset] _RoughnessMap("Roughness Map", 2D) = "black" {}
|
||||
|
||||
_BaseColor("Color Tint", Color) = (0.95,0.77,0.63)
|
||||
_Dimmer("Dimmer", Range(0.0,1.0)) = 1.0
|
||||
_Alpha("Alpha", Range(0.0,1.0)) = 1.0
|
||||
|
||||
_DiffuseIntensity("Diffuse Intensity", Range(0.0,1.0)) = 0.3
|
||||
_RimIntensity("Rim Intensity", Range(0.0,10.0)) = 5.0
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" }
|
||||
LOD 100
|
||||
Blend SrcAlpha OneMinusSrcAlpha
|
||||
|
||||
// Render the back facing parts of the object then set on backface culling.
|
||||
// This fixes broken faces with convex meshes when using the alpha path.
|
||||
Pass
|
||||
{
|
||||
Color(0,0,0,0)
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
#pragma surface surf Standard alpha:fade
|
||||
#pragma target 3.0
|
||||
#pragma fragmentoption ARB_precision_hint_fastest
|
||||
// Set this shader keyword if you are using Linear color space
|
||||
#pragma multi_compile COLORSPACE_LINEAR_OFF COLORSPACE_LINEAR_ON
|
||||
// (Optional) Set this shader keyword if your scene only has one light
|
||||
#pragma multi_compile SINGLE_LIGHT_OFF SINGLE_LIGHT_ON
|
||||
#include "UnityCG.cginc"
|
||||
sampler2D _MainTex;
|
||||
sampler2D _NormalMap;
|
||||
sampler2D _RoughnessMap;
|
||||
|
||||
float4 _BaseColor;
|
||||
float _Dimmer;
|
||||
float _Alpha;
|
||||
|
||||
float _DiffuseIntensity;
|
||||
float _RimIntensity;
|
||||
|
||||
struct Input
|
||||
{
|
||||
float2 uv_MainTex;
|
||||
float2 uv_NormalMap;
|
||||
float2 uv_RoughnessMap;
|
||||
float3 viewDir;
|
||||
float3 worldNormal; INTERNAL_DATA
|
||||
};
|
||||
|
||||
void surf(Input IN, inout SurfaceOutputStandard o)
|
||||
{
|
||||
// Unpack normal map
|
||||
o.Normal = tex2D(_NormalMap, IN.uv_NormalMap) * 2 - 1;
|
||||
|
||||
// Diffuse texture sample
|
||||
float4 col = tex2D(_MainTex, IN.uv_MainTex);
|
||||
|
||||
// Convert _BaseColor to gamma color space if we are in linear
|
||||
// Albedo texture is already in correct color space
|
||||
#if !defined(UNITY_COLORSPACE_GAMMA)
|
||||
_BaseColor.rgb = LinearToGammaSpace(_BaseColor.rgb);
|
||||
#endif
|
||||
// Adjust color tint with NdotL
|
||||
float NdotL = saturate(dot(WorldNormalVector(IN, o.Normal), _WorldSpaceLightPos0.xyz));
|
||||
_BaseColor.rgb += _DiffuseIntensity * NdotL;
|
||||
// Multiply in color tint
|
||||
o.Albedo = col.rgb * _BaseColor;
|
||||
// Rim term
|
||||
float VdotN = saturate(dot(normalize(IN.viewDir), o.Normal));
|
||||
o.Albedo += pow(1.0 - VdotN, _RimIntensity) * NdotL * _LightColor0;
|
||||
|
||||
// Sample roughness map and set smoothness and metallic
|
||||
float4 roughnessSample = tex2D(_RoughnessMap, IN.uv_RoughnessMap);
|
||||
o.Smoothness = roughnessSample.a;
|
||||
o.Metallic = roughnessSample.r;
|
||||
|
||||
// Global dimmer
|
||||
o.Albedo *= _Dimmer;
|
||||
// Global alpha
|
||||
o.Alpha = col.a * _Alpha;
|
||||
|
||||
|
||||
// Convert back to linear color space if we are in linear
|
||||
#if !defined(UNITY_COLORSPACE_GAMMA)
|
||||
o.Albedo = GammaToLinearSpace(o.Albedo);
|
||||
#endif
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 36b8b481cf607814a8cec318f0148d63
|
||||
timeCreated: 1525971189
|
||||
licenseType: Store
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user