Synched gist at Fri Sep 15 06:30:12 PDT 2023
This commit is contained in:
parent
dd67eb2c64
commit
1efa541038
1 changed files with 18 additions and 0 deletions
18
fog.c
Normal file
18
fog.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
"vec3 fog3(in vec3 regularcolour)"
|
||||
"{"
|
||||
"float z, fac;\n"
|
||||
"#if #include \"cvar/r_fog_linear\"\n"
|
||||
"z = gl_FragCoord.z / gl_FragCoord.w;\n"
|
||||
//"z = max(0.0, z);\n"
|
||||
"fac = (w_fogdensity - z) / (w_fogdensity - w_fogdepthbias);\n"
|
||||
"#else\n"
|
||||
"z = w_fogdensity * gl_FragCoord.z / gl_FragCoord.w;\n"
|
||||
"z = max(0.0,z-w_fogdepthbias);\n"
|
||||
"#if #include \"cvar/r_fog_exp2\"\n"
|
||||
"z *= z;\n"
|
||||
"#endif\n"
|
||||
"fac = exp2(-(z * 1.442695));\n"
|
||||
"fac = (1.0-w_fogalpha) + (clamp(fac, 0.0, 1.0)*w_fogalpha);\n"
|
||||
"#endif\n"
|
||||
"return mix(w_fogcolour, regularcolour, fac);\n"
|
||||
"}\n"
|
Loading…
Reference in a new issue