GXSetFog

C Specification

#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 exponent squared
GX_FOG_PERSP_REVEXP inverse exponent
GX_FOG_PERSP_REVEXP2 inverse of the squared exponent
GX_FOG_ORTHO_LIN linear
for orthographic projection mode
GX_FOG_ORTHO_EXP exponential
GX_FOG_ORTHO_EXP2 exponent squared
GX_FOG_ORTHO_REVEXP inverse exponent
GX_FOG_ORTHO_REVEXP2 inverse of the squared exponent
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 visual space coordinates.
endz The maximum Z value for which the fog function is active, in visual space coordinates.
nearz The near plane (should match the projection matrix parameters).
farz The far plane (must match the projection matrix parameters).
farz must be greater 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 the 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 (in RGBX format; the alpha component is ignored) is set using the color parameter. This will be the color of the pixel when fully fogged.

GXInit 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 adjusted)
Inverse Exponential Inverse Exponential Squared

See Also

GXSetFogRangeAdj
GXSetFogColor

Revision History

2006/03/01 Initial version.


CONFIDENTIAL