Skip to main content

3D Mesh Voxelization

Generating volumetric data from a three-dimensional surface.

This was my final degree project. By that point, I already had a strong interest in computation and graphics processing. At the time, I became particularly interested in volume representation in computer graphics, especially after I started reading the development diary of Dennis Gustafsson (Tuxedo Labs), where he showcased the development of the voxel engine used to create the video game Teardown, one of the most technically impressive games I have ever seen.

For this reason, I decided to work on something related to this topic, and I chose to build a tool that addressed the problem of volumetric entity generation. At least at that time, there were relatively few tools available for generating voxel-based structures. I thought the most straightforward approach for most use cases would be to start from a traditional surface created using classical modeling techniques, such as a standard polygonal mesh.

Demonstration of a mesh processed using the tool.

The Tool

I programmed the tool for the engine I was most familiar with at the time, which was Unity. The tool supports multiple configurations, such as independently defining the filling of different internal cavities, setting voxel depth (precision), and more. It also includes various debugging and visualization tools to inspect the results.

Final render

The tool as seen in the Unity version it was developed for

Final render

Stanford Bunny after applying the tool

The output of this tool is a group of voxels organized in an octree structure. In this case, I render it using a geometry shader over a point cloud in a naive and straightforward way, since rendering itself was not the focus of this project, but rather the generation of the volumetric data from a surface using geometry and the structure used to represent the information.

It is also possible to modify the voxel structure by adding or subtracting a spherical region of voxels defined by a center point and a given radius. However, I did not explore these techniques in much depth, as the main goal of the tool was to obtain the structures from the surface itself, rather than post-editing them.

You can consult a more exhaustive breakdown of the project development, as well as the specific techniques I used and their mathematical foundations, at the following link from the Jaume I University.

Voxel structure of the Stanford Bunny after subtracting a sphere at the marked position.

In the following video, you can see how the volumetric structure is generated from the Stanford Bunny using different configurations, also showcasing the debugging visualization tools.