From 6de4a8cf572120799e08e77126bff832e5f5668f Mon Sep 17 00:00:00 2001 From: yum Date: Wed, 25 Jan 2023 22:30:49 -0800 Subject: Update Unity materials * Render at 3k render queue to avoid clashing with avatar meshes * Set reasonable shader defaults * Remove unused material --- Shaders/TaSTT_lighting_template.cginc | 7 ++++--- Shaders/TaSTT_template.shader | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'Shaders') diff --git a/Shaders/TaSTT_lighting_template.cginc b/Shaders/TaSTT_lighting_template.cginc index 1161264..13729bd 100644 --- a/Shaders/TaSTT_lighting_template.cginc +++ b/Shaders/TaSTT_lighting_template.cginc @@ -93,6 +93,9 @@ void getVertexLightColor(inout v2f i) float3 light_vec = light_pos - i.worldPos; float3 light_dir = normalize(light_vec); float ndotl = DotClamped(i.normal, light_dir); + // Light fills an expanding sphere with surface area 4 * pi * r^2. + // By conservation of energy, this means that at distance r, light intensity + // is proportional to 1/(r^2). float attenuation = 1 / (1 + dot(light_vec, light_vec) * unity_4LightAtten0.x); i.vertexLightColor = unity_LightColor[0].rgb * ndotl * attenuation; @@ -366,9 +369,6 @@ fixed4 margin_effect(v2f i) UnityLight GetLight(v2f i) { - // Light fills an expanding sphere with surface area 4 * pi * r^2. - // By conservation of energy, this means that at distance r, light intensity - // is proportional to 1/(r^2). UNITY_LIGHT_ATTENUATION(attenuation, 0, i.worldPos); float3 light_color = _LightColor0.rgb * attenuation; @@ -530,3 +530,4 @@ fixed4 frag (v2f i) : SV_Target } #endif // TASTT_LIGHTING + diff --git a/Shaders/TaSTT_template.shader b/Shaders/TaSTT_template.shader index 44c8a17..f30fc44 100644 --- a/Shaders/TaSTT_template.shader +++ b/Shaders/TaSTT_template.shader @@ -59,9 +59,9 @@ } Pass { Tags { - "RenderType"="Opaque" - "Queue"="AlphaTest+499" - "LightMode" = "ForwardAdd" + "RenderType" = "Opaque" + "LightMode" = "ForwardAdd" + "Queue"="AlphaTest+499" } Blend One One ZWrite Off @@ -79,3 +79,4 @@ } } } + -- cgit v1.2.3