7.4. The Marching Cubes Algorithm

The Marching Cubes algorithm is used to create a surface from voxel data. We have already seen this above in the Surface Rendering videos.

The Marching cubes [Lorensen1987] was published in 1987. The core of the algorithm is explained in this following video.

This figure is the one shown in the video, to illustrate 3 of the 15 originally proposed cases.

3 Cases from The Marching Cubes Algorithm

Fig. 7.1 Three cases from the Marching Cubes Algorithm. Originally 15 cases proposed.

The original paper [Lorensen1987] shows 15 cases. This was expanded to 33 by E. V. Chernyaev, but the high level principal remains the same.

Here’s a simple example, shown in the above video, to illustrate how Marching Cubes can extract an iso-surface from a volume:

Have a play with it!

What’s going on?

  • Set radius to zero.

  • Imagine a cube of data in front of the camera. (e.g. 50 x 50 x 50)

  • Imagine the values go from zero in the middle to a maximum value (e.g. 100) at the end of the cube.

  • At some intermediary value (e.g. 50), we want to extract the surface.

  • The marching cubes algorithm will determine where to place the triangles to represent the surface.

  • More voxels gives higher resolution.

7.4.1. Marching Cubes Example

Here is another example. I believe it was originally generated from a CT scan. So, skin has a low value, and bone has a high value. As the iso-surface value is changed, the Marching Cubes algorithm is re-run, and a new surface is generated.

If we look at some code, we see that you don’t have to worry about points, and triangles, and array buffers. The VTK provided classes hide the detail.

VTK has a pipeline architecture, you connect things together in a pipeline, then connect your pipeline to a window, and the system renders the result.

7.4.2. Marching Cubes Video

Finally, this video by Sebastian Lague is very helpful:

and on Sebastian’s YouTube channel are many awesome videos about graphics and game development.