GXSetFog

Syntax

#include <revolution/gx.h>

void GXSetFog(
    GXFogType	type,
    f32		startz,
    f32		endz,
    f32		nearz,
    f32		farz,
    GXColor	color );

Arguments

type The types of fog functions.
Accepted values are:
Name Fog Function Types  
GX_FOG_NONE No fog.  
GX_FOG_PERSP_LIN Linear. For perspective projection mode.
GX_FOG_PERSP_EXP Exponential.
GX_FOG_PERSP_EXP2 Exponential squared.
GX_FOG_PERSP_REVEXP Inverse exponential.
GX_FOG_PERSP_REVEXP2 Inverse of exponential squared.
GX_FOG_ORTHO_LIN Linear. For orthographic projection mode.
GX_FOG_ORTHO_EXP Exponential.
GX_FOG_ORTHO_EXP2 Exponential squared.
GX_FOG_ORTHO_REVEXP Inverse exponential.
GX_FOG_ORTHO_REVEXP2 Inverse of exponential squared.
GX_FOG_LIN Same as GX_FOG_PERSP_LIN. For compatibility with prior versions.
GX_FOG_EXP Same as GX_FOG_PERSP_EXP.
GX_FOG_EXP2 Same as GX_FOG_PERSP_EXP2.
GX_FOG_REVEXP Same as GX_FOG_PERSP_REVEXP.
GX_FOG_REVEXP2 Same as GX_FOG_PERSP_REVEXP2.
startz The minimum Z value for which the fog function is active in visible coordinates.
endz The maximum Z value for which the fog function is active in visible coordinates.
nearz The near plane (should match the projection matrix parameters).
farz The far plane (should match the projection matrix parameters). farz must be larger than nearz.
color Fog color, in RGBX format (alpha is not used).

Return Values

None.

Description

This function enables fog. Using type, the programmer may select one of several functions (see the table below) to control fog density as a function of range to a quad (2x2 pixels). The range is a cosine-corrected Z value in the XZ plane (visual coordinates), but is not corrected in the Y direction. Please refer to the GXSetFogRangeAdj function.

The parameters startz and endz allow further control over fog behavior. The arguments nearz and farz should be set consistently with the projection matrix arguments. Note that these parameters are defined in visual space.

The fog color is set in RGBX format (where the alpha component is ignored) using the color parameter. This will be the color of the pixel when fully fogged.

The GXInit function disables fog by default.

Fog Function Types (Equation and Density Curve)

Linear Exponential Exponential Squared
F: Fog density [0, 1]
s: startz
e: endz
z: Pixel Z
(range adjustment)
Inverse Exponential Inverse of Exponential Squared

See Also

GXSetFogRangeAdj, GXSetFogColor

Revision History

2006/03/01 Initial version.


CONFIDENTIAL