Game Development Reference
In-Depth Information
those simplification operations. Figure 11.2 shows a mesh at three dif-
ferent levels of detail (LOD): high, medium, and low.
Figure 11.2: A mesh shown at three different resolutions
The idea of progressive meshes is analogous to using mipmaps for tex-
tures. When texturing, we noticed that it was wasteful to use a
high-resolution texture for a small, far-away primitive where the extra
detail would go unnoticed. The same goes for meshes; a small, far-away
mesh does not need as high a triangle count as a large, close-up mesh
because the extra triangle detail for the small mesh would go unno-
ticed. Thus, we would end up spending time rendering a high triangle
count model when a simpler low triangle count model would suffice.
One way that we can use progressive meshes is to adjust the LOD
of a mesh based on its distance from the camera. That is, as the dis-
tance decreases, we would add detail (triangles) to the mesh, and as the
distance increased we would remove detail.
Note that we do not discuss how progressive meshes can be imple-
mented; rather we show how to use the ID3DXPMesh interface. For
those readers interested in the implementation details, you can find the
original progressive mesh papers at Hugues Hoppe's web site:
http://research.microsoft.com/~hoppe/.
11.3.1 Generating a Progressive Mesh
We can create an ID3DXPMesh object using the following function:
HRESULT D3DXGeneratePMesh(
LPD3DXMESH pMesh,
CONST DWORD *pAdjacency,
CONST LPD3DXATTRIBUTEWEIGHTS pVertexAttributeWeights,
CONST FLOAT *pVertexWeights,
DWORD MinValue,
DWORD Options,
LPD3DXPMESH *ppPMesh
);
pMesh —An input mesh that contains the data of the mesh from
which we want to generate a progressive mesh
Search WWH ::




Custom Search