Graphics Reference
In-Depth Information
is similar to the setup functionality discussed for the hull shader program. The function
attributes configure what will be tessellated (with the domain attribute), how it will be
tessellated (with the partitioning attribute), and what format its output will be in (with
the outputtopology attribute). The patch constant function then produces the tessellation
factors for each patch, which instruct the tessellator stage how finely to chop up the chosen
domain primitive. If the hull shader program sets up the data of the tessellation algorithm,
the patch constant function sets up the actual tessellation machinery.
Fine level of detail. The calculation of the tessellation factors can be based on any number
of different criteria. For example, it is possible to modify the amount of tessellation based
on the distance of the input control patch to the viewer. It is of course better to have higher
tessellation closer to the viewer than when a patch is farther away, to reduce the number
of required computations. However, in other cases this approach is either not appropri-
ate or not ideal. For example, when an object is relatively smooth, with only a few sharp
details, it may be better to base the tessellation factors on some measure of the amount of
change in a surface. This could either be precalculated and stored in the control points, or
perhaps stored in a texture for lookup later on. It is also possible (and in fact, more prob-
able) to combine more than one heuristic approach for this problem. Examples of this type
of analysis are presented in Chapter 9, "Dynamic Tessellation."
Image quality. Many other types of properties should be considered when determining the
desired tessellation density. For example, if a control patch is positioned on the silhouette
edge of a mesh, it will improve the image quality to tessellate the patch more than if it
were perpendicular to the view direction. Another very good example of improving image
quality with the use of varying tessellation levels is in the generation of dual-paraboloid
shadow maps, or environment maps. 1 - The paraboloid projection is known to produce arti-
facts when it is generated with triangles that cover large areas of the paraboloid map. This
happens because each vertex is transformed with the paraboloid projection, but the triangle
primitives that the vertices are used to produce are linearly rasterized. This situation is
depicted in Figure 3.22.
The situation becomes more problematic as a primitive covers more and more texels
of the paraboloid map. A simple method to alleviate this issue is to calculate the screen-
space area of a triangle in the patch constant function and then increase the tessellation
factors according to this screen-space size. The tessellated points can then be properly
projected in the domain shader stage to minimize the effects of this issue.
Generic control patch calculations. In addition to tessellation factors, the patch constant
function can also produce user-defined attributes that will be applied to all tessellated
points from the current control patch. This means that any data that can be shared by all
5 Further details about paraboloid maps can be found in Chapter 13, "Multithreaded Samples."
Search WWH ::




Custom Search