fog with pixel shaders < 3.0

H. Verbeet hverbeet at
Mon Mar 12 10:11:33 CDT 2007

On 12/03/07, Fabian Bieler <der.fabe at> wrote:
> This is what we have to do, imo: Take the value from the oFog register, and
> store it in gl_FogFragCoord (which is currently already done). At the end of
> the fragment shader, we have to clamp gl_FogFragCoord to [0,1] and used it to
> mix the fragment color with the fog color, if fog is enabled.
> An Idea would be to use shader constants as the clamping parameters and to
> clamp gl_FogFragCoord to [1,1] if fogging is disabled and [0,1] if fogging is
> enabled.
I think that if fog is disabled, we should be getting corresponding
values from vertex processing. Also, at least for the vertex shader
case we already clamp fog values in the vertex shader, so unless fixed
function can pass us values outside [0,1] we probably can get away
with not clamping at all.

More information about the wine-devel mailing list