BurnOut Dissolve.shader
1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Shader "I_Jemin/Burnout Dissolve" {
Properties {
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_NormalMap("Normal Map",2D) = "black" {}
_NoiseMap("Noise Map",2D) = "black" {}
_Cutout("Cut Out",Range(0,1)) = 0.2
[HDR]_BurnColor("Burn edge Color",Color) = (1,0,0,1)
}
SubShader {
Tags {"Queue" = "AlphaTest" "RenderType"="TransparentCutout" }
cull off
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard alphatest:_Cutoff
sampler2D _MainTex;
sampler2D _NormalMap;
sampler2D _NoiseMap;
float4 _BurnColor;
float _Cutout;
struct Input {
float2 uv_MainTex;
float2 uv_NormalMap;
float2 uv_NoiseMap;
};
void surf (Input IN, inout SurfaceOutputStandard o) {
// basic albedo settings
o.Normal = UnpackNormal(tex2D(_NormalMap, IN.uv_NormalMap));
fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb;
// get burn opacity percentage
float opacity = tex2D(_NoiseMap,IN.uv_NoiseMap).r;
if(opacity < _Cutout * 1.2)
{
o.Emission = _BurnColor;
}
if(opacity < _Cutout)
{
o.Alpha = 0;
}
else
{
o.Alpha = c.a;
}
}
ENDCG
}
FallBack "Diffuse"
}