ZED_Default_OverlayNoZTest.shader 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. //======= Copyright (c) Stereolabs Corporation, All rights reserved. ===============
  2. //UI to set in front of everything
  3. Shader "ZED/ZED Default OverlayNoZTest"
  4. {
  5. Properties
  6. {
  7. [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
  8. _Color ("Tint", Color) = (1,1,1,1)
  9. _StencilComp ("Stencil Comparison", Float) = 8
  10. _Stencil ("Stencil ID", Float) = 0
  11. _StencilOp ("Stencil Operation", Float) = 0
  12. _StencilWriteMask ("Stencil Write Mask", Float) = 255
  13. _StencilReadMask ("Stencil Read Mask", Float) = 255
  14. _ColorMask ("Color Mask", Float) = 15
  15. }
  16. SubShader
  17. {
  18. Tags
  19. {
  20. "Queue"="Overlay"
  21. "IgnoreProjector"="True"
  22. "RenderType"="Transparent"
  23. "PreviewType"="Plane"
  24. "CanUseSpriteAtlas"="True"
  25. }
  26. Stencil
  27. {
  28. Ref [_Stencil]
  29. Comp [_StencilComp]
  30. Pass [_StencilOp]
  31. ReadMask [_StencilReadMask]
  32. WriteMask [_StencilWriteMask]
  33. }
  34. Cull Off
  35. Lighting Off
  36. ZWrite Off
  37. ZTest Off
  38. Blend SrcAlpha OneMinusSrcAlpha
  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. fixed4 _TextureSampleAdd; //Added for font color support
  60. v2f vert(appdata_t IN)
  61. {
  62. v2f OUT;
  63. OUT.vertex = UnityObjectToClipPos(IN.vertex);
  64. OUT.texcoord = IN.texcoord;
  65. #ifdef UNITY_HALF_TEXEL_OFFSET
  66. OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
  67. #endif
  68. OUT.color = IN.color * _Color;
  69. return OUT;
  70. }
  71. sampler2D _MainTex;
  72. fixed4 frag(v2f IN) : SV_Target
  73. {
  74. half4 color = (tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color; //Added for font color support
  75. clip (color.a - 0.01);
  76. return color;
  77. }
  78. ENDCG
  79. }
  80. }
  81. }