Here’s a quick snapshot of a 3D scanned Kleenex box, as shown in Maya:
Comparing this to the previous sample, you can see that the actual surface seems quite a bit smoother. This is because how I am generating the geometry. In my last post, I was basically just dumping raw geometry out because I wanted to see something. For each leaf node in the tree, I was checking if there was an adjacent leaf node on each side. If there was no adjacent node, I’d put two triangles to plug/cover that side of the cube. If there was an adjacent node, I wouldn’t worry about putting anything there. This did create a watertight (manifold) 3D model, but the results were definitely very… chunky. Not quite what I was going for.
From the beginning, the goal has been to create a watertight 3D mesh. I originally was going to use marching cubes to do this, but it turns out that there’s a few problems with that. Because of the way that marching cubes works, it isn’t necessarily watertight. There’s been a few smart people that have figure out the issues with it, but it is still a pain in the butt.
One of the other alternatives is marching tetrahedrons. It works under the same basic principle as marching cubes, but divides each cube into 6 tetrahedrons. The look-up table is considerably smaller, so in theory, it should be easier to implement. There are downsides to it though – it does generate a lot more geometry. Also, for whatever reason, I have yet to actually get it working properly. There’s still a few cases where the geometry isn’t produced with the correct winding order, meaning that some triangles are facing the wrong way. It also still doesn’t seem to produce a watertight mesh. Here’s a comparison of the way things are right now, with marching cubes on the left and marching tetrahedrons on the right:
The dark areas on the marching tetrahedrons are from triangles with a bad winding order.