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

Format
#include "gbi.h"

gDPSetAlphaCompare(Gfx *gdl,
   unsigned int mode)
gsDPSetAlphaCompare(unsigned int mode)
Arguments
  • gdl is the pointer to the graphics display list
  • mode is the mode (G_AC_NONE, G_AC_THRESHOLD, G_AC_DITHER)
What This Macro Does
It sets the alpha compare mode for conditional writes to the framebuffer. There are three modes:
  • G_AC_NONE mode disables alpha compare checking.
  • G_AC_THRESHOLD mode conditionally updates 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 mode conditionally updates 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.
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 (that is, no compare with the blend alpha is performed). For 8-bit CI frame buffers, the blend alpha compare is enabled. Copy mode cannot be used for 32-bit RGBA framebuffers.

Note
If you are using anti-aliasing rendering modes, G_AC_THRESHOLD can only threshold against blend color alpha=0.

See Also
gDPSetBlendColor



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
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated January 1998