JJBB/Assets/Project/Shader/SkillWarningCircleBlend.shader

84 lines
1.7 KiB
Plaintext
Raw Normal View History

2024-08-23 15:49:34 +08:00
Shader "Zhanyou/SkillCircleBlend" {
Properties
{
_TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
_MainTex ("Particle Texture", 2D) = "white" {}
_Scale ("Scale", Float) = 1
_Size ("Size Ratio", Range(0, 1)) = 1
}
Subshader{
Tags{ "Queue" = "Transparent-2" }
ZWrite Off
Lighting Off
ColorMask RGB
Blend SrcAlpha OneMinusSrcAlpha
CGINCLUDE
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct v2f {
float2 uv : TEXCOORD0;
float4 pos : SV_POSITION;
float4 color : COLOR;
};
struct a2v {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
float4 color : COLOR;
};
v2f vert(a2v v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f, o);
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.texcoord;
o.color = v.color;
return o;
}
uniform sampler2D _MainTex;
uniform float4 _TintColor;
uniform half _Size;
uniform half _Scale;
fixed4 frag(v2f i) : SV_Target
{
float dist = distance(i.uv, float2(0.5, 0.5)) * _Scale;
dist = max(0, dist + (1 - _Scale * _Size) * 0.5);
dist = 0.5 + dist;
float2 uv = float2(dist, 0.5);
fixed4 res = tex2D(_MainTex, uv);
res *= _TintColor * i.color;
res = min(res, fixed4(1, 1, 1, 1));
return res;
}
ENDCG
Pass
{
Stencil
{
Ref 1
Comp Equal
}
CGPROGRAM
ENDCG
}
Pass
{
Stencil
{
Ref 1
Comp NotEqual
}
ZTest Always
CGPROGRAM
ENDCG
}
}
}