GXSetZTexture

C Specification

#include <revolution/gx.h>
void GXSetZTexture( 
    GXZTexOp    op, 
    GXTexFmt    fmt, 
    u32         bias );

Arguments

op specifies the Z texture process
Accepted values are:
Name Z Texture Mode
GX_ZT_DISABLE disables Z textures
GX_ZT_ADD Z texture is added to the original reference Z
GX_ZT_REPLACE Z texture replaces the original reference Z
fmt Z format
Accepted values are:
Name Z Texture Format
GX_TF_Z8 8-bit Z
GX_TF_Z16 16-bit Z
GX_TF_Z24X8 24-bit Z
bias the bias
The format is u24, right-aligned.

Return Values

None.

Description

This function controls Z texture operations. Z textures can be used to implement image-based rendering algorithms. A composite image consisting of color and depth image planes can be merged into the embedded frame buffer (EFB).

Normally, the Z for a quad (2x2) of pixels is calculated as a reference Z and two slopes. Once Z texturing is enabled, the Z is calculated by adding a Z texel to the reference Z (op = GX_ZT_ADD) or by replacing the reference Z with the Z texel value (op = GX_ZT_REPLACE).

Z textures are always the output from the last active texture environment (TEV) stage (see GXSetNumTevStages) when enabled. When Z texturing is enabled, the texture color of the last TEV stage is not available, but all other color inputs and operations are. The pixel color is always output from the last active TEV stage. TEV processes cannot be used with Z textures. They are sent directly into the Z texture logic.

Z texel formats can be unsigned 8-bit (GX_TF_Z8), 16-bit (GX_TF_Z16) or 24-bit (GX_TF_Z24X8 (32-bit texture)). The graphics processor converts Z-textures to 24-bit values by placing the texel value in the least-significant bits and zeroing any remainder. The 24-bit constant bias is added to the Z texture. If the pixel format is GX_PF_RGB565_Z16  the 24-bit result is converted to the current 16-bit Z format before comparison against the EFB Z value.

Z-texture calculations are done before fog range interpolations.

GXInit disables Z texturing.

See Also

GXSetNumTevStages
GXSetTevOrder
GXInitTexObj

Revision History

2006/03/01 Initial version.


CONFIDENTIAL