Part Tools Import
[VesselSimulator.git] / Assets / PartTools / Shaders / Diffuse.shader
cybutek 1 Shader "KSP/Diffuse"
2 {
3 Properties
4 {
5 _MainTex("_MainTex (RGB)", 2D) = "gray" {}
6 _Color ("Main 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
17 SubShader
18 {
19 Tags { "RenderType"="Opaque" }
20 ZWrite On
21 ZTest LEqual
22 Blend SrcAlpha OneMinusSrcAlpha
23
24 CGPROGRAM
25
26 #include "LightingKSP.cginc"
27 #pragma surface surf BlinnPhongSmooth keepalpha
28 #pragma target 3.0
29
30 sampler2D _MainTex;
31
32 float _Opacity;
33 float _RimFalloff;
34 float4 _RimColor;
35 float4 _TemperatureColor;
36 float4 _BurnColor;
37
38
39 struct Input
40 {
41 float2 uv_MainTex;
42 float2 uv_Emissive;
43 float3 viewDir;
44 };
45
46 void surf (Input IN, inout SurfaceOutput o)
47 {
48 float4 color = tex2D(_MainTex,(IN.uv_MainTex)) * _BurnColor;
49 float3 normal = float3(0,0,1);
50
51 half rim = 1.0 - saturate(dot (normalize(IN.viewDir), normal));
52
53 float3 emission = (_RimColor.rgb * pow(rim, _RimFalloff)) * _RimColor.a;
54 emission += _TemperatureColor.rgb * _TemperatureColor.a;
55
56 o.Albedo = color.rgb;
57 o.Emission = emission;
58 o.Normal = normal;
59 o.Gloss = 0;
60 o.Specular = 0;
61 o.Emission *= _Opacity;
62 o.Alpha = _Opacity;
63 }
64 ENDCG
65 }
66 Fallback "Standard"
67 }