Destructible Sphere Using Marching Cubes
Cal Poly – Dr. Wood
For my final project I created a destructible sphere using the Marching Cubes Algorithm.
b : launches a bullet from the current camera position
[ : Scales the larger sphere larger
] : Scales the larger sphere smaller
q : Rotate View Down
z : Rotate View Up
wasd : used for moving through environment
n : Increase cubes
m : Decrease cubes
c : Display Cubes
p : Randomly deform main sphere
'esc' : exit
Mouse is used to look around within scene.
Marching Cubes Summary
First the cubes are generated. Next for each cube corner the implicit equation of a sphere is used to determine if that corner is in or out of the sphere. The per cube binary code the previous step generates is used to look into a triangle table that specifies what geometry will exist within that cube.
I implemented a binary version of marching cubes. This allowed for easy manipulation of the cubes. One could also use scalar values at each cube corner in order to better interpolate edge intersections.
When a sphere is shot at the main sphere each of the vertexes that make the cubes that make up the main sphere are checked for collision. If there is collision the value at the corner is set to false.