qzdoom/wadsrc/static/shaders/glsl/fogboundary.fp
Christoph Oelckers bc1e659c7b Revert "- reworked fog uniforms to move the global fog mode setting to the viewpoint buffer."
This reverts commit 8b26b6dd1e.

This was causing problems with light mode 2 because some edge cases were no longer handled properly.
2018-09-16 22:38:20 +02:00

29 lines
555 B
GLSL

in vec4 pixelpos;
layout(location=0) out vec4 FragColor;
//===========================================================================
//
// Main shader routine
//
//===========================================================================
void main()
{
float fogdist;
float fogfactor;
//
// calculate fog factor
//
if (uFogEnabled == -1)
{
fogdist = pixelpos.w;
}
else
{
fogdist = max(16.0, distance(pixelpos.xyz, uCameraPos.xyz));
}
fogfactor = exp2 (uFogDensity * fogdist);
FragColor = vec4(uFogColor.rgb, 1.0 - fogfactor);
}