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

   

gSPClipRatio

Format
#include "gbi.h"

FRUSTRATIO_1
FRUSTRATIO_2
FRUSTRATIO_3
FRUSTRATIO_4
FRUSTRATIO_5
FRUSTRATIO_6
gSPClipRatio(Gfx *gdl, r)
gsSPClipRatio(r)
Arguments
  • gdl is the pointer to the graphics display list
  • r is the ratio of the clipping rectangle's size to the viewport rectangle's size (one of FRUSTRATIO_1, FRUSTRATIO_2, ... ,FRUSTRATIO_6)
What This Macro Does
It tells the RSP how to do clipping and scissoring and can be adjusted to increase performance.

Scissoring is performed by rasterizing the entire triangle and then removing off-screen sections pixel by pixel. Scissoring takes up processing time in the RDP.

Clipping is performed by turning a large triangle into one or more smaller triangles all of which fit in the clipping rectangle that is one to six times the size of the scissoring rectangle. Triangles that are entirely inside the clipping rectangle are not clipped. Triangles that are entirely outside the scissoring rectangle are trivially rejected, which is very fast. Triangles that stretch from inside the scissor rectangle to outside the clipping rectangle must be clipped, which is very slow in the RSP. If the clipping rectangle is made much larger than the scissoring rectangle, RDP processing will be slowed because more pixels will be scissored. However, it will speed up the RSP because fewer triangles will be large enough to stretch all the way from inside the scissor rectangle to outside the clipping rectangle, so fewer triangles will be clipped (clipping slows the RSP). When a triangle is clipped, it is often turned into more than one (smaller) triangle. Because it often takes the RDP longer to draw two triangles than one larger one, making the clipping rectangle larger than the scissoring rectangle can speed up the RDP significantly.

In F3DEX(.NoN), and F3DLX(.NoN), the processing of gSPClipRatio is same as Fast3D, however, in F3DL*.Rej(.NoN), it is different from Fast3D and is used to change the size of the reject-box.

In F3DL*.Rej, the initial value is FRUSTRATIO_2.

Because the best ratio to use will depend on the model being used, the best way to use this macro is to try out different values and see which one provides the best performance.

Note
All of this assumes that the scissor rectangle is the same size as the viewport (see gDPSetScissor, and gSPViewport).

Example
To make the clipping rectangle five times larger than the scissoring rectangle, use this code:

gSPClipRatio(glist++, FRUSTRATIO_5);

See Also
gDPSetScissor
gSPViewport



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