| 1 | // Unlit alpha-blended shader. |
| 2 | // - no lighting |
| 3 | // - no lightmap support |
| 4 | // - supports tint color |
| 5 | |
| 6 | Shader "Unlit/Crosshair" { |
| 7 | |
| 8 | Properties |
| 9 | { |
| 10 | _MainTex ("Base (RGB), Alpha (A)", 2D) = "white" {} |
| 11 | _Color ("Main Color", Color) = (0.5,0.5,0.5,0.5) |
| 12 | } |
| 13 | |
| 14 | SubShader |
| 15 | { |
| 16 | LOD 100 |
| 17 | |
| 18 | Tags |
| 19 | { |
| 20 | "Queue" = "Transparent" |
| 21 | "IgnoreProjector" = "True" |
| 22 | "RenderType" = "Transparent" |
| 23 | } |
| 24 | |
| 25 | Cull Off |
| 26 | Lighting Off |
| 27 | ZTest Always |
| 28 | ZWrite Off |
| 29 | Fog { Mode Off } |
| 30 | Offset -1, -1 |
| 31 | Blend SrcAlpha OneMinusSrcAlpha |
| 32 | |
| 33 | Pass |
| 34 | { |
| 35 | CGPROGRAM |
| 36 | #pragma vertex vert |
| 37 | #pragma fragment frag |
| 38 | |
| 39 | #include "UnityCG.cginc" |
| 40 | |
| 41 | struct appdata_t |
| 42 | { |
| 43 | float4 vertex : POSITION; |
| 44 | float2 texcoord : TEXCOORD0; |
| 45 | fixed4 color : COLOR; |
| 46 | }; |
| 47 | |
| 48 | struct v2f |
| 49 | { |
| 50 | float4 vertex : SV_POSITION; |
| 51 | half2 texcoord : TEXCOORD0; |
| 52 | fixed4 color : COLOR; |
| 53 | }; |
| 54 | |
| 55 | sampler2D _MainTex; |
| 56 | float4 _MainTex_ST; |
| 57 | fixed4 _Color; |
| 58 | |
| 59 | v2f vert (appdata_t v) |
| 60 | { |
| 61 | v2f o; |
| 62 | o.vertex = UnityObjectToClipPos(v.vertex); |
| 63 | o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); |
| 64 | o.color = v.color; |
| 65 | return o; |
| 66 | } |
| 67 | |
| 68 | fixed4 frag (v2f i) : COLOR |
| 69 | { |
| 70 | fixed4 col = tex2D(_MainTex, i.texcoord) * i.color * _Color * 2.0; |
| 71 | return col; |
| 72 | } |
| 73 | ENDCG |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | |
| 78 | } |
| 79 | |