Skip to content
Header only mesh voxelizer in c99
C C++ Makefile
Branch: master
Clone or download
karimnaaji Merge pull request #8 from mgerhardy/master
Fixed warnings and memory leak
Latest commit f2a99ff Dec 6, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
example Default to both options Dec 10, 2016
images Hi Feb 19, 2016
.gitignore Hi Feb 19, 2016 Hi Feb 19, 2016
voxelizer.h Fixed warnings and memory leak Dec 6, 2018

Mesh voxelizer

Header only mesh voxelizer in ANSI C


Converts meshes and performs triangle-cube intersection to output a voxelized mesh.

How to use

Include the header only file as following once:

#include "voxelizer.h"

To generate a voxelized mesh, create an instance of vx_mesh_t and initialize its vertices and indices like this:

vx_mesh_t* mesh;
vx_mesh_t* result;

mesh = vx_mesh_alloc(nvertices, nindices);

// Add vertices and indices from the original mesh you want to voxelize
// [...]

// Precision factor to reduce "holes" artifact
float precision = 0.01;

// Run voxelization
result = vx_voxelize(mesh, 0.025, 0.025, 0.025, precision);



  • Colorized output mesh (from input mesh)
  • Hidden voxel removal
  • Triangle face merging
  • Option for input triangle ordering (right now only supports GL_TRIANGLES indexed triangles)
  • Option for output format
You can’t perform that action at this time.