gDPSetRenderMode.3p 5.77 KB
.TH gDPSetRenderMode 3P local "Silicon Graphics, Inc."
.SH NAME
.upperok
gDPSetRenderMode, gsDPSetRenderMode
\- set the rendering mode of the blender.
.SH C SPECIFICATION
.nf
\f3#include "gbi.h"

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

gsDPSetRenderMode(unsigned int mode1,
		unsigned int mode2 )

\fP
.fi
.SH PARAMETERS
.TP 10
.I *gdl
graphics display list pointer.
.TP
.I mode1
In one cycle pipeline configuration, the blender can be set to render one of the geometry types \f3G_RM_[AA_|RA_][ZB_]*\fP.
Or you can do fog by using \f3G_RM_FOG_SHADE_A\fP, or \f3G_RM_FOG_PRIM_A\fP.
.TP
.I mode2
In one cycle configuration, mode2 has no effect.
In two cycle configuration, the blender performs mode2 rendering mode on the second cycle.
Valid choices are \f3G_RM_[AA_|RA_][ZB_]*2\fP geometry types.
.SH DESCRIPTION
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 simplification.
The blender can render many types of antialiased zbuffered primitives.
Although the Nintendo64 supports zbuffered antialiasing, you still need to order rendering with respect to surface/geometry type.
For example, all opaque polygons should be rendered prior to transparent polygons.
See the "RDP State Machine" chapter of the
.I NU64 Programming Manual
for more detail.
.PP
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 gbi.h and are
described below.  If you don't find the render mode that you need to do what 
you want then create your own.
.PP
In one cycle mode, you can set mode1 to one of the following items.
AA_ indicates antialiasing,
RA_ indicates reduced aliasing (not as good as AA_ but slightly faster),
and ZB_ indicates zbuffered.
.TP
.B "G_RM_ [ AA_  | RA_ ] [ ZB_ ] OPA_SURF"
Opaque surfaces.
.TP
.B "G_RM_ [ AA_  | RA_ ] [ ZB_ ] XLU_SURF"
Transluscent surfaces.
.TP
.B "G_RM_ [ ZB_ | AA_ZB_ | RA_ZB_ ] [ OPA_ | XLU_ ] DECAL"
Opaque or transluscent 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.
.TP
.B "G_RM_ [ AA_ZB_ | RA_ZB_ ][ OPA_ | XLU_ ] INTER"
Opaque or transluscent interpenetrating surfaces.
These are for surfaces which interpenatrate another surface.
For objects that intersect, it is not necessary to set the second surface that interpenatrates the first surface in this mode.
However, if set, the intersection is antialiased.
.TP
.B "G_RM_AA_ [ ZB_ ] XLU_LINE"
Transluscent lines.
Opaque lines are supported by setting the alpha equal to 1.0 which is no transluscency.
.TP
.B "G_RM_AA_ [ ZB_ ] DEC_LINE"
Decal lines.
Like decal surfaces, these lines can be applied onto a surface.
.TP
.B "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.
.TP
.B 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.
.TP
.B 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.
.TP
.B G_RM_PASS
Passes the CC output color to the second cycle or MI.
.PP
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, \f3G_RM_AA_ZB_OPA_SURF2\fP.
In the first cycle of a two cycle mode pipeline configuration, you typically set mode1 to \f3G_RM_FOG_SHADE_A\fP, \f3G_RM_FOG_PRIM_A\fP or \f3G_RM_PASS\fP.
.PP
.SH BUGS
When zooming in on a texture-edge mode object, such as a tree that is
very close to the viewpoint, and dithering is enabled, the filtering
of the dither pattern around the edges does not work.  Workarounds are:
.sp
.nf
.ta 5 28
	-  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.
.fi
.PP
Decal surfaces (co-planar surfaces on top of each other) do not resolve
depth correctly when viewed perpendicularly. Workarounds are:
.sp
.nf
.ta 5 28
	-  use texture decals rather than geometric decals.
	-  make the decal and underlying surface share vertices.
	-  use gSPTextureL(3P) (and the gspFast3D(3P) ucode) 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).
.fi
.PP
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:
.sp
.nf
.ta 5 28
	-  use AA_ modes for better antialiasing.
	-  use modes with neither AA_ nor RA_ for aliased geometry 
           without visible internal edges.
.fi
.PP
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.
.PP


.SH SEE ALSO
.IR gDPSetCycleType (3P),
.IR gDPSetFogColor (3P),
.IR gDPSetCombineMode (3P),
.IR gSPSetGeometryMode (3P)