hi guys, i have a problem with shadows receiving on sprite
well i have some cute shadow-cast shader:
Shader "Sprites/Diffuse/Shadows"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_Color("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap("Pixel snap", Float) = 0
_Cutoff("Shadow alpha cutoff", Range(0,1)) = 0.5
}
SubShader
{
Tags
{
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Cull Off
Lighting Off
ZWrite Off
Blend One OneMinusSrcAlpha
CGPROGRAM
#pragma surface surf Lambert vertex:vert nofog keepalpha addshadow
#pragma multi_compile _ PIXELSNAP_ON
sampler2D _MainTex;
fixed4 _Color;
struct Input
{
float2 uv_MainTex;
fixed4 color;
};
void vert(inout appdata_full v, out Input o)
{
#if defined(PIXELSNAP_ON)
v.vertex = UnityPixelSnap(v.vertex);
#endif
UNITY_INITIALIZE_OUTPUT(Input, o);
o.color = v.color * _Color;
}
fixed _Cutoff;
void surf(Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.color;
o.Albedo = c.rgb;
o.Alpha = c.a;
clip(o.Alpha - _Cutoff);
}
ENDCG
}
Fallback "Transparent/Cutout/VertexLit"
}
this shader allows my sprites to cast some shadows but they cant be received by them.
how can i add the possibility of receiving shadows in this shader?
spriteRenderer.receiveShadows is ON
spriteRenderer.castShadows is ON too.
P.S. yes, i know that meshRenderer could receive any shadow, but i need to attach this possibility to sprites.
please help!)