If i write a shader code for a sprite as below, the edges of the shadow appear as dots. Setting the Shadow option of Directional Light and QualitySettings does not show any change. I think there is a problem with the shader code, what should I do? To briefly describe the code below, i put shadows in the sprite, turn off lighting to prevent lighting from affecting the color, and display the color with Emission.
Shader "Custom/Sprites/Shadow"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Color", Color) = (1,1,1,1)
_Cutoff ("Shadow alpha cutoff", Range(0, 1)) = 0.5
}
SubShader
{
Tags
{
"Queue" = "Transparent"
"RenderType" = "Transparent"
"IgnoreProjector" = "True"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}
Cull Off
Lighting Off
ZWrite Off
Blend One OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma surface surf Lambert alpha addshadow
sampler2D _MainTex;
fixed4 _Color;
struct Input
{
float2 uv_MainTex;
fixed4 color;
};
void vert (inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input, o);
o.color = _Color;
}
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * IN.color;
o.Emission = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Transparent/Cutout/VertexLit"
}