- Home /
Shader Sprite/diffuse add shadow on spotlight
Hello, i use sprites/diffuse shader without sprite renderer.
But i can't achieve shadow under spotlight.
There is the built-in shader:
Shader "Me/Sprites/Diffuse"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
}
SubShader
{
Tags
{
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
"PreviewType"="Plane"
"CanUseSpriteAtlas"="True"
}
LOD 200
//Cull Off
//Lighting On
//ZWrite Off
//Fog { Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma surface surf Lambert addshadow alpha vertex:vert
#pragma multi_compile DUMMY PIXELSNAP_ON
#pragma multi_compile_fwdadd_fullshadows
#include "UnityCG.cginc"
#include "AutoLight.cginc"
sampler2D _MainTex;
fixed4 _Color;
struct Input
{//
float2 uv_MainTex;
fixed4 color;
};
void vert (inout appdata_full v, out Input o)
{
#if defined(PIXELSNAP_ON) && !defined(SHADER_API_FLASH)
v.vertex = UnityPixelSnap (v.vertex);
#endif
v.normal = float3(0,0,-1);
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.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Transparent/Diffuse"
}
I need help. Thank you.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613123202im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Sprite Shading 1 Answer
Prevent 2D mask to impact other gameobjects ? 3 Answers
Finding the centre of two touches 2 Answers
Should sprites in the same layer but different order incur additional draw calls? 0 Answers
How to make not smooth animation? 0 Answers