NewSurfaceShader.shader 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "UI/Default_OverlayNoZTest"
  3. {
  4. Properties
  5. {
  6. [PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
  7. _Color("Tint", Color) = (1,1,1,1)
  8. _StencilComp("Stencil Comparison", Float) = 8
  9. _Stencil("Stencil ID", Float) = 0
  10. _StencilOp("Stencil Operation", Float) = 0
  11. _StencilWriteMask("Stencil Write Mask", Float) = 255
  12. _StencilReadMask("Stencil Read Mask", Float) = 255
  13. _ColorMask("Color Mask", Float) = 15
  14. }
  15. SubShader
  16. {
  17. Tags
  18. {
  19. "Queue" = "Overlay"
  20. "IgnoreProjector" = "True"
  21. "RenderType" = "Transparent"
  22. "PreviewType" = "Plane"
  23. "CanUseSpriteAtlas" = "True"
  24. }
  25. Stencil
  26. {
  27. Ref[_Stencil]
  28. Comp[_StencilComp]
  29. Pass[_StencilOp]
  30. ReadMask[_StencilReadMask]
  31. WriteMask[_StencilWriteMask]
  32. }
  33. Cull Off
  34. Lighting Off
  35. ZWrite Off
  36. ZTest Off
  37. Blend SrcAlpha OneMinusSrcAlpha
  38. ColorMask[_ColorMask]
  39. Pass
  40. {
  41. CGPROGRAM
  42. #pragma vertex vert
  43. #pragma fragment frag
  44. #include "UnityCG.cginc"
  45. struct appdata_t
  46. {
  47. float4 vertex : POSITION;
  48. float4 color : COLOR;
  49. float2 texcoord : TEXCOORD0;
  50. };
  51. struct v2f
  52. {
  53. float4 vertex : SV_POSITION;
  54. fixed4 color : COLOR;
  55. half2 texcoord : TEXCOORD0;
  56. };
  57. fixed4 _Color;
  58. v2f vert(appdata_t IN)
  59. {
  60. v2f OUT;
  61. OUT.vertex = UnityObjectToClipPos(IN.vertex);
  62. OUT.texcoord = IN.texcoord;
  63. #ifdef UNITY_HALF_TEXEL_OFFSET
  64. OUT.vertex.xy += (_ScreenParams.zw - 1.0) * float2(-1,1);
  65. #endif
  66. OUT.color = IN.color * _Color;
  67. return OUT;
  68. }
  69. sampler2D _MainTex;
  70. fixed4 frag(v2f IN) : SV_Target
  71. {
  72. half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
  73. clip(color.a - 0.01);
  74. return color;
  75. }
  76. ENDCG
  77. }
  78. }
  79. }