Skip to content
ExtendedSource checked

Marching Cubes

Extracts a triangle surface from a 3D scalar field.

Quick Facts

Compact metadata for implementation and discovery.

Category
Rendering
Difficulty
Advanced
Family
Surface Extraction
Tier
Extended
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
3
Code example
Not ready
Visualization
Ready

Overview

Marching Cubes visits each grid cell, classifies its corners against an isovalue, and emits triangles from a lookup table.

Core Concepts

scalar field samplingisovalue thresholdingcorner bitmasklookup tableedge interpolationtriangle emissionrendered imagegeometric calculation

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(n)

Average

O(n)

Worst

O(n)

Space

O(n)

When to Use

  • Use Marching Cubes when you need to classify cube corners by an isovalue.
  • Use it for medical imaging with inputs like 3D scalar grid.
  • Use it when the scene representation and quality target match the rendering tradeoff.
  • Use it when the Surface Extraction tradeoff is acceptable for the problem size.

When Not to Use

  • Avoid it when the cost per pixel or sample is too high for the desired frame rate.
  • Avoid it when the required output is not triangle mesh.

What It Does

  • Classifies cube corners by an isovalue
  • Builds triangles that approximate the surface

Use Cases

  • Medical imaging
  • Voxel terrain
  • Implicit surface extraction

Inputs

  • 3D scalar grid
  • Isovalue

Outputs

  • Triangle mesh

Key Formulas (1)

Edge interpolation

p = p1 + ((iso − v1) / (v2 − v1)) · (p2 − p1)
p = p1 + ((iso - v1) / (v2 - v1)) * (p2 - p1)

Finds the approximate crossing point between two scalar samples.

Pseudocode

  1. 1.Visit each grid cube
  2. 2.Compare its corner values with the isovalue
  3. 3.Use the corner mask to look up triangle edges
  4. 4.Interpolate vertex positions
  5. 5.Emit triangles

Canonical Example

Input
scene = one triangle, one camera, one light
Output
image pixels showing the visible triangle
Explanation
Marching Cubes: The algorithm converts scene data into visible pixel results.

Implementation Notes

  • Keep the input contract explicit: 3D scalar grid; Isovalue.
  • Use this step as the implementation spine: Visit each grid cube.
  • Then preserve the next state change: Compare its corner values with the isovalue.
  • Build tiny scenes with known geometry before testing complex materials or lighting.

Common Pitfalls

  • Ambiguous cases and normal generation need care for clean meshes.
  • Ignoring coordinate spaces, depth precision, or sampling noise while debugging image artifacts.
  • Returning triangle mesh without handling empty, invalid, or boundary inputs.

Interactive Mechanism Walkthrough

Spatial Primitive & Sweep-Line Canvas

Show a grid cube emitting triangles where a surface passes through it.

Marching Cubes mechanism walkthrough step 1 of 5
Step 1 of 5: Visit each grid cube
voxel-surface

Notes

Marching Cubes operates in O(n) time and O(n) space within the Surface Extraction family. Key governing relation: p = p1 + ((iso - v1) / (v2 - v1)) * (p2 - p1). Often compared with Ray Marching and Sphere Tracing.

Sources (1)

What each reference supports for this entry.

Lorensen and Cline 1987

Paper

Original paper introducing Marching Cubes for isosurface extraction from volumetric data.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Generated meshes often use interpolation across cell edges.

Conceptual neighborMarching Squares

Marching Cubes extends the contouring idea to 3D isosurfaces.

Related Algorithms

Tags

GraphicsSurface ExtractionGeometry