Moved ActiveVessel check from UpdateModules to FixedUpdate
[VesselSimulator.git] / Assets / SquadCore / Shaders / Specular.shader
cybutek 1 Shader "KSP/Specular"
2 {
3 Properties
4 {
5 _MainTex("_MainTex (RGB spec(A))", 2D) = "white" {}
6 _Color ("Main Color", Color) = (1,1,1,1)
7 _SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
8 _Shininess ("Shininess", Range (0.03, 1)) = 0.078125
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 Tags { "RenderType"="Opaque" }
21 ZWrite On
22 ZTest LEqual
23 Blend SrcAlpha OneMinusSrcAlpha
24
25 CGPROGRAM
26
27 #pragma surface surf BlinnPhong
28 #pragma target 3.0
29
30 half _Shininess;
31
32 sampler2D _MainTex;
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 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.Gloss = color.a;
59 o.Specular = _Shininess;
60 o.Normal = normal;
61
62 o.Emission *= _Opacity;
63 o.Alpha = _Opacity;
64 }
65 ENDCG
66 }
67 Fallback "Specular"
68 }