100 lines
2.4 KiB
Plaintext
100 lines
2.4 KiB
Plaintext
Shader "BF/Effect/eff_dissolve_alp_r"
|
|
{
|
|
Properties
|
|
{
|
|
_TintColor ("Tint Color", Color) = (1,1,1,1)
|
|
_MainTex ("Particle Texture", 2D) = "white" {}
|
|
_ColorMaskTex ("Color Mask Texture", 2D) = "white" {}
|
|
[Toggle(_MASK_UV_SPEED_CUSTOM)]_MASK_UV_SPEED_CUSTOM("粒子custom1.zw(uv1.xy)控制mask uv偏移",int) = 0
|
|
[Toggle(_HIDE_Y)] _HIDE_Y("隐藏Y轴坐标0以下的部分", int) = 0
|
|
_Level("Brightness", Float) = 1
|
|
}
|
|
|
|
CGINCLUDE
|
|
#include "UnityCG.cginc"
|
|
|
|
uniform sampler2D _MainTex;
|
|
uniform sampler2D _ColorMaskTex;
|
|
uniform half4 _MainTex_ST;
|
|
uniform half4 _ColorMaskTex_ST;
|
|
half4 _TintColor;
|
|
half _Level;
|
|
|
|
struct appdata {
|
|
float4 vertex : POSITION;
|
|
half4 texcoord : TEXCOORD0;
|
|
#if _MASK_UV_SPEED_CUSTOM
|
|
half4 texcoord1 : TEXCOORD1;
|
|
#endif
|
|
half4 color : COLOR0;
|
|
};
|
|
|
|
struct v2f {
|
|
float4 pos : SV_POSITION;
|
|
half2 uv : TEXCOORD0;
|
|
half2 uv2 : TEXCOORD1;
|
|
fixed4 uv_custom : TEXCOORD2;
|
|
half4 color : COLOR;
|
|
#if _HIDE_Y
|
|
fixed worldPosY : TEXCOORD3;
|
|
#endif
|
|
};
|
|
|
|
v2f vert (appdata v)
|
|
{
|
|
v2f o;
|
|
UNITY_INITIALIZE_OUTPUT(v2f, o);
|
|
o.pos = UnityObjectToClipPos (v.vertex);
|
|
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
|
|
o.uv2 = TRANSFORM_TEX(v.texcoord, _ColorMaskTex);
|
|
o.color = v.color;
|
|
o.uv_custom.xy = v.texcoord.zw;
|
|
#if _MASK_UV_SPEED_CUSTOM
|
|
o.uv_custom.zw = v.texcoord1.xy;
|
|
#endif
|
|
#ifdef _HIDE_Y
|
|
fixed3 worldPos = mul(unity_ObjectToWorld , v.vertex).xyz;
|
|
o.worldPosY = worldPos.y;
|
|
#endif
|
|
return o;
|
|
}
|
|
|
|
half4 frag (v2f i) : COLOR
|
|
{
|
|
half4 clr = tex2D( _MainTex, i.uv + i.uv_custom.xy);
|
|
#if _MASK_UV_SPEED_CUSTOM
|
|
half4 alpha = tex2D( _ColorMaskTex, i.uv2 + i.uv_custom.zw);
|
|
#else
|
|
half4 alpha = tex2D( _ColorMaskTex, i.uv2 );
|
|
#endif
|
|
half4 texcol = half4(1,1,1,1);
|
|
texcol.rgb = clr.rgb * _TintColor.rgb * _Level * i.color.rgb;
|
|
texcol.a = clr.a;
|
|
#ifdef _HIDE_Y
|
|
texcol *= step(0, i.worldPosY);
|
|
#endif
|
|
clip(texcol.a * alpha.r * i.color.a * _TintColor.a - 0.1f);
|
|
return texcol;
|
|
}
|
|
|
|
ENDCG
|
|
|
|
SubShader
|
|
{
|
|
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
|
|
cull Off
|
|
|
|
Pass
|
|
{
|
|
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma shader_feature_local _MASK_UV_SPEED_CUSTOM
|
|
#pragma shader_feature_local _HIDE_Y
|
|
|
|
ENDCG
|
|
}
|
|
}
|
|
Fallback Off
|
|
} |