N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential





gDPSetAlphaCompare [macro]

Sets the alpha compare mode.

Syntax

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

Arguments

  • gdl is the display list pointer.

  • mode is the lpha 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)

Explanation
Sets the mode for comparing the alpha value of the pixel input to the blender (BL) with an alpha source.

The different alpha compare modes are explained below:

G_AC_NONE
This mode will disable alpha compare checking.
G_AC_THRESHOLD
This mode will conditionally update the framebuffer if the pipeline pixel alpha is greater than the blend color alpha. This is typically used to cut out transparent regions of a texture map to give complex outlined objects. This is more efficient than rendering translucent surfaces and writing the actual transparent regions.
G_AC_DITHER
This mode will conditionally update the framebuffer if the pipeline pixel alpha is greater than a random dither value. Using this with an alpha gradient on a surface can give a nice particle fade out result.

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

Notes
When you are using antialiasing rendering modes, you cannot specify transparent regions.

Cautions
You should use the Render Mode G_RM_TEX_EDGE when enabling alpha compare in G_CYC_1CYCLE or G_CYC_2CYCLE pipeline mode. This is because you must get the alpha of the pixel on the coverage path in order for the compare to work and this mode prevents reading of the color framebuffer.

G_AC_THRESHOLD and G_AC_DITHER modes can also be used when the pipeline is in G_CYC_COPY mode. Because normal alpha blending is disabled in copy mode, this is the only way to achieve transparency in copy mode. For 16-bit RGBA (5/5/5/1) frame buffers, the alpha bit acts as a write enable, i.e. no compare with the blend alpha is performed. For 8-bit CI frame buffers , the blend alpha compare is enabled. Copy mode can not be used for 32-bit RGBA framebuffers.

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

See Also
gDPSetBlendColor
gDPSetCycleType
gDPSetRenderMode

Revision History
2/1/99 Completely rewritten.




Nintendo® Confidential

Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.


Copyright © 1998-1999
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last Updated April, 1999