IAM

Check out our latest research on weakly-supervised 3D shape completion.

ARTICLE

Mesh Voxelization into Occupancy Grids and Signed Distance Functions

Triangular meshes are commonly used to represent various shapes in computer graphics and computer vision. However, for various deep learning techniques, triangular meshes are not well suited. Therefore, meshes are commonly voxelized into occupancy grids or signed distance functions. This article presents a C++ tool allowing efficient voxelization of (watertight) meshes.

Mesh voxelization is a common problem in 3D vision as triangular meshes are not a suitable shape representation for many algorithms. In deep learning, in particular, occupancy grids and signed distance functions are commonly preferred. Both are defined as dense volumes; for occupancy grids (see Figure 1), each element indicates whether the corresponding voxel is occupied or not — for signed distance functions, each element holds the distance to the nearest surface and the sign is used to distinguish inside and outside. In contrast to occupancy grids, signed distance functions allow to easily reconstruct meshes using marching cubes [].

Figure 1 (click to enlarge): Visualizations of the derived occupancy grid and signed distance function for one of the included example from ModelNet [].

As part of my master thesis, I implemented a simple but efficient C++ tool for voxelizing watertight meshes into occupancy grids and/or signed distance functions. Here, watertight refers to one, closed surface — this is necessary to reliably determine occupancy. The tool can be found on GitHub:.

Mesh Voxelization on GitHub

The repository also includes Python tools for running marching cubes and several utilities to convert the involved file formats — namely HDF5 files for storing voxelized meshes, and OFF or OBJ files for storing triangular meshes. The results can then be visualized using MeshLab as shown in Figure 1.

The tool is based on:

  • [] William E. Lorensen and Harvey E. Cline. 1987. Marching cubes: A high resolution 3D surface construction algorithm. SIGGRAPH Comput. Graph. 21, 4 (August 1987), 163-169. DOI: https://doi.org/10.1145/37402.37422.
  • [] Z. Wu, S. Song, A. Khosla, F. Yu, L. Zhang, X. Tang and J. Xiao. 3D ShapeNets: A Deep Representation for Volumetric Shapes. CVPR2015..

What is your opinion on this article? Did you find it interesting or useful? Let me know your thoughts in the comments below or get in touch with me:

@david_stutz