Graphics Reference
In-Depth Information
Figure 9.8. Wireframe.
Figure 9.9. Solid.
This is just a simple Sobel operator on the heightmap, a useful trick that efficiently
generates acceptable normal vectors from a heightmap by using gradient detection. The
important detail to note is that this technique lets the domain shader generate normal vec-
tors in isolation, so that it does not need to be aware of any of its neighboring triangles
or the underlying surface. For a displacement-mapping algorithm, this is very useful and
greatly simplifies the implementation. Without this trick, the normal vectors would need to
be read from a matching texture (which could increase quality), or simple "face normals"
would need to be generated by the geometry shader.
The Result
The three steps shown above are all that is necessary to entirely implement Greg Snook's
interlocking tiles algorithm on a Direct3D 11 GPU. Figures 9.8 and 9.9 show examples of
the output, firstly in wireframe and secondly as a solid-shaded. The following is an analysis
of the results:
Resources:
• Vertex Buffer: 81 vertices, forming a 9x9 grid, requiring 1,620 bytes
• Index Buffer: 768 indices, with 12 for each of the 64 patches, requiring 1,536 bytes
• Texture: 64x64 32-bit texture, requiring 16,384 bytes
• Total storage: 19.1 KB
Rendering:
• 1 Drawlndexed() call
• 768 vertex shader invocations
Search WWH ::




Custom Search