Introduction
Isosurfacing is a method to extract the surface from a three-dimensional scalar field. A scalar field assigns a scalar value to every point in three-dimensional space. When every point in the domain sits on a regular (i.e., uniform) three-dimensional grid, the scalar field is a voxel field.
The simplest non-trivial voxel field takes only two integer values, 0
and 1. A 0 marks a point outside the field. A 1 marks a point inside
it, or on its boundary. The interface between 0 and 1 everywhere in the
grid is the field's isosurface.
Real segmentations are rarely binary. A material segmentation typically
assigns a distinct positive integer label to each material, with 0
reserved for void. The isosurface generalizes directly: it is the
interface wherever any two labels differ, not only where a label meets
void. automesh already works this way — mesh tri
produces isosurfaces of the material boundaries, plural, and the
cuberille implementation below emits a face wherever two face-adjacent
voxels' labels differ, whichever two labels they are. Any isosurfacing
method in automesh needs to preserve that: a method that only finds
the outer material/void boundary would be a regression, not an upgrade.
See Marching Cubes for how
Marching Cubes stands on this.
Three approaches, not two
Marching Cubes and Dual Contouring are the two isosurfacing algorithms
most often cited in the literature, covered in detail on the next two pages.
But a third, older approach exists, and it is the default in automesh.
Cuberille: the mesh tri default
By default, automesh mesh tri (--cubes cuberille) builds its output
surface by walking the grid once. For every pair of face-adjacent voxels
whose labels differ, the algorithm emits a quad face exactly on the voxel
boundary between them — no interpolation, no gradient information.
Each quad splits into two triangles, coincident vertices weld together, and
any resulting non-manifold "pinch" vertex is duplicated to restore a clean
2-manifold. The result is the exact voxel-boundary surface: axis-aligned,
stair-stepped, and topologically faithful to the segmentation it came from.
This is the cuberille method, first described by Herman and Liu1 in 1979 for reconstructing 3D organ surfaces from CT slices. It predates both Marching Cubes (1987) and Dual Contouring (2002).
Why it matters for mesh tri
Cuberille's stair-stepping is why cuberille output is typically smoothed
afterward — mesh tri smooth chains Laplace or Taubin smoothing directly
onto it, and mesh tri smooth remesh can follow that with remeshing. The
voxel-boundary surface is a faithful but blocky starting point. With
cuberille, smoothing, not the isosurfacing step itself, produces a
visually smooth result.
Marching Cubes and Dual Contouring take the opposite approach: both
interpolate a smoother surface during extraction, at the cost of losing
the guarantee that every output vertex sits exactly on a voxel boundary.
Marching Cubes interpolates along voxel edges. Dual
Contouring places a vertex inside each voxel, using
gradient information to better preserve sharp features. Marching Cubes is
available through mesh tri --cubes marching. automesh does not implement
Dual Contouring.