Moved ActiveVessel check from UpdateModules to FixedUpdate
[VesselSimulator.git] / Assets / SquadCore / Shaders / UnlitTransparent.shader
cybutek 1 Shader "KSP/Alpha/Unlit Transparent"
2 {
3 Properties
4 {
5 _MainTex("MainTex (RGB Alpha(A))", 2D) = "white" {}
6 _Color("Color", Color) = (1,1,1,1)
7
8 _Opacity("_Opacity", Range(0,1) ) = 1
9 _RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
10 _RimColor("_RimColor", Color) = (0,0,0,0)
11
12 _TemperatureColor("_TemperatureColor", Color) = (0,0,0,0)
13 _BurnColor ("Burn Color", Color) = (1,1,1,1)
14 }
15
16 SubShader
17 {
18 ZWrite On
19 ZTest LEqual
20 Blend SrcAlpha OneMinusSrcAlpha
21 Cull Off
22
23 CGPROGRAM
24
25 #pragma surface surf Unlit alpha
26 #pragma target 3.0
27
28 sampler2D _MainTex;
29 float4 _Color;
30
31 float _Opacity;
32 float _RimFalloff;
33 float4 _RimColor;
34 float4 _TemperatureColor;
35 float4 _BurnColor;
36
37 inline half4 LightingUnlit (SurfaceOutput s, half3 lightDir, half atten)
38 {
39 half diff = max (0, dot (s.Normal, lightDir));
40
41 half4 c;
42 c.rgb = s.Albedo;
43 c.a = s.Alpha;
44 return c;
45 }
46
47 inline half4 LightingUnlit_PrePass (SurfaceOutput s, half4 light)
48 {
49 half4 c;
50 c.rgb = s.Albedo;
51 c.a = s.Alpha;
52 return c;
53 }
54
55 struct Input
56 {
57 float2 uv_MainTex;
58 float3 viewDir;
59 };
60
61 void surf (Input IN, inout SurfaceOutput o)
62 {
63 float4 color = tex2D(_MainTex, (IN.uv_MainTex)) * _BurnColor;
64 float alpha = _Color.a * color.a;
65 float3 normal = float3(0,0,1);
66
67 half rim = 1.0 - saturate(dot (normalize(IN.viewDir), normal));
68
69 float3 emission = (_RimColor.rgb * pow(rim, _RimFalloff)) * _RimColor.a;
70 emission += _TemperatureColor.rgb * _TemperatureColor.a;
71
72 o.Albedo = _Color.rgb * color.rgb;
73 o.Emission = emission * _Opacity;
74 o.Alpha = _Color.a * color.a*_Opacity;
75 }
76 ENDCG
77 }
78 Fallback "Diffuse"
79 }