I’m working with the planar shadow,the shadow pass as below:
pass {
Tags { “LightMode” = “ForwardBase”}
Blend SrcAlpha OneMinusSrcAlpha
Stencil {
Ref 1
Comp NotEqual
Pass replace
}
//ZTest Less
Cull Back
Offset -1,-1
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include “UnityCG.cginc”
float4 vert(float4 vertex: POSITION) : SV_POSITION
{
float3 litDir = float3(-0.1,-0.2,0.2);
float4 vt = mul(_Object2World, vertex);
vt.xz=vt.xz-(vt.y/litDir.y)*litDir.xz;
vt.y=0;
vt=mul(_World2Object,vt);
return mul(UNITY_MATRIX_MVP, vt);
}
float4 frag(void) : COLOR
{
return float4(0.1,0.1,0.1,0.6);
}
ENDCG
}//
}
but when I set the object scale is (-1, 1, 1), the stencil test not working and will overdraw the shadow as the picture
