Z Stepper

The Z-stepper calculates an 18-bit fixed point depth value (Z) for each pixel of a primitive. The value is of Z is normally zero at the near plane and maximum at the far plane, assuming a proper g*SPViewport() command. By manipulating the g*SPViewport( ) command, it is possible to split the z-buffer into separate Z-planes, as shown in the following figure.

Figure 15.4.1  Z-Buffer Planes


No attempt will be made to justify why one would do this, only that it is possible. Also, note that the g*SPPerspNormalize( ) command can be used to maximize Z precision. Please see Figure 11.3.1, “Perspective Normalization Calculation,” for further details about g*SPPerspNormalize( ).

There is also a source of constant Z (from a register) that can set using the g*DPSetPrimDepth( ) command. To select the constant depth, use the g*DPSetDepthSource( ) command. This may be useful when z-buffering sprites, for example.

The Z value is subpixel corrected so that it is always calculated on the primitive. To see why this is necessary, consider the following figure.

Figure 15.4.2  Subpixel Correction of Z

In this case, if you calculate Z at the center of the pixel, the Z value will be negative because Z will be projected behind the viewpoint. A better solution is to calculate the Z value at the subpixel, below the center of the pixel in this case, which intersects the primitive.

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