Texture Mapping

Texture mapping, or texturing, is the process of applying an image to a polygonal surface. There are many graphics books that discuss this topic; this guide assumes that you are familiar with the basic principles of texture mapping. This chapter explains the functionality of texture mapping as implemented in the Reality Display Processor (RDP).

Figure 13.1.1 Texture Unit Block Diagram

The RDP contains an on-chip texture memory called Tmem, which buffers all source image data used for texturing. Tmem contains up to eight tiles (a tile is a rectangular region of an image). A tile is loaded into Tmem using the LoadTile, LoadBlock, or LoadTlut commands, and described using the SetTile and SetTileSize commands. If the image is too large to fit entirely in Tmem, primitives must be subdivided in object space based on their texture coordinate values so that each primitive references a tile that fits in Tmem.

Texture coordinates (S,T) for each pixel are input to the texture coordinate unit and can be perspective corrected. Perspective correction is typically enabled for 3D geometry and disabled for 2D sprites (tex_rect commands). During this time, the texture coordinate unit calculates which tile descriptor to use for this primitive. The texture image coordinates are converted to tile-relative coordinates and wrapped, mirrored, and clamped. These tile coordinates are then used to generate an offset into Tmem. The texture unit can address 2x2 regions of texels in one or two cycle mode, or 4x1 regions in copy mode. Copy mode is typically used for blits (block copy of texels) with a 1:1 texel pixel relationship. In one or two cycle mode, filter or point-sample can also be selected. Typically, filter will result in a smoother image with less aliasing. The texture unit also generates S,T and L-fraction values that are used to bi-linearly or tri-linearly interpolate the texels.

The texture unit supports ten different combinations of texel size and format:

- 4-bit intensity (I)

- 4-bit intensity w/alpha (I/A) (3/1)

- 4-bit color index (CI)

- 8-bit I

- 8-bit IA (4/4)

- 8-bit CI

- 16-bit red, green, blue, alpha (RGBA) (5/5/5/1)

- 16-bit IA (8/8)

- 16-bit YUV (Luminance, Blue-Y, Red-Y)

- 32-bit RGBA (8/8/8/8)

Significant memory savings can result from the smaller color-index textures or intensity textures over the more expensive 16-bit RGBA. It is a good idea to experiment with the different texel sizes. One can actually do 2-color textures using the intensity types. Also, the intensity-only textures place the texel value on the alpha channel as well where it can be used for blending or ignored.

Graphics Binary Interface for Texture
The graphics binary interface (GBI) is a set of macros that create 64-bit commands that are read and parsed by the RSP microcode. Some of these commands cause actions or state changes in the RSP. Others are simply passed through the RSP to the RDP. Below is a list of GBI commands that control texture. See the corresponding reference (man) page for more details.

Primitive Commands

- g*SPTexture
- g*SPTextureRectangle*

Tile Related Commands

- g*DPSetTile
- g*DPSetTileSize

Load Commands

- g*DPLoadTile*
- g*DPLoadTextureBlock*
- g*DPLoadTLUT*
- gDPSetTextureImage

Sync Commands

- g*DPLoadSync
- g*DPTileSync

Mode Commands

- g*DPSetTextureLUT
- g*DPSetTexturePersp
- g*DPSetTextureDetail
- g*DPSetTextureLOD
- g*DPSetTextureFilter
- g*DPSetTextureConvert

  Copyright © 1999 Nintendo of America Inc. All Rights Reserved Nintendo and N64 are registered trademarks of Nintendo Last Updated January, 1999