maybe yr voxelizer has problems with holes
try this voxer: https://github.com/karimnaaji/voxelizer (only 1 header to include)
how to use:
//pseudo
#define VOXELIZER_IMPLEMENTATION
#include "voxelizer.h
vx_mesh_t* inputMesh = vx_mesh_alloc(num_verts, num_indices);
// Add vertices and indices from the original mesh you want to voxelize
into inputMesh
for (...)
{
inputMesh->vertices[0]->x,y,z .... = yourMesh[0]->verts
inputMesh->indices[0]->x,y,z .... = ...
...
// Precision factor to reduce "holes" artifact
float precision = 0.01f;
// Run voxelization
vx_mesh_t* outputMesh = vx_voxelize(inputMesh,
0.03f,
// this is voxel size in X axis
0.03f,
// size in y axis
0.03f,
// size in z
precision);
// WARNING: outputMesh can have more verts than inputMesh so alloc space for new mesh with outputMesh->nvertices,normals etc... then fill in
for (...)
{
yourNewMesh->verts[index] = outputMesh->vertices[index]
...
vx_mesh_free(output_mesh);
vx_mesh_free(input_mesh);
also it was written with ogl in mind, so verts winding may matter … I'll leave it for u as an exercise to work the verts winding out if u r using directx
See how it goes;
That's it … all the best ?