Part Tools Import
[VesselSimulator.git] / Assets / PartTools / Shaders / SolidColorAlpha.shader
cybutek 1 Shader "Solid Color (Alpha)" {
2 Properties
3 {
4 _Color ("Color", Color) = (0.5, 0.5, 0.5, 0.5)
5 }
6 SubShader
7 {
8
9 ZWrite On
10 GrabPass { }
11 Pass
12 {
13 Fog { Mode Off }
14 Blend SrcAlpha OneMinusSrcAlpha
15
16 CGPROGRAM
17
18 #pragma vertex vert
19 #pragma fragment frag
20
21 fixed4 _Color;
22 sampler2D _GrabTexture;
23
24 struct appdata
25 {
26 float4 vertex : POSITION;
27 };
28 struct v2f
29 {
30 float4 pos : SV_POSITION;
31 float4 uv : TEXCOORD0;
32 };
33 v2f vert (appdata v)
34 {
35 v2f o;
36 o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
37 o.uv = o.pos;
38 return o;
39 }
40 half4 frag(v2f i) : COLOR
41 {
42 float2 coord = 0.5 + 0.5 * i.uv.xy / i.uv.w;
43 fixed4 tex = tex2D(_GrabTexture, float2(coord.x, 1 - coord.y));
44 return fixed4(lerp(tex.rgb, _Color.rgb, _Color.a), 1);
45 }
46 ENDCG
47 }
48 }
49 }