I made this shader to overlay a color when my player’s mesh is hidden by other geometry in the scene:
SubShader
{
Tags { "Queue"="Overlay+1" }
Pass
{
ZWrite Off
ZTest Greater
Lighting Off
Cull off
Color [_ColorInvisible]
}
Pass
{
ZTest Less
Material {
Diffuse [_Color]
Ambient (0,0,0,0)
}
Lighting On
SeparateSpecular On
SetTexture [_MainTex] {combine texture * primary DOUBLE, texture * primary}
}
}
The shader is working great but I’m unable to make it work only with specific layers:
I would like to make the overlay only when my player (wich has the above shader applied) is behind objects on a specific layer (i.e Wall layer).
How can i achieve this?
Thanks in advance.