18 lines
No EOL
572 B
C
18 lines
No EOL
572 B
C
"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" |