My custom shader doesn't receive shadows. I don't really know a lot regarding this code, I found a masking example and modified it to support more than 2 textures. Does anyone know where I have gone wrong? Code (CSharp): Shader "MaskedTexture" { Properties { _MainTex ("Main Texture", 2D) = "white" {} _cliffMask ("Cliff Mask", 2D) = "white" {} _cliff ("Cliff Texture", 2D) = "white" {} _sandMask ("Sand Mask", 2D) = "white" {} _sand ("Sand Texture", 2D) = "white" {} _otherMask ("Other Mask", 2D) = "white" {} _other ("Other Texture", 2D) = "white" {} _Cutoff ("Alpha cutoff", Range (0,1)) = 0.1 } SubShader { Tags {"Queue"="Geometry" "RenderType"="Opaque" } Lighting Off ZWrite On AlphaTest GEqual [_Cutoff] Pass { SetTexture [_MainTex] {combine texture} } Pass { Blend SrcAlpha OneMinusSrcAlpha SetTexture [_cliff] {combine texture, previous} SetTexture [_cliffMask] {combine previous, texture} } Pass { Blend SrcAlpha OneMinusSrcAlpha SetTexture [_sand] {combine texture, previous} SetTexture [_sandMask] {combine previous, texture} } Pass { Blend SrcAlpha OneMinusSrcAlpha SetTexture [_other] {combine texture, previous} SetTexture [_otherMask] {combine previous, texture} } } }
After line 15 add somewhere this line: Code (csharp): Fallback "Diffuse" ..without the "1." The standard shader should then get picked up for the ShadowCaster and ShadowCollector passes that are required for shadows but missing in your shader. That'll be fine for all shaders that don't modify vertices; yours doesn't seem to.
I added that line to the end of the sub shader (line 43) and I got a syntax error on that line. I have tried to use the fallback outside of the sub shader (line 44) but didn't get any shadows (no errors though).