Graphics Reference
In-Depth Information
Although it is possible to provide multiple tessellation factors (left, right, top, and bottom,
depending on the domain), we are providing a constant tessellation factor across all the
edges by casting
TessellationFactor
float
to a
float3
for
tri
domain or
float4
for the
quad
domain. We use the built-in HLSL functions to round the tessellation factor.
This ensures that the values used for the inside and outside edges are correct for the
specified
partitioning
method.
ProcessTriTessFactorsMax((float3)TessellationFactor, 1.0,
roundedEdgeTessFactor, roundedInsideTessFactor,
insideTessFactor);
Process2DQuadTessFactorsMax((float4)TessellationFactor, 1.0,
roundedEdgeTessFactor, roundedInsideTessFactor,
insideTessFactor);
The last part of the hull shader constant function returns data to be shared across all the
control points of the patch. The maximum number of outputs supported for a structure
involved in the tessellation pipeline is 32
float4
properties, allowing a total of 1024 bytes
per patch (remember that the structure will be padded to 16 bytes). Generally the amount of
information should be kept to a minimum, and it may be necessary to use buffers or texture
sampling to load additional data.
The domain shader is called for each newly created output control point in each patch by the
fixed function tessellator stage. This shader is responsible for generating appropriate texture
coordinates, and so on, across the newly created geometry. The result is then output to the
pixel shader.
Our two renderers use two different interpolation techniques: barycentric interpolation
(for the
tri
domain), and bilinear interpolation (for the
quad
domain with four control points).
There's moreā¦
Controlling the tessellation factors for individual outside and inside edges within the hull
shader constant function is especially useful while performing screen adaptive tessellation.
This form of adaptive tessellation determines the tessellation factor for an edge based upon
the length of the edge within screen space.
See also
We cover culling of primitives within the tessellation pipeline in the recipe,
Optimizing
tessellation through back-face culling and dynamic Level-of-Detail
, later in this chapter.