Graphics Reference
In-Depth Information
Unfortunately, the general solution suffers because it can cause many triangles to
share many different normal vectors. Figure 9.46 shows an example of corner geometry
that first appeared in Figure 9.43. This has three triangles sharing the same position in-
formation at the corner, but each triangle requires a different normal vector to accurately
represent the intended shape.
There are increasingly complex variations upon this algorithm, depending entirely on
how strictly a sharp edge should be honored. At its most complex, a software implementa-
tion of the Curved Point Normal triangles implementation can be used to generate inter-
mediary triangles that closely match the surface and control points that would otherwise be
generated by the GPU.
While this does solve the problem, it is not an ideal solution, partly because it is non-
trivial to implement, but mainly because it breaks the original goal of not having to modify
the original geometry.
Back-Face Culling in the Hull Shader
Culling of primitives facing away from the viewer is a classic staple of computer graphics.
Modern hardware pipelines will still perform this step (subject to pipeline configuration by
the application), and it is largely transparent and oft ignored.
This is interesting with regard to tessellation, due to the ability to amplify geometry
(geometry shaders are also interesting for the same reason). With the pipeline configuration
used thus far in this chapter, back-face culling will occur before rasterization, exactly as
expected, but it is crucial that this is after tessellation has occurred.
Simply put, the hardware may have generated hundreds, if not thousands, of new tri-
angles, only to have them be rejected without making any contribution to the final rendered
image. In a high-performance scenario, this wasteful processing is obviously undesirable.
It would be far better if it could be avoided entirely.
Direct3D 11 hull shaders do allow this, and before any amplification or complex pro-
cessing, it is possible to reject an entire patch and cease further processing. Implementing
the check to determine if a patch is back facing is the responsibility of the hull shader au-
thor, and while this check for a triangle is trivial, it may not be so simple for all tessellation
algorithms.
The developer needs to consider the final tessellated output and the possibility that
the eventual surface may actually contain elements that aren't entirely back facing. In the
context of Curved Point Normal Triangles, the final surface remains relatively close to the
underlying control mesh, making this optimization possible.
HS_CONSTANT_DATA_OUTPUT hsConstantFunc( InputPatch<VS_OUTPUT, 3> ip, uint
PatchID : SV_PrimitiveID )
{
HS_CONSTANT_DATA_OUTPUT output;
Search WWH ::




Custom Search