Graphics Reference
In-Depth Information
legitimately required, and performance is no
longer wasted by extra geometry that has no
impact on the final image.
In "Simplified terrain using interlock-
ing tiles," (Snook, 2001), Greg Snook intro-
duced an algorithm that mapped very nicely
to early GPU architectures—around the time
when hardware transform and lighting were
possible, but slightly predating programma-
ble shader units.
The algorithm was particularly useful
because it didn't require modifying the ver-
tex or index buffers; instead, is used multiple
index buffers to provide a LOD mechanism.
This removed any need for the CPU to mod-
ify resources used for rendering, an operation
that both then and now can be prohibitively
expensive, but which is important for lever-
Figure 9.3. Index buffer layout for a single tile.
aging hardware transform and lighting capabilities. By simply rendering with a different
index buffer, Snook's algorithm could alter the LOD and balance performance and image
quality.
The algorithm breaks up the 2D height-map texture into a number of smaller tiles,
with each tile representing a 2 n +l-dimension area of vertices (9x9 was used in the original
implementation). This vertex data was fixed at load-time and simply represented the height
at each corresponding point on the height map, which also corresponds to the highest pos-
sible detail that can be rendered.
For each level of detail, there are 5 index buffers. For n=3, there are 4 LODs (n+1) in
a 9-dimensional area of vertices (2 3 +l=9). The layout of the regions that these index buf-
fers represent is depicted in Figure 9.3.
The five index buffers represent the central area of the tile, plus one index buffer for
each of the four edges shown in Figure 9.3. These are each assigned a different color. The
break-out edge diagrams show examples of mappings between different LODs, shown in
innenouter ratios. An observant reader might notice that this is suspiciously similar to the
quad tessellation introduced in Chapter 4!
The index buffer for the middle area represents all but the outer ring of vertices, so
for the 9x9 grid used in our example, it will always represent 7x7 vertices, regardless of
the chosen level of detail. The four "skirt" index buffers essentially provide a mapping
between neighboring tiles. It is possible to match either the higher or lower LOD, but it's
more common to blend down toward the lower one as shown in Figure 9.4. Technically, a
jump between any two levels of detail is possible, but as mentioned in Chapter 4, this may
Search WWH ::




Custom Search