75 lines
1.8 KiB
Plaintext
75 lines
1.8 KiB
Plaintext
Shader "Hidden/UI Default (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 CustomWithMasking.shader
|
|
// that's included in the package.
|
|
|
|
Properties
|
|
{
|
|
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
|
|
_Color("Tint", Color) = (1,1,1,1)
|
|
|
|
[PerRendererData] _Masking("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 __ Masking_SIMPLE Masking_SLICED Masking_TILED
|
|
|
|
#include "MaskingTemplate.cginc"
|
|
ENDCG
|
|
}
|
|
}
|
|
}
|
|
|
|
// UNITY_SHADER_NO_UPGRADE
|