In this recipe, we will perform tessellation upon a triangle and a quad patch. We will create the hull and domain shaders that are necessary to use the triangle and quad tessellation domains, respectively.
As the fixed function tessellation stage is used to define new vertices, it is necessary to move some of the vertex shader code into the applicable domain shader, such as applying the
ViewProjection matrix and calculating the interpolated vertex normal and texture coordinates.
We will update the
CommonTess.hlsl shader code to perform barycentric interpolation, to calculate the attributes for new vertices in a triangle domain, and bilinear interpolation to interpolate between the four attributes within the quad domain.
We will continue from the previous recipe, Preparing the vertex shader and buffers for tessellation.
For this recipe, we will also re-use the triangle and quad renderers from the recipe Rendering primitives in Chapter 2, Rendering...