Merge remote-tracking branch 'harryyoung/master' into experimentals
[VesselSimulator.git] / Assets / SquadCore / Shaders / SolidColorAlpha.shader
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Shader "Solid Color (Alpha)" {
	Properties 
	{
		_Color ("Color", Color) = (0.5, 0.5, 0.5, 0.5)
	}
	SubShader
	{
		
		ZWrite On
        GrabPass { }
		Pass
		{
			Fog { Mode Off }
			Blend SrcAlpha OneMinusSrcAlpha

			CGPROGRAM

			#pragma vertex vert
			#pragma fragment frag
	
			fixed4 _Color;
			sampler2D _GrabTexture;

			struct appdata
			{
				float4 vertex : POSITION;
			};
			struct v2f
			{
				float4 pos : SV_POSITION;
				float4 uv : TEXCOORD0;
			};
			v2f vert (appdata v)
			{
				v2f o;
				o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
				o.uv = o.pos;
				return o;
			}
			half4 frag(v2f i) : COLOR
			{
				float2 coord = 0.5 + 0.5 * i.uv.xy / i.uv.w;
				fixed4 tex = tex2D(_GrabTexture, float2(coord.x, 1 - coord.y));
				return fixed4(lerp(tex.rgb, _Color.rgb, _Color.a), 1);
			}
			ENDCG
		}
	}
}