Joel Shaffer's Marching Cubes

Marching Cube Algorithm Overview

• Read in all the data such that for any given point (x, y, z) there is an associated value
• Iterate over each point and construct a cube
• For the cube at each point check if the associated value is less than the specified ISO value
• If the value is less than the ISO, the cube intersects the surface at that point and a bit mask should be set for the specified vertex
• Now that each vertex is determined as either inside or outside the surface, determine where along the edges the surface intersects
• Edge intersections are determined using a linear interpolation between the points, utilizing the associated data and the ISO level
• Using the triangle table and the vertex bit mask set the coordinates for a triangle
• Calculate a surface normal for each triangle
• Once all triangle data has been determined, send the data to the vertext and fragment shaders for rasterization

My Code

• Aggregate data from 100+ image files into a single data source
• Create a 3D array representing the data
• Perform marching cubes algorithm to determine triangles
• Calculate surface normals for each triangle
• Use keyboard commands (WASD) and mouse (rotation) to move around the model