Game dev
Saved & recent

Marching cubes

Related terms: marching squares, isosurface, metaballs

Turns a field of values into a mesh. Space is divided into small cubes. Each corner is tested: inside the shape or outside? The pattern of the eight answers picks, from a table of 256 cases, which triangles go in that cube.

It produces smooth voxel terrain that can be dug into, blobby metaballs and liquid surfaces. The 2D version, shown here, is marching squares.

Further reading
William Lorensen and Harvey Cline: Marching Cubes
interpolated edge inside outside
The 2D version, marching squares, extracts a contour from a grid of samples. Each crossing is interpolated between samples with opposite signs.

View in the full Game dev collection