Dual contouring converts a signed distance function (SDF) into a boundary representation: line segments for a 2D contour or triangles for a 3D surface. It is useful when an SDF has made Boolean operations, offsets, hollowing, interpolation, or mesh repair easier, and the result must become a mesh again. section 11.3 section 11.7
Start by sampling the SDF on a grid. A sign change across a grid edge means the desired contour crosses that edge. Instead of placing the contour directly on cell borders, dual contouring connects points belonging to neighboring cells. Finer grids produce a closer approximation, but require more memory and processing. section 11.3.2 section 11.3.4
The first version of those points is simply the cell centers. Dual contouring then moves each cell’s point toward a position that better fits the modeled curve or surface. SDF values indicate distance from the boundary; derivatives and gradients supply geometric direction for fitting the point. The resulting connections follow the boundary more closely than center-to-center segments. section 11.3.2
Figure 11.23 Dual contouring runs line segments not from cell centers but from a point in a cell that fits the modeled curve best to the same optimum point in a neighboring cell.
Each active cell contributes a fitted point, and neighboring fitted points are connected across sign-changing edges. This is the practical meaning of the algorithm’s dual layout. section 11.3.2
Choose dual contouring with its trade-offs in mind:
- Prefer it when preserving sharp features matters; it generally retains them better than marching cubes. section 11.3.4
- Use a finer grid only when the added accuracy justifies the larger model and higher computational cost. section 11.3.2 section 11.3.4
- Treat the distinction as a practical tendency, not an absolute rule: implementations can add sharp-feature restoration to marching cubes or improve dual contouring for smooth surfaces. section 11.3.4
Repairing or offsetting an imperfect mesh
Convert a problematic triangle mesh to an SDF, perform an approximate operation such as closing gaps, restoring interpolated geometry, or making an offset, then extract a triangle mesh with dual contouring. The conversion is not exact, but it can be more workable than performing difficult operations directly on a large mesh. section 11.3 section 11.3.4
