Shader "Custom/LFade" {
Properties {
_Color ("Main Color", Color) = (1, 1, 1, 1)
_DawnTex ("Dawn (RGB)", 2D) = "white" {}
_DayTex ("Day (RGB)", 2D) = "white" {}
_DuskTex ("Dusk (RGB)", 2D) = "white" {}
_NightTex ("Night (RGB)", 2D) = "white" {}
_ViharTex ("Storm (RGB)", 2D) = "white" {}
_Csuszka ("Day cycle", Range (0,4)) = 2.0
_ViharCsuszka ("Storm scale", Range (0,0.9)) = 0.3
}
SubShader {
Tags { "RenderType"="Opaque" "IgnoreProjector"="True" }
Pass
{
Tags { "LightMode"= "Always" }
Lighting Off
SetTexture[_DawnTex]
SetTexture[_DayTex]
SetTexture[_DuskTex]
SetTexture[_NightTex]
}
CGPROGRAM
#pragma surface surf Unlit noambient novertexlights noforwardadd
#pragma target 3.0
sampler2D _DawnTex;
sampler2D _DayTex;
sampler2D _DuskTex;
sampler2D _NightTex;
sampler2D _ViharTex;
float _Csuszka;
float _ViharCsuszka;
struct Input {
float2 uv_DawnTex;
float2 uv_DayTex;
float2 uv_DuskTex;
float2 uv_NightTex;
float2 uv_ViharTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 dawn = tex2D (_DawnTex, IN.uv_DawnTex);
half4 day = tex2D (_DayTex, IN.uv_DayTex);
half4 dusk = tex2D (_DuskTex, IN.uv_DuskTex);
half4 night = tex2D (_NightTex, IN.uv_NightTex);
half4 storm = tex2D (_ViharTex, IN.uv_ViharTex);
half4 output;
if(_Csuszka <= 1)
{
output = lerp(dawn, day, _Csuszka);
}
else if(_Csuszka > 1 && _Csuszka <= 2)
{
output = lerp(day, dusk, _Csuszka - 1);
}
else if(_Csuszka > 2 && _Csuszka <= 3)
{
output = lerp(dusk, night, _Csuszka - 2);
}
else if(_Csuszka > 3 && _Csuszka <= 4)
{
output = lerp(night, dawn, _Csuszka - 3);
}
half4 viharedOutput = lerp(output, storm, _ViharCsuszka);
o.Albedo = viharedOutput.rgb ;
}
half4 LightingUnlit(SurfaceOutput s, half3 lightDir, half atten)
{
return half4(s.Albedo, s.Alpha);
}
ENDCG
}
FallBack "Diffuse"
}
Comments
0 B
|👍
/👎
0 B
|0 👍
/0 👎
0 B
|👍
/👎