Synched gist at Fri Sep 15 06:30:12 PDT 2023

This commit is contained in:
Marco Cawthorne 2023-09-15 06:30:12 -07:00
parent dd67eb2c64
commit 1efa541038
Signed by: eukara
GPG key ID: CE2032F0A2882A22

18
fog.c Normal file
View 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"