| 1 | /* |
| 2 | Code for transparent object in front of the overlay |
| 3 | The keepalpha option is important to let unity maintain the alpha we return from the shader |
| 4 | */ |
| 5 | |
| 6 | Shader "Oculus/Underlay Transparent Occluder" { |
| 7 | Properties{ |
| 8 | _Color("Main Color", Color) = (1,1,1,1) |
| 9 | _MainTex("Base (RGB) Trans (A)", 2D) = "white" {} |
| 10 | } |
| 11 | SubShader{ |
| 12 | Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } |
| 13 | Blend SrcAlpha OneMinusSrcAlpha |
| 14 | |
| 15 | // extra pass that renders to depth buffer only |
| 16 | Pass{ |
| 17 | ZWrite On |
| 18 | ColorMask 0 |
| 19 | } |
| 20 | |
| 21 | CGPROGRAM |
| 22 | #pragma surface surf Lambert keepalpha |
| 23 | fixed4 _Color; |
| 24 | struct Input { |
| 25 | float4 color : COLOR; |
| 26 | }; |
| 27 | void surf(Input IN, inout SurfaceOutput o) { |
| 28 | o.Albedo = _Color.rgb; |
| 29 | o.Alpha = _Color.a; |
| 30 | } |
| 31 | ENDCG |
| 32 | } |
| 33 | |
| 34 | |
| 35 | Fallback "Transparent/VertexLit" |
| 36 | } |