diff options
author | chai <chaifix@163.com> | 2021-04-07 21:33:14 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-04-07 21:33:14 +0800 |
commit | c47b92e92cf33ae8bf2f38929e137294397e4735 (patch) | |
tree | c67ae3419eaf15e84f1679186e107f598de33978 /Assets/Resources/UIShiny.shader |
Diffstat (limited to 'Assets/Resources/UIShiny.shader')
-rw-r--r-- | Assets/Resources/UIShiny.shader | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/Assets/Resources/UIShiny.shader b/Assets/Resources/UIShiny.shader new file mode 100644 index 0000000..5520e43 --- /dev/null +++ b/Assets/Resources/UIShiny.shader @@ -0,0 +1,82 @@ +Shader "Hidden/UI/Default (UIShiny)" +{ + Properties + { + [PerRendererData] _MainTex ("Main Texture", 2D) = "white" {} + _Color ("Tint", Color) = (1,1,1,1) + + _StencilComp ("Stencil Comparison", Float) = 8 + _Stencil ("Stencil ID", Float) = 0 + _StencilOp ("Stencil Operation", Float) = 0 + _StencilWriteMask ("Stencil Write Mask", Float) = 255 + _StencilReadMask ("Stencil Read Mask", Float) = 255 + + _ColorMask ("Color Mask", Float) = 15 + + [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0 + + _ParamTex ("Parameter Texture", 2D) = "white" {} + } + + SubShader + { + Tags + { + "Queue"="Transparent" + "IgnoreProjector"="True" + "RenderType"="Transparent" + "PreviewType"="Plane" + "CanUseSpriteAtlas"="True" + } + + Stencil + { + Ref [_Stencil] + Comp [_StencilComp] + Pass [_StencilOp] + ReadMask [_StencilReadMask] + WriteMask [_StencilWriteMask] + } + + Cull Off + Lighting Off + ZWrite Off + ZTest [unity_GUIZTestMode] + Blend SrcAlpha OneMinusSrcAlpha + ColorMask [_ColorMask] + + Pass + { + Name "Default" + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #pragma target 2.0 + + #pragma multi_compile __ UNITY_UI_ALPHACLIP + + #include "UnityCG.cginc" + #include "UnityUI.cginc" + + #define UI_SHINY 1 + #include "UIEffect.cginc" + #include "UIEffectSprite.cginc" + + fixed4 frag(v2f IN) : SV_Target + { + half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color; + color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); + + color = ApplyShinyEffect(color, IN.eParam); + + #ifdef UNITY_UI_ALPHACLIP + clip (color.a - 0.001); + #endif + + return color; + } + ENDCG + } + } +} |