Game Development Reference
In-Depth Information
Figure 3.2. The screen-space linearity of z/w visualized by outputting the Z gradients.
Notice the flat shading, indicating constant gradients within planar surfaces.
is completely covered by the same primitive, all of the entire tile's depth values
can be encoded with three values, the two gradients and an offset, or essentially
a plane equation. Assuming that the value is stored as three 32-bit floats, 1
this would represent a bandwidth reduction of no less than 95% for reading and
writing depth.
The linearity in screen space is also a property that is very useful on the
software side of things. It makes it easy to write an accurate edge-detection
routine. Given that the gradients within a primitive are constant, if we detect
that the depth delta to the left and to the right of a pixel is different, we know
there is an edge there, and similarly in the vertical direction. We can also use
this information to find where the original geometrical edge that generated the
depth values is. This is the foundation upon which this technique is based.
This technique extracts the original geometrical edges analytically from the depth
buffer values. There are two types of edges that need to be handled separately,
creases and silhouette edges. A crease is where a primitive meets an adjacent
primitive—for instance, corners between walls—and a silhouette edge is where
there is no adjacent primitive on the other side of the edge and instead you have
1 The hardware is likely using a custom format that matches whatever precision the rasterizer
has. The hardware also needs to allocate at least one bit to signal whether the tile is compressed
or not.
Search Nedrilad ::

Custom Search