Graphics Reference
In-Depth Information
The integer and pow2 methods will increase the number of primitives generated based on
the current whole number or power of two respectively, while showing no change for the values
in between. Whereas the fractional_even and fractional_odd methods will show a
gradual increase of the tessellation level between the whole numbers—with odd numbers
starting from the outside edges and even the center. As more or less geometry is generated
with changes in the tessellation factor, integer and pow2 will show popping geometry, while
the fractional partitioning schemes can result in swimming geometry. These two behaviors are
important to consider while you are using dynamic levels of tessellation:
[partitioning("fractional_odd")]
The outputtopology attribute controls, whether the output primitive topology is a triangle
(clockwise or counter-clockwise), a point or a line, as shown in the following code snippet:
[outputtopology("triangle_cw")] // triangle clockwise
[outputtopology("triangle_ccw")] // triangle counter-clockwise
[outputtopology("point")] // point
[outputtopology("line")] // line
The outputcontrolpoints attribute value defines how many times the hull shader
will be called for each input patch. Each hull shader execution is passed an ID through the
SV_OutputControlPointID input semantic and the input patch, and it returns a single
control point. The complete list of control points for the primitive will be passed on to the
domain shader by the fixed function tessellator stage. This can be seen in the preceding
pipeline diagram. The last attribute, patchconstantfunc , tells the tessellator pipeline
which function is the counterpart of the hull shader. This function is required and is used
to define the edge and internal tessellation factors of the patch along with any other
patch attributes.
[patchconstantfunc("HS_TrianglesConstant")]
The body of our hull shader is simply retrieving the control point from the input patch and
passing this information to the result. By using the SV_OutputControlPointID parameter,
it is possible to load additional information for the control points from precalculated textures
or buffers.
The constant function of the hull shader patch must provide the tessellation factor for
the patch. In our example, this is a constant value that is provided in the perFrame
constant buffer.
 
Search WWH ::




Custom Search