Graphics Reference
In-Depth Information
used to implement a customized routine. This customizable processing can be used to our
advantage by performing calculations in the vertex shader that can be passed on to the later
stages, instead of calculating everything directly in the later stages.
It is also logical to perform any other calculations in the vertex shader that provide
relatively low-frequency information to the surface of the geometry. For example, it is of-
ten adequate to calculate ambient lighting calculations in the vertex shader, since it doesn't
change very quickly across the entire model. By performing the calculation at the vertex
level, we relieve a small amount of calculation from each shader invocation later in the
pipeline.
3.13.2 Tessellation Manipulations
The next set of pipeline stages implements the tessellation functionality of the rendering
pipeline. The hull shader, tessellator, and domain shader are all used together to provide a
very flexible and robust tessellation system. This can be seen as an extension of the previ-
ous vertex-based processes, since it ultimately produces vertices, as well. In many ways,
the domain shader can be seen as a repeat of the vertex shader, with some additional re-
sponsibilities for creating the vertex before it is processed.
However, the tessellation stage is intended to amplify the available detail at a geomet-
ric level, which is a departure from what the input assembler and vertex shader can do. This
means that the overall number of invocations of the domain shader will be significantly
higher than it is for the vertex shader. Because of this, and because of the additional calcu-
lations that need to be performed in the domain shader, the vertex shader should be used
as much as possible, instead of the domain shader. If all things are equal, the vertex shader
should be chosen over the domain shader.
Even so, the tessellation system provides some unique opportunities for the devel-
oper. By amplifying how many vertices are available to represent the geometry, we can
perform much higher frequency calculations much earlier in the pipeline than was possible
in previous versions of Direct3D. In the extreme case, we can produce one vertex for every
pixel, making the visual fidelity of the per-vertex data equal to that of the per-pixel data.
We can use this to our advantage by moving calculations to earlier in the pipeline and away
from the raster based stages, or we can simplify the later stages by performing more com-
plex calculations at the vertex level.
3.13.3 Geometry Manipulations
The geometry shader and the stream output stages are very much specialized stages that
sit between the vertex-based stages and the raster-based stages. As such, they are intended
Search WWH ::




Custom Search