From Vertices to Pixels: the Transformation Pipeline

Kenny Hoff
6/17/97



One important problem that has been "glossed" over through this paper is the complex interplay between the different coordinate systems at work in a typical transformation pipeline. Typically, (as in OpenGL) a 3D vertex in world coordinates goes through the following sequence of transformations (excluding modeling transformations that take model coords to world coords): To summarize, the different coordinate systems and possible uses are listed: Fixed-Point Scaling for Z: the value stored in the Zbuffer ranges from 0 to 1, but typically the Zbuffer contains and compares only fixed-point integers as opposed to the floating-point values we have computed. PixelFlow has 32 unsigned bits for depth so the normalized Z values are scaled to completely cover this range. In fixed-point terminology, the values in the Z-buffer are in a 0.32 split, meaning that there are 0 whole number bits and 32 fractional bits. The basic idea is that we must fit the range [0,1] into [0,232-1] where 232-1 is the maximum value obtainable by a 32-bit unsigned integer. So ideally our scaling factor (Zscale) should be 232-1; however, this value cannot be stored as a floating point number. We have to make a tradeoff and take the next largest positive float as our Zscale : 4294967040. All Z-compares and writes are performed in this 0.32 fixed-point system, but if we require a normalized floating point value again we can simply divide by Zscale.

Depth-Range Scaling for Z: the Z-value before fixed-point scaling must lie in the range [0,1]; however, before conversion to fixed-point the Z-values can be scaled and translated to fit inside an interval within [0,1] specified by the user as [NearRange,FarRange] where NearRange and FarRange are in [0,1] and NearRange is less than or equal to FarRange. This calculation is simply: DepthRangeScaledZ = ((Far-Near)/2)*NormalizedZ + (Near+Far)/2 The final fixed-point Z-value is then calculated as follows: FinalZ = Zscale * DepthRangeScaledZ