444 10. The Rendering Engine
using them as our depth measure achieves uniform precision across the en-
tire depth range. This technique is called w-buff ering , because the view-space
z-coordinate conveniently appears in the w-component of our homogeneous
clip-space coordinates. (Recall from Equation (10.1) that pHw=−pVz.)
The terminology can be a very confusing here. The z- and w-buff ers store
coordinates that are expressed in clip space. But in terms of view-space coordi-
nates, the z-buff er stores 1/z (i.e., 1/pVz) while the w-buff er stores z (i.e., pVz)!
We should note here that the w-buff ering approach is a bit more expen-
sive than its z-based counterpart. This is because with w-buff ering, we cannot
linearly interpolate depths directly. Depths must be inverted prior to interpo-
lation and then re-inverted prior to being stored in the w-buff er.
10.2 The Rendering Pipeline
Now that we’ve completed our whirlwind tour of the major theoretical and
practical underpinnings of triangle rasterization, let’s turn our att ention to
how it is typically implemented. In real-time game rendering engines, the
high-level rendering steps described in Section 10.1 are implemented using
a soft ware/hardware architecture known as a pipeline. A pipeline is just an or-
dered chain of computational stages, each with a specifi c purpose, operating
on a stream of input data items and producing a stream of output data.
Each stage of a pipeline can typically operate independently of the other
stages. Hence, one of the biggest advantages of a pipelined architecture is that
it lends itself extremely well to parallelization. While the fi rst stage is chewing
on one data element, the second stage can be processing the results previously
produced by the fi rst stage, and so on down the chain.
Parallelization can also be achieved within an individual stage of the
pipeline. For example, if the computing hardware for a particular stage is du-
Figure 10.38. A plot of the function 1/pVz, showing how most of the precision lies close to
the camera.
ΔpHz
ΔpVz ΔpVz
ΔpHz
pHz= 1/pVz pHz= 1/pVz