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

   

gDPSetRenderMode

Format
#include "gbi.h"

gDPSetRenderMode(Gfx *gdl,
   unsigned int mode1,
   unsigned int mode2 )

gsDPSetRenderMode(unsigned int mode1,
   unsigned int mode2 )
Arguments
  • gdl is the pointer to the graphics display list
  • mode1 specifies the mode1 value. In the one-cycle pipeline configuration, the blender can be set to render one of the geometry types G_RM_[AA_|RA_][ZB_]*, or you can do fog by using G_RM_FOG_SHADE_A or G_RM_FOG_PRIM_A
  • mode2 specifies the mode2 value. In the one-cycle configuration, mode2 has no effect. In the two-cycle configuration, the blender performs mode2 rendering mode on the second cycle. Valid choices are G_RM_[AA_|RA_][ZB_]*2 geometry types
What This Macro Does
It sets the rendering modes of the blender. These modes specify what the blender does in one- or two-cycle pipeline configuration. All of the valid modes for mode2 end with 2 for ease of recognition. The blender can render many types of anti-aliased Z-Buffered primitives. Although the N64 supports Z-Buffered anti-aliasing, you still need to order rendering with respect to surface or geometry type. For example, all opaque polygons should be rendered prior to transparent polygons. See the "RDP State Machine" chapter of the N64 Programming Manual for more detail.

You can build up your own modes to do any kind of rendering that you want. A number of commonly used modes have been defined for you in the gbi.h file. They are described below. If you don't find the render mode that you need to do what you want, create your own.

In one-cycle mode, you can set mode1 to one of the following items. In the following list, AA_ indicates anti-aliasing, RA_ indicates reduced aliasing (not as good as AA_ but slightly faster), and ZB_ indicates Z-Buffered.
  • G_RM_ [ AA_ | RA_ ] [ ZB_ ] OPA_SURF - Opaque surfaces.
  • G_RM_ [ AA_ | RA_ ] [ ZB_ ] XLU_SURF - Transluscent surfaces.
  • G_RM_ [ ZB_ | AA_ZB_ | RA_ZB_ ] [ OPA_ | XLU_ ] DECAL - Opaque or translucent decal surfaces. These are decal surfaces that can be applied onto another surface. For example, decals on airplane wings. Pixels will only be visible if the Z values are the same on the pixel being drawn as on the pixel in the frame buffer.
  • G_RM_ [ AA_ZB_ | RA_ZB_ ][ OPA_ | XLU_ ] INTER - Opaque or translucent interpenetrating surfaces. These are for surfaces which interpenetrate another surface. For objects that intersect, it is not necessary to set the second surface that interpenetrates the first surface in this mode. However, if set, the intersection is anti-aliased.
  • G_RM_AA_ [ ZB_ ] XLU_LINE - Transluscent lines. Opaque lines are supported by setting the alpha equal to 1.0 which is no translucency.
  • G_RM_AA_ [ ZB_ ] DEC_LINE - Decal lines. Like decal surfaces, these lines can be applied onto a surface.
  • G_RM_ [ AA_ ] [ ZB_ ] TEX_EDGE - Textured surfaces with an alpha edge mask. This mode enables the texture alpha outlined objects to transition on or off within a
  • single pixel. Using traditional texture filtering, the edge can look blurry.
  • G_RM_FOG_SHADE_A - Uses the alpha channel of the RDP pipeline to iterate a fog
  • coefficient. The alpha channel is used to determine the blend between fog and output of the CC color.
  • G_RM_FOG_PRIM_A - Uses the blend color alpha to blend between fog and the output of the CC. This gives constant fog across a geometry surface.
  • G_RM_PASS - Passes the CC output color to the second cycle or MI.
In two-cycle mode, you must set mode2 to one of the above items to indicate the operation for the second cycle. Keep in mind that the above modes have corresponding ones ending in "2" for mode2. For example, G_RM_AA_ZB_OPA_SURF2. In the first cycle of a two-cycle mode pipeline configuration, you typically set mode1 to G_RM_FOG_SHADE_A, G_RM_FOG_PRIM_A, or G_RM_PASS.

Bugs
When dithering is enabled and you are zooming in on a texture-edge mode object, such as a tree that is very close to the viewpoint, the filtering of the dither pattern around the edges does not work. Workarounds are:
  • Disable dithering when rendering texture edge mode objects.
  • Don't use texture-edge mode (the edges defined by the texture will not be as sharp as in texture-edge mode).
  • Use sharpen instead of texture edge mode.
Decal surfaces (co-planar surfaces on top of each other) do not resolve depth correctly when viewed perpendicularly. Workarounds are:
  • Use texture decals rather than geometric decals.
  • Make the decal and underlying surface share vertices.
  • Use gSPTexture (and the gspFast3D microcode) with the additional parameter set to a small non-zero integer (5 seems good). This enables a software workaround that improves the fuzzy-Z compare in this case (but slightly degrades some other cases).
RA_ modes (reduced aliasing) are slightly faster than AA_ (anti aliasing) modes but do not work as well. In particular, internal edges will sometimes be visible as blurry lines especially when used with medium to high frequency texture maps. Workarounds are:
  • Use AA_ modes for better anti-aliasing.
  • Use modes with neither AA_ nor RA_ for aliased geometry without visible internal edges.
After using particle rendering modes (RM_*_PCL_SURF), the rendering state is left in a funny state. This is because the bits modified for particle rendering mode are not consecutive, yet the set/clear interface can only clear consecutive bits. This could cause some rendering state to change behind your back, requiring you to carefully reset things after rendering your particle surfaces.

See Also
gDPSetCycleType
gDPSetFogColor
gDPSetCombineMode
gSPSetGeometryMode



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