- Home /
Mask shader with shadows
I have a simple mask shader:
Shader "MaskedTexture"
{
Properties
{
_Color ("Main Color", Color) = (1,1,1)
_MainTex ("Main Texture (RGB)", 2D) = ""
_PathTex ("Path Texture (RGB)", 2D) = ""
_PathMask ("Path Mask (A)", 2D) = ""
}
SubShader
{
Lighting On
Material
{
Ambient [_Color]
Diffuse [_Color]
}
Pass
{
SetTexture [_MainTex]
SetTexture [_PathMask]
{
combine previous, texture
}
SetTexture [_PathTex]
{
combine texture lerp(previous) previous
}
SetTexture [_MainTex]
{
combine previous * primary
}
}
}
SubShader
{
Lighting On
Material
{
Ambient [_Color]
Diffuse [_Color]
}
Pass
{
SetTexture [_MainTex]
{
combine texture * primary
}
}
Pass
{
Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_PathTex]
{
combine texture * primary
}
SetTexture [_PathMask]
{
combine previous, texture
}
}
}
Fallback "Diffuse"
}
However, I am unable to get it to recieve shadows. I know very little of coding shaders so not sure how to go about this.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613155901im_/https://answers.unity.com/themes/thub/images/avi.jpg)