Shader "Custom/Fire"
{
Properties
{
_MainTex("Albedo (RGB)", 2D) = "white" {} // :: 불 모양
_MainTex2("Albedo (RGB)", 2D) = "white" {} // :: 흘러가는 불 기둥
}
SubShader
{
Tags { "RenderType"="Transparent" "Queue"="Transparent" } // :: 투명도 적용
LOD 200
CGPROGRAM
#pragma surface surf Standard alpha:fade // :: 투명도 적용
sampler2D _MainTex;
sampler2D _MainTex2;
struct Input
{
float2 uv_MainTex;
float2 uv_MainTex2;
};
void surf (Input IN, inout SurfaceOutputStandard o)
{
// :: 2번째의 노이즈를 우선 연산(-y 위로 올라가도록)
fixed4 c = tex2D (_MainTex2, float2(IN.uv_MainTex2.x, IN.uv_MainTex2.y - _Time.y));
// :: cr <= c 텍스쳐(노이즈)의 의존도(투명도?)를 0.5(50%)로 낮춤
// :: 노이즈보다 불 모양을 우선시하라는 것으로 이해
float cr = c * 0.5;
// :: Saturate : 0 이하의 값을 0으로 1 이상의 값을 1로 즉, 이미지 한계 조정
fixed4 d = tex2D(_MainTex, saturate(IN.uv_MainTex + cr));
// :: Emission : Light 영향을 적게
o.Emission = d.rgb;
o.Alpha = d.a; // :: 투명도
}
ENDCG
}
FallBack "Diffuse"
}