Added AltitudeUnderWater class to project file.
[VesselSimulator.git] / Assets / PartTools / 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 _Fresnel("Fresnel", Range(0,10)) = 0
10 [MaterialToggle] _FresnelInvert("Invert Fresnel", Float) = 0
11
12 _RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
13 _RimColor("_RimColor", Color) = (0,0,0,0)
14
15 _TemperatureColor("_TemperatureColor", Color) = (0,0,0,0)
16 _BurnColor ("Burn Color", Color) = (1,1,1,1)
17 }
18
19 SubShader
20 {
21 Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
22
23 Pass
24 {
25 ZWrite On
26 ColorMask 0
27 }
28
29 ZWrite On
30 ZTest LEqual
31 Blend SrcAlpha OneMinusSrcAlpha
32
33 CGPROGRAM
34
35 #include "LightingKSP.cginc"
36 #pragma surface surf Unlit noforwardadd noshadow noambient novertexlights alpha:fade
37 #pragma target 3.0
38
39 sampler2D _MainTex;
40
41 float _Opacity;
42 float _Fresnel;
43 float _FresnelInvert;
44 float _RimFalloff;
45 float4 _RimColor;
46 float4 _TemperatureColor;
47 float4 _BurnColor;
48
49
50
51 struct Input
52 {
53 float2 uv_MainTex;
54 float3 viewDir;
55 };
56
57 void surf (Input IN, inout SurfaceOutput o)
58 {
59 float4 color = tex2D(_MainTex, (IN.uv_MainTex)) * _BurnColor;
60 float alpha = _Color.a * color.a;
61 float3 normal = float3(0,0,1);
62
63 half rim = 1.0 - saturate(dot (normalize(IN.viewDir), normal));
64 float3 fresnel = (_FresnelInvert + (pow(1 - rim, _Fresnel))) * (1 - _FresnelInvert + 1 - (pow(1 - rim, _Fresnel)));
65
66 float3 emission = (_RimColor.rgb * pow(rim, _RimFalloff)) * _RimColor.a;
67 emission += _TemperatureColor.rgb * _TemperatureColor.a;
68
69 o.Albedo = _Color.rgb * color.rgb + emission;
70 //o.Emission = emission * _Opacity;
71 o.Normal = normal;
72 o.Alpha = _Color.a * color.a * _Opacity * fresnel;
73 }
74 ENDCG
75 }
76 Fallback "Standard"
77 }