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).
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:
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.