gDPSetRenderMode [Macro]

Function

gDPSetRenderMode

Sets the rendering mode of the blender (BL)

Syntax

#include <ultra64.h>        /* gbi.h */
gDPSetRenderMode( Gfx *gdl, u32 mode1, u32 mode2 )
gsDPSetRenderMode(          u32 mode1, u32 mode2 )

Arguments

gdl
Display list pointer.
mode1
Rendering mode set for first cycle:
G_RM_ [ AA_ | RA_ ] [ ZB_ ]* (Rendering type)
G_RM_FOG_SHADE_A (Fog type)
G_RM_FOG_PRIM_A (Fog type)
G_RM_PASS (Pass type)
G_RM_NOOP (No operation type)
mode2
Rendering mode set for second cycle:
G_RM_ [ AA_ | RA_ ] [ ZB_ ]*2 (Rendering type)
G_RM_NOOP2 (No operation type)

Description

Sets the rendering modes of the BL. The BL can render a variety of Z-buffered, anti-aliased primitives. Although N64 supports Z-buffer anti-aliasing, you still need to be careful about the order of rendering with regards to surface and rendering mode. For example, all opaque polygons must be drawn before translucent (semi-transparent) polygons.

Regarding the mode1 and mode2 arguments:
The constants shown in the table below can be used to specify a general rendering mode. These constants are all defined in <gbi.h>. However, if the needed rendering mode is not defined, you can add your own original mode.
In 1-cycle mode, set one of the modes described below for mode1 and then set the same mode for mode2. In 2-cycle mode, fog or pass usually is set for mode1 and rendering is set for mode2.
When the cycle type is set to fill mode or copy mode (g*DPSetCycleType), execute g*DPSetRenderMode (G_RM_NOOP, G_RM_NOOP2) to place the BL is a safe state. Regardless of the mode, append "2" after the mode name for the mode2 setting. For example, for G_RM_AA_ZB_OPA_SURF, set G_RM_AA_ZB_OPA_SURF2.

List of Rendering Modes

(AA_: Antialiasing, RA_: Simple antialiasing (not as pretty as AA, but somewhat faster), ZB_: Z-buffering)

Rendering type
G_RM_ [ AA_ | RA_ ] [ ZB_ ] OPA_SURF
    Opaque surfaces
G_RM_ [ AA ] [ _ZB_ ] XLU_SURF
    Translucent surfaces
G_RM_ [ ZB_ | AA_ZB_ | RA_ZB_ ] OPA_DECAL
    Opaque decal surfaces
G_RM_ [ ZB_ | AA_ZB_ ] XLU_DECAL
    Translucent decal surfaces
G_RM_ [ AA_ZB_ | RA_ZB_ ] OPA_INTER
    Opaque interpenetrating surfaces
G_RM_AA_ZB_XLU_INTER
    Translucent interpenetrating surfaces
G_RM_AA_ [ ZB_ ] XLU_LINE
    Translucent lines
G_RM_AA_ [ ZB_ ] DEC_LINE
    Decal lines
G_RM_AA_ [ ZB_ ] TEX_EDGE
    Textured surfaces with alpha edge mask
    Enables conversion within a single pixel to be turned ON/OFF for texture alpha-outlined objects. When normal texture filtering is used, the edge appears blurry.
G_RM_AA_ZB_TEX_INTER
    Textured interpenetrating surfaces
G_RM_AA_ [ ZB_] SUB_SURF
    Subsurfaces
G_RM_ [ AA_ ] [ ZB_ ] PCL_SURF
    Particle system
G_RM_AA_ [ ZB_ ] OPA_TERR
    Opaque terrain
G_RM_AA_ [ ZB_ ] TEX_TERR
    Textured terrain
G_RM_AA_ [ ZB_ ] SUB_TERR
    Sub-terrain
G_RM_ [ ZB_ ] CLD_SURF
    Cloud surfaces
G_RM_ZB_OVL_SURF
    Overlay surfaces
G_RM_ADD
    Adds pixel color over memory color.
Fog type
G_RM_FOG_SHADE_A
    Uses the shading alpha to determine a varying fog coefficient. This shading alpha is used to determine the ratio of blending between fog and the output of the color combiner (CC).
G_RM_FOG_PRIM_A
    Uses the fog color alpha to express constant fog. This fog color alpha is used to determine the ratio of blending between fog and the output of the CC.
Pass type
G_RM_PASS
    Passes the CC output directly to the second cycle or the memory interface.
No operation type
G_RM_NOOP
    Prohibits color and Z calls, and sets the remaining BL state to zero.

A decal surface is a surface that is applied on top of another surface. For example, it can be used to place a surface on an airplane wing. In this case, a pixel is only written when the Z value of the pixel in the frame buffer is the same as the Z value of the pixel being drawn.

An interpenetrating surface is a surface that penetrates and is penetrated by another surface. For intersecting objects, only the first of the two interpenetrating surfaces needs to be set in G_RM_ [ AA_ZB_ | RA_ZB_ ] OPA_INTER or G_RM_ [ AA_ZB_ | RA_ZB_ ] XLU_INTER mode. However, if the second surface is also set, then antialiasing is performed on the portion that intersects.

Opaque lines are supported by setting the alpha value to 1.0.

Decal lines are applied on top of surfaces in the same way as decal surfaces.

For details, see to Section 12.7 "BL - Blender" and Section 15.7 "Blender Modes and Assumptions" in the N64 Programming Manual.

Note

In texture edge mode, if dithering is enabled when you zoom in on, say, a tree object that is extremely close to the viewpoint, then the dither pattern near the edges cannot be filtered. If this phenomenon occurs, it can be worked around with the following kinds of settings:

  • Disable dithering when rendering a texture edge mode object.
  • Do not use texture edge mode.

  • (The edges defined by the texture will not be as sharp as in texture edge mode.)
  • Use sharp texture mode instead of texture edge mode.
  • Depth cannot be represented accurately when viewing decal surfaces (surfaces on the same plane) from the perpendicular. This problem can be worked around in the following ways:

  • Use texture decals instead of geometrical decals.
  • Create the decal and the underlying surface such that they share vertices.
  • Although simple antialiasing (RA_) mode is somewhat faster than antialiasing (AA_) mode, the results are not as good. In particular, the lines of internal edges (the junctions between polygons) will appear blurry when texture maps incorporating high-frequency components are used. This kind of problem can be worked around in the following ways:

  • Use AA_ mode.
  • Do not use AA_ mode or RA_ mode for geometry aliasing of anything other than distinct interior edges.
  • See Also

    gDPSetCombineMode, gDPSetCycleType, gDPSetFogColor, gSPSetGeometryMode

    Revision History

    02/01/99   Completely rewritten