Part Tools Import
[VesselSimulator.git] / Assets / SquadCore / Shaders / SpecularBumpTransparent.shader
cybutek 1 Shader "KSP/Bumped Specular (Transparent)"
2 {
3 Properties
4 {
5 _MainTex("_MainTex (RGB spec(A))", 2D) = "white" {}
6 _BumpMap("_BumpMap", 2D) = "bump" {}
7
8 _MainColor ("Main Color", Color) = (1,1,1,1)
9
10 _Shininess ("Shininess", Range (0.03, 1)) = 0.078125
11
12 _Opacity("_Opacity", Range(0,1) ) = 1
13 _RimFalloff("_RimFalloff", Range(0.01,5) ) = 0.1
14 _RimColor("_RimColor", Color) = (0,0,0,0)
15
16 _TemperatureColor("_TemperatureColor", Color) = (0,0,0,0)
17 _BurnColor ("Burn Color", Color) = (1,1,1,1)
18 }
19
20 SubShader
21 {
22 Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
23
24 Pass
25 {
26 ZWrite On
27 ColorMask 0
28 }
29
30 ZWrite On
31 ZTest LEqual
32 Blend SrcAlpha OneMinusSrcAlpha
33
34 CGPROGRAM
35
36 #pragma surface surf BlinnPhong
37 #pragma target 2.0
38
39 half _Shininess;
40
41 sampler2D _MainTex;
42 sampler2D _BumpMap;
43
44 float4 _MainColor;
45 float _Opacity;
46 float _RimFalloff;
47 float4 _RimColor;
48 float4 _TemperatureColor;
49 float4 _BurnColor;
50
51 struct Input
52 {
53 float2 uv_MainTex;
54 float2 uv_BumpMap;
55 float2 uv_Emissive;
56 float3 viewDir;
57 };
58
59 void surf (Input IN, inout SurfaceOutput o)
60 {
61 float4 color = tex2D(_MainTex,(IN.uv_MainTex)) * _MainColor * _BurnColor;
62 float3 normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
63
64 half rim = 1.0 - saturate(dot (normalize(IN.viewDir), normal));
65
66 float3 emission = (_RimColor.rgb * pow(rim, _RimFalloff)) * _RimColor.a;
67 emission += _TemperatureColor.rgb * _TemperatureColor.a;
68
69 o.Albedo = color.rgb;
70 o.Emission = emission;
71 o.Gloss = color.a;
72 o.Specular = _Shininess;
73 o.Normal = normal;
74 o.Emission *= _Opacity;
75 o.Alpha = _Opacity;
76 }
77 ENDCG
78 }
79 Fallback "Bumped Specular"
80 }