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

   

gspFast3D Microcode
gspF3DNoN Microcode

This microcode comprises the following six object files:
  • gspFast3D.o
  • gspFast3D.dram.o
  • gspFast3D.fifo.o

  • gspF3DNoN.o
  • gspF3DNoN.dram.o
  • gspF3DNoN.fifo.o
This is the optimized, high-quality, full-featured 3D polygonal geometry RSP microcode. It supports 3D clipping, lighting, texture coordination generation, fog, and matrix stack.

gspFast3D

The gspFast3D microcode is the most full-featured of the microcode types. It is also the microcode used in the majority of the demo applications. gspFast3D supports 3D triangles, 3D clipping, Z-Buffering, near and far clipping, lighting, MIP-mapped textures, perspective textures, fog, and matrix stack operations. It does not support the GBI macro, gSPLine3D.

gspF3DNoN

The gspF3DNoN microcode is similar to gspFast3D microcode except it does not handle near plane clipping in the same manner. When using gspFast3D microcode, objects between the eye and the near plane are clipped. When using gspF3DNoN microcode, objects between the eye and the near plane are not clipped. However, the area between the eye and the near clipping plane does not implement Z-Buffering. This means that objects that fall into this area must be rendered in order from far to near.

DRAM Version

The DRAM version of the microcode directs the output (RDP display list) to the RDP through a memory buffer (DRAM) that is larger than the buffer used in gspFast3D microcode.

The gspFast3D, gspFast3D.dram, and gspFast3D.fifo versions of the microcode are equivalent to the gspF3DNoN, gspF3DNoN.dram, and gspF3DNoN.fifo versions (respectively), with the difference that near clipping is performed at the Near Clipping plane in the former 3 versions, and performed at the eyepoint in the latter 3 versions.

All computations are performed with as much precision as is practical, in order to create the highest quality images.

Unsupported GBI Macros

All gSPLine3D macros are complied as no-ops, so they have no effect.

Performance

In order from the fastest to the slowest, the following types of triangles can be generated by this microcode:
  • Filled Flat Shaded (must set primitive color in DP appropriately)
  • Gouraud Shaded
  • Gouraud Shaded, Z-buffered
  • Gouraud Shaded, Textured
  • Gouraud Shaded, Textured, Z-buffered
Triangle attribute computation is heavily vectorized, so generation of Gouraud shading attributes is essentially free, if you are generating any other attributes.

Vertex transformations and lighting calculations are heavily vectorized, so it is best to operate on as many vertices as possible. Even number-sized loads are more efficient because vertices are processed in groups of two.

When doing lighting, and any vertices are clipped, clipping and lighting are implemented as ucode overlays, using a most recently used algorithm. Lighting happens at vertex load time and clipping happens at triangle draw time, so this division of microcode is acceptable. However, a display list that loads only a few vertices at a time and then draws a small number of triangles, would not amortize the microcode swapping overhead very effectively.

The RCP is designed to draw high quality textured primitives. Where possible, use texture-mapping to achieve visual complexity rather than additional geometry.

Notes on Different Versions

There are some differences when calling the DRAM and fifo versions of this microcode.

gspFast3D: The flags field of any task followed by this task should have OS_TASK_DP_WAIT set. If more than one task using this microcode is called in the same frame, then only the last task should contain a gSPFullSync in its display list. This microcode takes care of sending all output to the RDP. When using this microcode, it is not necessary to specify output_buff or an output_buff_size. (These fields of task header can be set to 0.)

gspFast3D.dram: Tasks using this microcode need to set the OS_TASK_DP_WAIT flag only if they follow a task using gspFast3D or gspFast3D.fifo. This microcode sends its data to a buffer in DRAM and not to the RDP. The CPU must then cause the buffer to be sent to the RDP. The buffer is pointed to by output_buff in the task header. This must point to a buffer which is at least as big as the maximum RDP display list that can be generated by the task. Remember that when geometry gets clipped RDP lists will expand, so leave extra room. If the buffer is not large enough to store the entire RDP display list, other memory areas will be overwritten. After the RSP finishes its process, the buffer can be sent to the RSP using the osDpSetNextBuffer command. The length of data in the buffer, which is needed for osDpSetNextBuffer, is written at an address specified by rdp_output_len in the task header. While the display list is being sent to the RDP, the RSP can execute other DRAM microcode, whose output_buff is different, or audio tasks. When gDPFullSync is not included in the display list to be sent to the RDP, other RDP display lists can be sent (from the RSP task to other buffers) using other osDpSetNextBuffer commands. However, when gDPFullSync is included in the display list, neither send other RDP display lists using osDpSetNextBuffer nor start gspFast3D or gspFast3D.fifo tasks until completing the display list.

gspFast3D.fifo: A task that uses this microcode and is followed by a gspFast3D task or a osDpSetNextBuffer command needs to set the OS_TASK_DP_WAIT flag. This microcode watches transmission of the display list to the RDP. A buffer specified by output_buf in the task header is used. The buffer must be cache aligned. Output_buff_size must be the pointer for byte followed by last byte of the buffer. The larger the buffer is, the more practical the interface between the RSP and the RDP. When there are multiple tasks in parallel which use fifo microcode, only the last task in a frame must include gDPFullSync. There are multiple tasks continuously which use fifo microcode, all tasks must use the output_buff buffer. (Each task can use a different buffer, however, it is more efficient to use one large buffer for all tasks.)

Note for Near Clipping

Near Clipping removes geometry either behind the viewer or between the viewer and the Near Clipping plane. In actual circumstances, an object never disappears when getting closer to the viewpoint, so it should not happen in a N64 program. One way to achieve this is to locate the near plane very close to the viewpoint. (By calling guPerspective, make the near value small.) However, it does not always work because the smaller ratio of near/far makes the accuracy of Z and texture mapping worse. Another way to accomplish this is to use a gspF3DNoN microcode (or its DRAM or fifo version) which does Near Clipping. An object behind the viewer is clipped and an object far from the near plane is visible. However, an object between the near plane and the viewer is also visible. In this way, the near value can be increased without geometry disappearing between the viewpoint and the near plane.

Z buffering never functions in the area between the viewpoint and the near plane. As a result, objects between the near plane and viewer never hide each other. For example, in an asteroid type game, when an asteroid approaches the view point closer than the near plane, the asteroid is drawn correctly. (objects far from the near plane are hidden.) However, when two asteroids approach closer than the near plane, they cannot be hidden correctly.

Default RDP State

Whenever a graphic task is first started, some of the RDP states are initialized to their default states. The rest of the states keep their previous values. After restarting from yield, RDP states are restored with states set at yield. The following are RDP default settings:
  • gsDPSetAlphaCompare(G_AC_NONE)
  • gsDPSetDepthSource(G_ZS_PIXEL)
  • gsDPSetRenderMode(RM_NOOP, RM_NOOP2)
  • gsDPSetAlphaDither(G_AD_DISABLE)
  • gsDPSetColorDither(G_CD_DISABLE)
  • gsDPSetCombineKey(G_CK_NONE)
  • gsDPSetTextureConvert(G_TC_FILT)
  • gsDPSetTextureFilter(G_TF_POINT)
  • gsDPSetTextureLUT(G_TT_NONE)
  • gsDPSetTextureLOD(G_TL_NONE)
  • gsDPSetTextureDetail(G_TD_CLAMP)
  • gsDPSetTexturePersp(G_TP_PERSP)
  • gsDPSetCycleType(G_CYC_1CYCLE)
  • gsDPPipelineMode(G_PM_NPRIMITIVE)
See Also
gspLine3D
gspTurbo3D
osSpTaskStart



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