Graphics Reference
In-Depth Information
overhangs or caves in the terrain, a feature that is typically missing from most height-map-
based terrain Tenderers.
One significant problem that hasn't been mentioned thus far, and which is not really
in the scope of this chapter, is that of interacting with the terrain.
In particular, the core application running on the CPU has no knowledge of the final
geometry, which is generated entirely on the GPU. This is problematic for physics-oriented
or user-oriented algorithms, such as picking (clicking to select geometric objects and fea-
tures) or having objects interact (as in collision detection) or having objects track the land-
scape (such as having a car follow the terrain of a racing track).
Two ways to mitigate this problem are for the CPU to always use the highest level of
detail, or to move picking or ray-casting to the GPU. In the former case, and for an adaptive
GPU tessellation like the one described here, the rendered terrain should be very close to
the highest LOD in all cases where it would be evident to a user. In the latter case, it is pos-
sible to use the geometry shader, combined stream output, 9 to output a candidate set of ge-
ometry that intersect points of interest. This is quite complicated and requires careful work
to ensure that CPU read-back doesn't stall the GPU; but does present a robust solution.
9.2 Higher-Order Surfaces
This category of tessellation is the more commonly known approach. It covers the algo-
rithms and equations used by the majority of the art and design software used over the
last few decades, and is being closer to the assumption that tessellation is about curved or
smooth surfaces.
Consider Equation (9.2), shown below. In particular, note that it has two basic con-
stituents constants (a, b, c, and d) and variables (only x in this case). In the context of
tessellation, the constants would be control points output by the hull shader stage, and the
variables would be the sample locations input into the domain shader stage from the fixed-
function tessellator. The domain shader is responsible for taking both of these and evaluat-
ing the final result of the equation:
f(x) = a + bx + cx 2 +
dx 3
(9.2)
The exact form of an equation used in this style of tessellation will vary, and the prop-
erties (such as complexity or classes of shape or the surface it can replicate) will be key to
9 Geometry shaders and stream output capabilities are discussed in detail in Chapter 3.
Search WWH ::




Custom Search