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