UnityGame/Library/PackageCache/com.unity.render-pipelines.universal/Shaders/2D/Shadow2D-Shadow-Sprite.shader
2024-10-27 10:53:47 +03:00

68 lines
1.7 KiB
Plaintext

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
}
}
}