UIOverlay.shader 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. Shader "Google/Maps/Shaders/UI Overlay" {
  2. Properties {
  3. _MainTex ("Font Texture", 2D) = "white" {}
  4. }
  5. SubShader {
  6. Tags { "RenderType" = "Transparent" "Queue"="Transparent" }
  7. // Z testing configured to make labels draw unconditionally, to appear over other geometry.
  8. ZWrite Off
  9. ZTest Always
  10. CGPROGRAM
  11. #pragma surface surf NoLighting noambient alpha
  12. sampler2D _MainTex;
  13. // _TextureSampleAdd automatically controlled by Unity, primarily for UI.
  14. fixed4 _TextureSampleAdd;
  15. struct Input {
  16. float2 uv_MainTex;
  17. float4 color : COLOR;
  18. };
  19. // Surface shader samples the texture and adds the automatically provided _TextureSampleAdd.
  20. void surf (Input IN, inout SurfaceOutput o) {
  21. fixed4 col = (tex2D(_MainTex, IN.uv_MainTex)+ _TextureSampleAdd) * IN.color;
  22. o.Albedo = col.rgb;
  23. o.Alpha = col.a;
  24. }
  25. // Simple Unlit lighting model copies input colour and alpha directly to output.
  26. // Hooked into the shader by "surf NoLighting" in the #pragma above.
  27. fixed4 LightingNoLighting(SurfaceOutput s, fixed3 lightDir, fixed atten)
  28. {
  29. fixed4 c;
  30. c.rgb = s.Albedo;
  31. c.a = s.Alpha;
  32. return c;
  33. }
  34. ENDCG
  35. }
  36. Fallback "Diffuse"
  37. }