60 likes | 320 Views
Fog Blending. Fog blends a fog color with each rasterized pixel fragment's posttexturing color using a blending factor f. Factor f is computed in one of three ways, depending on the fog mode, in the range 0<=f<=1.0. Let z be the distance in eye coordinates from the origin to the
E N D
Fog Blending Fog blends a fog color with each rasterized pixel fragment's posttexturing color using a blending factor f. Factor f is computed in one of three ways, depending on the fog mode, in the range 0<=f<=1.0. Let z be the distance in eye coordinates from the origin to the fragment being fogged: Cr' = f * Cr + (1-f) * Cf Where: Cr is the rasterized pixel color Cf is the fog color
Fog Blending Modes GL_LINEAR: f = (end - z) / (end - start) GL_EXP: f = e^-(density * z) GL_EXP2: f = e^-( (density * z)^2)
Fog Blending Modes From: OpenGL Programming Guide
Fog Parameters GL_FOG_MODE Specifies the blend mode, and is one of the symbolic constants: GL_LINEAR, GL_EXP, GL_EXP2 GL_FOG_DENSITY Specifies the scalar value used for fog density in the blending equation GL_FOG_START Specifies the starting z value used in the linear blending equation GL_FOG_END Specifies the ending z value used in the linear blending equation GL_FOG_COLOR Four valued array specifying the fog color