Quantcast
Channel: Questions in topic: "shader"
Viewing all articles
Browse latest Browse all 7500

Shadow-casting issues with two almost identical shaders

$
0
0
![alt text][1] [1]: /storage/temp/49636-shadererror.png I'm having problems with two almost identical shaders not having the same behavior when it comes to casting shadows. As you can see in the image above, the shadow for the props, and tank body is missing on Android, where as the tank tracks are working just fine. The only difference between the shades is the cull setting (Back and Off), otherwise these two shaders are exactly the same. Whats going on here? ### Prop and Tank Body shader ### Shader "Custom/Ramp Lookup" { Properties { _Ramp ("Texture", 2D) = "white" {} } SubShader { Tags { "RenderType" = "Opaque" } Cull Back CGPROGRAM #pragma surface surf Ramp sampler2D _Ramp; half4 LightingRamp (SurfaceOutput s, half3 lightDir, half atten) { half NdotL = dot (s.Normal, lightDir); half diff = NdotL * 0.5 + 0.5; diff = _LightColor0.rgb * diff * (atten * 2); half4 c; c.rgb = tex2D (_Ramp, float2(1-diff, s.Alpha)).rgb; c.a = 1; return c; } struct Input { float2 uv_Ramp; }; void surf (Input IN, inout SurfaceOutput o) { o.Alpha = IN.uv_Ramp.y; } ENDCG } FallBack "Standard" } ### Tank Track shader ### Shader "Custom/Ramp Lookup (No Cull)" { Properties { _Ramp ("Texture", 2D) = "white" {} } SubShader { Tags { "RenderType" = "Opaque" } Cull Off CGPROGRAM #pragma surface surf Ramp sampler2D _Ramp; half4 LightingRamp (SurfaceOutput s, half3 lightDir, half atten) { half NdotL = dot (s.Normal, lightDir); half diff = NdotL * 0.5 + 0.5; diff = _LightColor0.rgb * diff * (atten * 2); half4 c; c.rgb = tex2D (_Ramp, float2(1-diff, s.Alpha)).rgb; c.a = 1; return c; } struct Input { float2 uv_Ramp; }; void surf (Input IN, inout SurfaceOutput o) { o.Alpha = IN.uv_Ramp.y; } ENDCG } FallBack "Standard" }

Viewing all articles
Browse latest Browse all 7500

Latest Images

Trending Articles



Latest Images