Graphics Reference
In-Depth Information
providing a vector that is a combination of the triangle normal vectors that it is touching.
Displacement mapping can follow the same methodology by using the vertex normal vec-
tor. For each point on a triangle mesh being displaced, we read the displacement amount
from the displacement map and then shift the new vertex along its interpolated vertex
normal vector. This allows the displacement to be smoothly transitioned between triangle
faces. This is updated scheme shown in Figure 8.17.
8.3.2 Implementation Design
Once again, we will be able to use our previous implementation's pipeline configuration,
with just a few changes. Even though we will be passing lower-resolution model data into
the pipeline, the vertex skinning process is oblivious to this, except that the final projection
to clip space must be moved to later in the pipeline. Since we are still using skinning in the
same general way on our input vertices, the vertex layout and the vertex shader will remain
mostly the same. However, since we are using the tessellation stages, we must change our
input topology setting to indicate that we are using control patches instead of triangles.
In effect, there is no difference for our input buffers, since we will be using a three-point
control patch list, which is topologically the same as a triangle. However, the runtime will
require a patch list type as input to the hull shader, so we will make the change. Since we
will be using the tessellation stages to increase the resolution of our geometry, the hull
shader, tessellator, and domain shader all must be used, since they are used in conjunction.
Finally, the pixel shader will remain the same, to apply the color texture to the geometry
that is produced in the tessellation stages. The updated pipeline configuration is shown in
Figure 8.18.
With the vertex shader remaining the same except for the removal of the clip space
projection, the first new step to implementing our displacement-mapping addition is to con-
figure the hull shader to set up the tessellation process. The hull shader will receive skinned
vertices from the vertex shader and will interpret them as three point control patches. The
hull shader requires two different functions its main function, as well as a patch constant
function. Since the patch constant function is responsible for determining the tessellation
factors, we don't need to do anything in the hull shader. This lets us simply pass the hull
shader input control points as the output control points, which will also remain as three-
point control patches.
We will use the patch constant function to determine how finely we should split up
the input control patches, by specifying one edge-tessellation factor for each edge of the
triangle patch, plus a single tessellation factor for the interior portion of the triangle. Each
of the metrics discussed in our theory section could be used to determine the necessary
tessellation level, but we will restrict our patch constant function to using a fixed value for
the amount of tessellation. This fixed value is passed to the output of the patch constant
Search WWH ::




Custom Search