1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- Shader "Hidden/UI Default (Soft Masked)"
- {
- // This is a shader that replaces the Unity's Default UI shader. It has all capabilities
- // of the Default UI and also supports Soft Mask. It is a bit complicated because it
- // reflects changes of the Default UI shader between Unity versions. If you're searching
- // for an example of how to add Soft Mask support, you may check CustomWithSoftMask.shader
- // that's included in the package.
- Properties
- {
- [PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
- _Color("Tint", Color) = (1,1,1,1)
- [PerRendererData] _SoftMask("Mask", 2D) = "white" {}
- _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
- }
- 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
- #if UNITY_VERSION >= 201720
- #pragma multi_compile __ UNITY_UI_CLIP_RECT
- #endif
- #pragma multi_compile __ UNITY_UI_ALPHACLIP
- #pragma multi_compile __ SOFTMASK_SIMPLE SOFTMASK_SLICED SOFTMASK_TILED
- #include "SoftMaskTemplate.cginc"
- ENDCG
- }
- }
- }
- // UNITY_SHADER_NO_UPGRADE
|