Hi,
I’m working on a game with 3D characters and 2D environments, with depth sorting handled using sorting layer/ID.
I’m trying to have my characters cast shadows from a directional light onto invisible geometry, then draw those shadows on top of my environment sprites.
As shown above, I’m able to get shadows to display on an invisible plane, but my sprites are being drawn over them. I suspect I need to change the queue from “AlphaTest” to “Transparent” in the shader below, but when I do, shadows aren’t displayed at all.
Would anyone be able to point me to how I can get the below working with queue set to transparent?
Shader "Transparent/TransparentReceiveShadow"
{
Properties
{
_Color("Shadow Color", Color) = (1,1,1,1)
_Cutoff("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader
{
Tags
{
"Queue" = "AlphaTest"
"IgnoreProjector" = "True"
"RenderType" = "TransparentCutout"
}
LOD 200
ZWrite off
Blend zero SrcColor
CGPROGRAM
#pragma surface surf ShadowOnly alphatest:_Cutoff fullforwardshadows
fixed4 _Color;
float _ShadowInt;
struct Input
{
float2 uv_MainTex;
};
inline fixed4 LightingShadowOnly(SurfaceOutput s, fixed3 lightDir, fixed atten)
{
fixed4 c;
c.rgb = lerp(s.Albedo, float3(1.0,1.0,1.0), atten);
c.a = 1.0-atten;
return c;
}
void surf(Input IN, inout SurfaceOutput o)
{
o.Albedo = _Color.rgb;
o.Alpha = 1.0;
}
ENDCG
}
Fallback "Transparent/Cutout/VertexLit"
}


