Last active
November 20, 2019 11:26
-
-
Save gamemachine/9a077115f02ba24d7566eb333eb18c03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Header(Fog)] | |
[Toggle] _ApplyFog("Enable", Float) = 1 | |
_FogColor("Fog Color (RGB)", Color) = (0.5, 0.5, 0.5, 1.0) | |
_FogStart("Fog Start", Float) = 0.0 | |
_FogEnd("Fog End", Float) = 10.0 | |
#pragma shader_feature _APPLYFOG_ON | |
fixed4 _FogColor; | |
float _FogStart; | |
float _FogEnd; | |
half3 ApplyFog(half3 col, float pixelZ) { | |
float fogvar = saturate(1.0 - (_FogEnd - pixelZ) / (_FogEnd - _FogStart)); | |
col.rgb = lerp(col.rgb, _FogColor, fogvar); | |
return col; | |
} | |
#if _APPLYFOG_ON | |
col = ApplyFog(col, pixelZ); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment