Tessellating a triangle and quad

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 ...

Get Direct3D Rendering Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.