Mesh Optimization

<< Click to Display Table of Contents >>

Navigation:  XStream® HDVR® SDK > Advanced Functionality > 3D Polygon Meshes >

Mesh Optimization

Previous pageReturn to chapter overviewNext page

C++ C++ Java Java .NET .NET

Summary

 

The XStream® HDVR® SDK provides tools for converting 3D volume data to polygon based mesh geometry. The algorithmic process for this conversion often produces meshes with very high polygon counts. These meshes may contain more geometry data than is necessary for an accurate and detailed representation of the region of interest in the volume data that has been converted to a mesh. The volume to mesh conversion process also produces meshes that may not be immediately compatible with 3D printing devices, which have specific compatibility requirements for input geometry. For these reasons, the XStream HDVR SDK includes utilities to optimize and simplify polygon meshes. This process results in a mesh that looks the same as or similar to the original mesh, but contains significantly fewer polygons.

 

MeshOptimizeFootPre

Mesh before optimization: 2.5 million triangles.

MeshOptimizeFootPost

Mesh after optimization: 715,000 triangles.

 

Mesh Optimization Techniques

 

Mesh optimization is performed by the IVertexCallListContext::Optimize() method. This method performs four different optimization tasks: connected set limitation, mesh simplification, mesh smoothing, and triangle flipping.

 

Mesh optimization is performed by the hdrcVertexCallListContext::optimize() method. This methods performs four different optimization tasks.These methods perform four different optimization tasks: connected set limitation, mesh simplification, mesh smoothing, and triangle flipping.

 

Connected Set Limitation

 

When converting a mesh to polygon geometry, there may be a significant amount of very small isolated bits of geometry scattered throughout the generated mesh data. This can result from noise in the original dataset, and/or transfer function settings that result in many small bits of matter being visualized in addition to the primary material or region of interest. Each of these disconnected bits of geometry is a single connected set. By optimizing the mesh to limit the number of connected sets that are part of the output mesh data, this extra geometric noise can be removed. A size percentage parameter is provided that determines the maximum set size to remove. For example, if this parameter is set to 10, then all sets containing fewer than 10% of the total triangle count will be removed.

 

Mesh Simplification

 

The algorithm that converts voxel based volume data to a polygon based mesh often produces meshes with very high polygon counts. These meshes may contain significantly more geometric data than is necessary to produce a visually accurate polygon mesh. The mesh optimization methods support an algorithm that will reduce the number of polygons comprising the mesh, while attempting to maintain the original mesh shape. A configuration parameter is provided to determine the percentage of simplification. For example, if this is set to 10, the 10% of the polygons in the mesh will be removed.

 

Mesh Smoothing

 

If desired, the optimization methods can be used to perform a smoothing pass on the exported mesh. This will smooth out bumps and sharp edges on the mesh. Configuration parameters are available to control when the smoothing is applied, how aggressive the algorithm is in applying smoothing to the mesh. Smoothing may be applied before and/or after a mesh simplification pass. An additional parameter is provided that determines the level of smoothing to be applied. This value ranges from 0 to 1, with 0 being no smoothing, and 1 being maximum smoothing.

 

Triangle Flipping

 

All meshes exported from volume data have outward facing triangles specified with counter-clockwise vertex winding order. This means that if the 'front' of a triangle is viewed, its vertices are defined in counter-clockwise order. The triangle flipping feature will reverse the vertex winding order, and surface normal, so the orientation of the triangle is reversed.

 

Mesh Optimization

 

The IVertexCallListContext::Optimize() method supports four different optimization methods: connected set limitation, mesh simplification, mesh smoothing, and triangle flipping. The IVertexCallListContext::Optimize() method takes eight input parameters. These parameters are described in the table below.

 

bCleanIslands

A boolean value that determines if disconnected sets are to be removed from the mesh.

islandPercentage

If bCleanIslands is true, this sets the percentage threshold for removal. For example, if this is set to 10, then all sets containing fewer than 10% of the total polygons will be removed.

bDecimate

A boolean value that determines if mesh decimation is to be applied.

decimatePercentage

If bDecimate is true, this sets teh percentage of size reduction. For example, if this is set to 50, then 50% of the polygons will be removed.

bSmoothBefore

A boolean value that determines if smoothing is to be applied to the mesh before a decimation pass.

bSmoothAfter

A boolean value that determines if smoothing is to be applied to the mesh after a decimation pass.

smoothParam

If either bSmoothBefore or bSmoothAfter is true, this sets the amount of smoothing to be applied. If set to 0, then no smoothing is applied, if set to 1 then maximum smoothing is applied.

bFlip

If bFlip is set to true, then the orientation of all triangles in the mesh are reversed. This is done by switching the vertex winding order, and recalculating each vertex orientation normal.

 

// Extract mesh geometry

pPolygonUtil->ExtractPolygons(pVertexCallList, &polyExtractParams, pVolumeDataContext, pOctreeContext);

 

// Perform mesh optimization pass.

pVertexCallList->Optimize(true, 10, true, 50, false, true, 0.25, false);

 

The hdrcVertexCallListContext::optimize() method method supports four different optimization methods: connected set limitation, mesh simplification, mesh smoothing, and triangle flipping. The hdrcVertexCallListContext::optimize() method takes eight input parameters. These parameters are described in the table below.

 

bCleanIslands

A boolean value that determines if disconnected sets are to be removed from the mesh.

islandPercentage

If bCleanIslands is true, this sets the percentage threshold for removal. For example, if this is set to 10, then all sets containing fewer than 10% of the total polygons will be removed.

bDecimate

A boolean value that determines if mesh decimation is to be applied.

decimatePercentage

If bDecimate is true, this sets the percentage of size reduction. For example, if this is set to 50, then 50% of the polygons will be removed.

bSmoothBefore

A boolean value that determines if smoothing is to be applied to the mesh before a decimation pass.

bSmoothAfter

A boolean value that determines if smoothing is to be applied to the mesh after a decimation pass.

smoothParam

If either bSmoothBefore or bSmoothAfter is true, this sets the amount of smoothing to be applied, in the range of 0 to 1. If set to 0, then no smoothing is applied, if set to 1 then maximum smoothing is applied.

bFlip

If bFlip is set to true, then the orientation of all triangles in the mesh are reversed. This is done by switching the vertex winding order, and recalculating each vertex orientation normal.

 

// Extract mesh geometry

polygonUtil.extractPolygons(vertexCallList, polyExtractParams, volumeDataContext, octreeContext);

 

// Perform mesh optimization pass.

vertexCallList.optimize(true, 10, true, 50, false, true, 0.25, false);