Update change log.
[VesselSimulator.git] / Assets / SquadCore / Shaders / Emissive.shader
cybutek 1 Shader "KSP/Emissive/Diffuse"
2 {
3 Properties
4 {
5 _MainTex("_MainTex (RGB)", 2D) = "white" {}
6
7 _EmissiveColor("_EmissiveColor", Color) = (0,0,0,1)
8 _Emissive("_Emissive", 2D) = "white" {}
9
10 _Opacity("_Opacity", Range(0,1) ) = 1
11 _RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
12 _RimColor("_RimColor", Color) = (0,0,0,0)
13
14 _TemperatureColor("_TemperatureColor", Color) = (0,0,0,0)
15 _BurnColor ("Burn Color", Color) = (1,1,1,1)
16 }
17
18 SubShader
19 {
20 ZWrite On
21 ZTest LEqual
22 Blend SrcAlpha OneMinusSrcAlpha
23
24 CGPROGRAM
25
26 #pragma surface surf Lambert
27 #pragma target 3.0
28
29 sampler2D _MainTex;
30
31 float4 _EmissiveColor;
32 sampler2D _Emissive;
33
34 float _Opacity;
35 float _RimFalloff;
36 float4 _RimColor;
37 float4 _TemperatureColor;
38 float4 _BurnColor;
39
40 struct Input
41 {
42 float2 uv_MainTex;
43 float2 uv_Emissive;
44 float3 viewDir;
45 };
46
47 void surf (Input IN, inout SurfaceOutput o)
48 {
49 float4 color = tex2D(_MainTex,(IN.uv_MainTex)) * _BurnColor;
50 float3 normal = float3(0,0,1);
51
52 half rim = 1.0 - saturate(dot (normalize(IN.viewDir), normal));
53
54 float3 emission = (_RimColor.rgb * pow(rim, _RimFalloff)) * _RimColor.a;
55 emission += _TemperatureColor.rgb * _TemperatureColor.a;
56 emission += (tex2D(_Emissive, IN.uv_Emissive).rgb * _EmissiveColor.rgb) * _EmissiveColor.a;
57
58 o.Albedo = color.rgb;
59 o.Emission = emission;
60 o.Gloss = 0;
61 o.Specular = 0;
62 o.Normal = normal;
63
64 o.Emission *= _Opacity;
65 o.Alpha = _Opacity;
66 }
67 ENDCG
68 }
69 Fallback "Diffuse"
70 }