|
1 | | -Shader "HoloToolkit/3DTextShader"{ |
2 | | - Properties{ |
3 | | - _MainTex("Font Texture", 2D) = "white" {} |
4 | | - _Color("Text Color", Color) = (1,1,1,1) |
5 | | - } |
6 | | - |
7 | | - SubShader{ |
8 | | - Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" } |
9 | | - Lighting Off Cull Off ZWrite Off Fog{ Mode Off } |
10 | | - Blend SrcAlpha OneMinusSrcAlpha |
11 | | - Pass{ |
12 | | - Color[_Color] |
13 | | - SetTexture[_MainTex]{ |
14 | | - combine primary, texture * primary |
15 | | - } |
16 | | - } |
17 | | - } |
| 1 | +Shader "HoloToolkit/3DTextShader" |
| 2 | +{ |
| 3 | +Properties |
| 4 | + { |
| 5 | + _MainTex ("Alpha (A)", 2D) = "white" {} |
| 6 | + |
| 7 | + [HideInInspector] _Color ("Main Color", Color) = (1,1,1,1) |
| 8 | + [HideInInspector] _StencilComp ("Stencil Comparison", Float) = 8 |
| 9 | + [HideInInspector] _Stencil ("Stencil ID", Float) = 0 |
| 10 | + [HideInInspector] _StencilOp ("Stencil Operation", Float) = 0 |
| 11 | + [HideInInspector] _StencilWriteMask ("Stencil Write Mask", Float) = 255 |
| 12 | + [HideInInspector] _StencilReadMask ("Stencil Read Mask", Float) = 255 |
| 13 | + [HideInInspector] _ColorMask ("Color Mask", Float) = 15 |
| 14 | + } |
| 15 | + |
| 16 | + SubShader |
| 17 | + { |
| 18 | + LOD 200 |
| 19 | + |
| 20 | + Tags |
| 21 | + { |
| 22 | + "Queue" = "Transparent" |
| 23 | + "IgnoreProjector" = "True" |
| 24 | + "RenderType" = "Transparent" |
| 25 | + "PreviewType"="Plane" |
| 26 | + } |
| 27 | + |
| 28 | + Stencil |
| 29 | + { |
| 30 | + Ref [_Stencil] |
| 31 | + Comp [_StencilComp] |
| 32 | + Pass [_StencilOp] |
| 33 | + ReadMask [_StencilReadMask] |
| 34 | + WriteMask [_StencilWriteMask] |
| 35 | + } |
| 36 | + |
| 37 | + Cull Off |
| 38 | + Lighting Off |
| 39 | + ZWrite Off |
| 40 | + ZTest [unity_GUIZTestMode] |
| 41 | + Offset -1, -1 |
| 42 | + Fog { Mode Off } |
| 43 | + Blend SrcAlpha OneMinusSrcAlpha |
| 44 | + ColorMask [_ColorMask] |
| 45 | + |
| 46 | + Pass |
| 47 | + { |
| 48 | + CGPROGRAM |
| 49 | + #pragma vertex vert |
| 50 | + #pragma fragment frag |
| 51 | + #include "UnityCG.cginc" |
| 52 | + |
| 53 | + struct appdata_t |
| 54 | + { |
| 55 | + float4 vertex : POSITION; |
| 56 | + half4 color : COLOR; |
| 57 | + float2 texcoord : TEXCOORD0; |
| 58 | + }; |
| 59 | + |
| 60 | + struct v2f |
| 61 | + { |
| 62 | + float4 vertex : POSITION; |
| 63 | + half4 color : COLOR; |
| 64 | + float2 texcoord : TEXCOORD0; |
| 65 | + }; |
| 66 | + |
| 67 | + sampler2D _MainTex; |
| 68 | + float4 _MainTex_ST; |
| 69 | + fixed4 _Color; |
| 70 | + |
| 71 | + v2f vert (appdata_t v) |
| 72 | + { |
| 73 | + v2f o; |
| 74 | + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); |
| 75 | + o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); |
| 76 | + o.color = v.color; |
| 77 | + #ifdef UNITY_HALF_TEXEL_OFFSET |
| 78 | + o.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1); |
| 79 | + #endif |
| 80 | + return o; |
| 81 | + } |
| 82 | + |
| 83 | + half4 frag (v2f i) : COLOR |
| 84 | + { |
| 85 | + half4 col = i.color; |
| 86 | + col.a *= tex2D(_MainTex, i.texcoord).a; |
| 87 | + col = col * _Color; |
| 88 | + clip (col.a - 0.01); |
| 89 | + return col; |
| 90 | + } |
| 91 | + ENDCG |
| 92 | + } |
| 93 | + } |
18 | 94 | } |
0 commit comments