86 lines
1.7 KiB
Plaintext
86 lines
1.7 KiB
Plaintext
|
Shader "Zhanyou/SkillWarningRectBlend"
|
||
|
{
|
||
|
Properties
|
||
|
{
|
||
|
_TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5)
|
||
|
_MainTex ("Particle Texture", 2D) = "white" {}
|
||
|
_Width ("Width", Float) = 1
|
||
|
_Height ("Height", Float) = 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 _Width;
|
||
|
uniform half _Height;
|
||
|
|
||
|
fixed4 frag(v2f i) : SV_Target
|
||
|
{
|
||
|
float2 uv = i.uv;
|
||
|
uv.x = clamp(abs(uv.x - 0.5) * _Width - (_Width - 1) * 0.5, 0, 0.5);
|
||
|
uv.x = 0.5 + uv.x;
|
||
|
uv.y = clamp(abs(uv.y - 0.5) * _Height - (_Height - 1) * 0.5, 0, 0.5);
|
||
|
uv.y = 0.5 + uv.y;
|
||
|
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
|
||
|
}
|
||
|
}
|
||
|
}
|