Shader "Custom/fire"
{
Properties
{ //1.
_MainTex("_MainTex",2D)="white"{}
_MainTex2("Noise",2D)="white"{}
_Speed("Speed",Range(0,1)) =0
_Bright("Bright",Range(-1,1))=0
_Noise("Noise",Range(0,1))=0
//구겨지는 정도
}
SubShader
{
//Tags { "RenderType"="Opaque" } //불투명
Tags { "RenderType"="Transparent" "Queue"="Transparent"} //반투명
CGPROGRAM
//#pragma surface surf Standard fullforwardshadows
#pragma surface surf Standard alpha:fade
#pragma target 3.0
//2.
sampler2D _MainTex;
sampler2D _MainTex2;
float _Speed;
float _Bright;
float _Noise;
struct Input
{ //3.
float2 uv_MainTex;
float2 uv_MainTex2;
};
void surf (Input IN, inout SurfaceOutputStandard o)
{
//4.
float2 uv2 = IN.uv_MainTex2; //노이즈
uv2.y-=_Time.y*_Speed; //위로 이동 속도 제어
float4 d = tex2D(_MainTex2,uv2);
float3 e= d.rgb*_Noise;//구겨지는 정도 조절하기
// 불
float2 uv = IN.uv_MainTex;
float4 c = tex2D (_MainTex,uv + e.r); //불이펙트
//5.
//o.Emission= c.rgb* d.rgb; //두 이미지 합치기
// o.Alpha = c.a* d.a;
o.Emission= c.rgb+_Bright;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
'게임개발 > 게임 그래픽 프로그래밍' 카테고리의 다른 글
Standard - Lambert -HalfLambert (0) | 2024.02.20 |
---|---|
커스텀 라이트 만들기 (0) | 2024.02.20 |
Rock Golem 만들기 (0) | 2024.02.19 |
Lerp 함수 사용하기 (0) | 2024.02.16 |
SurfaceShader 시작하기 (0) | 2024.02.16 |