UI-Default-No-Alpha.shader 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2. Shader "UI/Default No-Alpha"
  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"="Transparent"
  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 [unity_GUIZTestMode]
  37. Fog { Mode Off }
  38. Blend One Zero
  39. ColorMask [_ColorMask]
  40. Pass
  41. {
  42. CGPROGRAM
  43. #pragma vertex vert
  44. #pragma fragment frag
  45. #include "UnityCG.cginc"
  46. struct appdata_t
  47. {
  48. float4 vertex : POSITION;
  49. float4 color : COLOR;
  50. float2 texcoord : TEXCOORD0;
  51. };
  52. struct v2f
  53. {
  54. float4 vertex : SV_POSITION;
  55. fixed4 color : COLOR;
  56. half2 texcoord : TEXCOORD0;
  57. };
  58. fixed4 _Color;
  59. v2f vert(appdata_t IN)
  60. {
  61. v2f OUT;
  62. OUT.vertex = UnityObjectToClipPos(IN.vertex);
  63. OUT.texcoord = IN.texcoord;
  64. #ifdef UNITY_HALF_TEXEL_OFFSET
  65. OUT.vertex.xy -= (_ScreenParams.zw-1.0);
  66. #endif
  67. OUT.color = IN.color * _Color;
  68. return OUT;
  69. }
  70. sampler2D _MainTex;
  71. fixed4 frag(v2f IN) : SV_Target
  72. {
  73. half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
  74. clip (color.a - 0.01);
  75. return color;
  76. }
  77. ENDCG
  78. }
  79. }
  80. }