12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- Shader "Hidden/Shadow2DShadowSprite"
- {
- Properties
- {
- _MainTex ("Texture", 2D) = "white" {}
- _Color("Tint", Color) = (1,1,1,1)
- [HideInInspector] _ShadowColorMask("__ShadowColorMask", Int) = 1
- }
- SubShader
- {
- Tags { "RenderType"="Opaque" }
-
- Cull Off
- BlendOp Add
- Blend One One
- ZWrite Off
- ZTest Always
-
- // Process the shadow
- Pass
- {
- Name "Draw Sprite Shadow (R)"
-
- ColorMask R
-
- HLSLPROGRAM
- #pragma vertex vert
- #pragma fragment frag
-
- #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
-
- struct Attributes
- {
- float4 vertex : POSITION;
- float2 uv : TEXCOORD0;
- float4 color : COLOR;
- };
-
- struct Varyings
- {
- float4 vertex : SV_POSITION;
- float2 uv : TEXCOORD0;
- float4 color : COLOR;
- };
-
- sampler2D _MainTex;
- float4 _MainTex_ST;
- float4 _Color;
-
- Varyings vert (Attributes v)
- {
- Varyings o;
- o.vertex = TransformObjectToHClip(v.vertex.xyz);
- o.uv = TRANSFORM_TEX(v.uv, _MainTex);
- o.color = _Color.a * v.color;
- return o;
- }
-
- half4 frag(Varyings i) : SV_Target
- {
- half4 main = i.color * tex2D(_MainTex, i.uv);
- return half4(main.a, main.a, main.a, main.a);
- }
- ENDHLSL
- }
- }
- }
|