gDPSetAlphaCompare [Macro]

Function

gDPSetAlphaCompare

Sets the alpha compare mode

Syntax

#include <ultra64.h>        /* gbi.h */
gDPSetAlphaCompare(Gfx *gdl, u32 mode)
gsDPSetAlphaCompare(         u32 mode)

Arguments

gdl
Display list pointer
mode
Alpha compare mode:
G_AC_NONE (Do not compare)
G_AC_THRESHOLD (Compare with the blend color alpha value)
G_AC_DITHER (Compare with a random dither value)

Description

Sets the mode for comparing the alpha value of the pixel input to the blender (BL) with an alpha source. The alpha compare modes are explained below:

G_AC_NONE
No alpha compare is performed.
G_AC_THRESHOLD
Conditionally overwrites the frame buffer when the alpha value of the input pixel is larger than the blend color alpha. This mode is used to delete transparent regions of a texture map and create objects with complicated outlines. This method is more efficient than first rendering a semi-transparent surface and then writing the actual transparent region.
G_AC_DITHER
Conditionally overwrites the frame buffer when the alpha value of the input pixel is larger than some random dither value. Attaching alpha gradation to a surface is an effective way of expressing particle fade out.

For details, see Sections 15.5.4 "Alpha Compare Calculation" and 12.7.4 "Alpha Compare" in the N64 Programming Manual.

Note

When you are using anti-aliasing rendering modes you cannot specify transparent regions.

Comment

If you are going to perform alpha compares in 1-cycle or 2-cycle pipeline mode, please set appropriate rendering mode. In copy mode, you can use G_AC_THRESHOLD and G_AC_DITHER. Since normal alpha blending is prohibited, you cannot express transparency in any other way. For 16-bit RGBA (5/5/5/1), the alpha bit itself plays the write-enabling role, so no comparison is made with the blend color alpha value. For 8-bit color index (CI), the blend color alpha comparison is enabled. For 32-bit RGBA it cannot be used.

To learn more about the cycle type setting, see gDPSetCycleType.

See Also

gDPSetBlendColor, gDPSetCycleType, and gDPSetRenderMode

Revision History

02/01/99 Completely rewritten.
03/31/99 Modified the Comment.