Marching Cubes
- Category: Sensing › 3D maps & reconstruction
- Tags: mesh-extraction, 3d-reconstruction, geometry, mapping, isosurface
An algorithm that extracts a triangle mesh of a surface from a 3D grid of scalar values, such as a signed distance field, by processing the grid one cube at a time.
Definition
Marching cubes turns a volumetric scalar field into a polygon mesh of one of its level sets, called the isosurface. William Lorensen and Harvey Cline published it at SIGGRAPH in 1987 for building surfaces from medical scans such as CT and MRI. It is now the standard way to get a mesh out of a truncated signed distance field (TSDF) map, an occupancy grid or a neural field.
The algorithm visits each cube formed by eight neighboring grid samples. Each corner is classified as inside or outside by comparing its value with the iso-level, which is zero for a signed distance field. Eight binary corners give 256 configurations, which symmetry reduces to a small set of base cases (15 in the original paper); a lookup table then says which cube edges the surface crosses and how to join the crossings into triangles. The position of each vertex along a crossed edge is found by linear interpolation between the two corner values, so vertices are placed more finely than the grid spacing. Surface normals are usually taken from the gradient of the field.
The method has known limitations. Some corner configurations are ambiguous, and the original case table can leave holes between neighboring cubes; later variants such as the asymptotic decider and Marching Cubes 33, or the related marching tetrahedra, resolve this. Sharp edges and corners are rounded off, which is why dual contouring and similar methods, which use gradient information, are preferred when sharp features matter. Mesh detail and size follow the grid resolution: for a neural field, the network must first be evaluated on a dense grid, and the resulting mesh can be no more detailed than that grid.
Why it matters
Mapping systems and learned scene models store geometry as fields, while visualization tools, physics engines, collision checkers and CAD software expect meshes. Marching cubes is the usual bridge between the two, so its resolution and artifacts directly shape the meshes that robots plan and simulate with.
Key applications
- Extracting meshes from TSDF maps in dense RGB-D and lidar mapping
- Turning neural signed distance or occupancy fields into meshes
- Building collision meshes for simulation from 3D scans
- Evaluating reconstruction quality against ground-truth meshes
- Surface reconstruction from medical and industrial volume scans
In practice
A team running dense mapping on a mobile robot fuses depth camera frames into a TSDF with a voxel size of a few centimeters. Rather than re-meshing the whole map after every frame, they run marching cubes only on blocks whose values changed, and stream the resulting mesh to a visualization tool for the operator. At the end of a session the full mesh is extracted, simplified with mesh decimation, and loaded into a simulator as a static collision mesh. Holes in the mesh usually point to unobserved space or truncation in the TSDF rather than to a fault in marching cubes itself.
Common misconceptions
- Marching cubes reconstructs a surface directly from raw points — it needs a scalar field on a grid; points must first be fused into a TSDF, occupancy grid or implicit function
- The mesh can be no more accurate than the voxel size — vertices are interpolated along cube edges, so placement is finer than the grid, although features smaller than a voxel are still lost
- Marching cubes always produces watertight meshes — the original case table has ambiguous cases that can leave holes, and the surface is open wherever the field is truncated or unobserved
- Sharp edges come out sharp — the method rounds corners; dual contouring and related methods are used when sharp features matter
Who should know this
- Perception engineers building dense 3D maps from depth sensors
- Simulation engineers creating collision meshes from scans
- Researchers working with neural implicit representations of geometry
Related technologies
- Truncated Signed Distance Field (TSDF)
- Dual Contouring
- Marching Tetrahedra
- KinectFusion
- Open3D
- scikit-image
Related terms
Related projects
- LingBot-Map: Streaming 3D reconstruction from one camera: pose and depth for every frame, live
- Cartographer: Google's real-time 2D and 3D SLAM system for multi-platform robotics
- OpenDroneMap: Open-source photogrammetry toolkit that turns drone images into maps and 3D models
- RTAB-Map: Versatile graph-based SLAM supporting RGB-D, stereo, and LiDAR with real-time operation
- pySLAM: Hybrid Python/C++ visual SLAM pipeline with classic and deep-learning front-ends
- LeGO-LOAM: Classic lightweight, ground-optimized lidar odometry and mapping baseline (IROS 2018)
Videos
- Coding Adventure: Marching Cubes: Sebastian Lague
- Mesh from Math - The basics of Marching Cubes: Deadlock