Graphics Reference
In-Depth Information
The advantage of multiple meshes over a single mesh is that adjusting LoD is
more efficient. The performance load of changing LoD is directly proportional
to the difference in complexity (represented by vertex count in this sample).
Simplifying a mesh by reducing the number of vertices by 10 takes less time than
reducing the vertex count by 100. That is why this sample achieves better perfor-
mance by trimming several progressive meshes, each of which covers a smaller
LoD range.
A.4 TESSELLATION SAMPLE *
This sample demonstrates mesh tessellation in Microsoft Direct3D. Mesh tessel-
lation subdivides mesh triangles to yield a mesh with finer geometry details that
produces better results even with per-vertex lighting. Mesh tessellation is often used
to implement LoD where meshes closer to the viewer are rendered with more details
and more distant meshes are rendered with less detail.
A.5 HOW SAMPLE WORKS
The sample can run in one of two modes: hardware or software tessellation. The
user can set the tessellation level to different values and see how the mesh changes
in reaction to the level adjustment.
When running in hardware tessellation mode, the sample tessellates the mesh by
setting the Device.NPatchMode property that sets the number of tessellation seg-
ments into which the device will tessellate each mesh segment. For instance, speci-
fying 3.0 will cause each original segment in the input mesh to be tessellated into
three segments. Tessellation happens in real-time, after the mesh draw calls in the
render loop.
When running in software tessellation mode, the sample does not rely on the
hardware to handle on-the-fly tessellation. The sample must process the mesh and
obtain the desired detail level before rendering it. The code achieves this by calling
Mesh.TessellateNPatches to take an input mesh and a segment count and then output
another mesh that represents the tessellated version of the input mesh. The sample
can then render this tessellated mesh using any standard mechanism.
A.6 SAMPLES
//—————————————————————————————————————————————————————————————————————————
//Program modified by Gabriyel Wong from EnhancedMesh example from
//Microsoft DirectX 9 SDK
//Additional components added: network communication, tessellation and
//rendering quality controls.
//Author: Gabriyel Wong
//Original code copyrights Microsoft.
//—————————————————————————————————————————————————————————————————————————
* Documentation reproduced from Microsoft DirectX SDK 2009.
Search WWH ::




Custom Search