GXSetAlphaCompare

C Specification

#include <revolution/gx.h>
void GXSetAlphaCompare(
GXCompare     comp0,
u8            ref0,
GXAlphaOp     op,
GXCompare     comp1,
u8            ref1 );

Arguments

comp0 comparison subfunction 0
Applicable values are as follows:
Name Comparison Expression for Subfunction 0
GX_NEVER always false
GX_LESS (alpha_src <ref0)
GX_LEQUAL (alpha_src <=ref0)
GX_EQUAL (alpha_src ==ref0)
GX_NEQUAL (alpha_src !=ref0)
GX_GEQUAL (alpha_src >=ref0)
GX_GREATER (alpha_src >ref0)
GX_ALWAYS always true
ref0 reference value for subfunction 0
An 8-bit value.
op an operator for combining subfunction 0 and subfunction 1
Applicable values are as follows:
Name Logical Formula
GX_AOP_AND (subfunction0) AND (subfunction1)
GX_AOP_OR (subfunction0) OR (subfunction1)
GX_AOP_XOR (subfunction0) XOR (subfunction1)
GX_AOP_XNOR (subfunction0) XNOR (subfunction1)
comp1 comparison subfunction 1
Applicable values are as follows:
Name comparison method for subfunction 1
GX_NEVER always false
GX_LESS (alpha_src <ref1)
GX_LEQUAL (alpha_src <=ref1)
GX_EQUAL (alpha_src ==ref1)
GX_NEQUAL (alpha_src !=ref1)
GX_GEQUAL (alpha_src >=ref1)
GX_GREATER (alpha_src >ref1)
GX_ALWAYS always true
ref1 reference value for subfunction 1
An 8-bit value.

Return Values

None.

Description

This function sets the arguments for the alpha comparison function which uses alpha output from the last active texture environment (TEV) stage. The number of active TEV stages are specified using GXSetNumTevStages.

The output alpha can be used in blending equations (see GXSetBlendMode) to control how source and target (frame buffer) pixels are combined. 

The alpha comparison is:

alpha_pass = (alpha_src (comp0) ref0) (op) (alpha_src (comp1) ref1)

where alpha_src is the alpha from the last active TEV stage. As an example, you can implement these equations:

alpha_pass = (alpha_src > ref0) AND (alpha_src < ref1)
or
alpha_pass = (alpha_src > ref0) OR (alpha_src < ref1)

Z comparisons can occur either before or after texturing. Please refer to GXSetZCompLoc. In the case where Z comparison occurs before texturing, the Z is written based only on the Z test. The color is written if both the Z and alpha tests pass.

When Z comparisons occur after texturing, the color and Z are written if both the Z and alpha tests pass. When using texture to make cutout shapes (like billboard trees) that need to be correctly Z buffered, you should configure the pipeline for Z buffering after texturing.

See Also

GXSetNumTevStages
GXSetTevAlphaIn
GXSetTevAlphaOp
GXSetBlendMode
GXSetZCompLoc

Revision History

03/01/2006 Initial version.