Re-voxelizing a voxel mesh (Sorry for the length)

Feel free to ask any question here
Post Reply
justinL_cc
Posts: 2
Joined: Mon Sep 27, 2021 8:03 pm

Re-voxelizing a voxel mesh (Sorry for the length)

Post by justinL_cc »

Hey guys,

I've been spending over a month trying to find a way to solve a problem, but to no avail. Finally, after discovering CloudCompare, I feel like I'm closer than ever to finding a solution. I apologize in advance for the length of this topic post and I also thank you in advance for any guidance/tip/insight.

GOAL: Let's say I create a voxel mesh in MagicaVoxel, but instead of using MagicaVoxel/QuBicle (or any voxel editor) to texture the fine details of my voxel mesh, I want to texture it in a software that offers me greater and more flexible tools to texture my mesh (ex: in an aliased fashion with brushes and textures). Given this scenario, the end-goal would be to export the voxel mesh from MagicaVoxel as an OBJ and texture it in Cinema 4D (in my case), after which I would like (somehow) to export the textured OBJ mesh back to MagicaVoxel in its voxel state. Worth noting that between MagicaVoxel and Cinema 4D, no transformation would be made on the actual mesh. I'd only modifying and baking the UV map in Cinema 4D. So ideally, I would end up with an identical voxel mesh in MagicaVoxel as the one I originally started with, but with different color data for each voxel.

WHAT I'VE TRIED: I've been experimenting with tons of different softwares and librairies, such as BinVox, countless Voxelizers and misc. tools found on Github. The Voxelizer-route has always been more of a no-brainer, but unfortunately, I have not found 1 single publicly available Voxelizer that allows me to have fine control over the grid matrix, hence every attempt at using a Voxelizer so far has resulted in a non-identical (i.e. not a 1:1) recreation of my original voxel mesh from MagicaVoxel (i.e. offset voxels, missing voxels, etc).

BREAKTHROUGH: After so much trial and error, I've finally found a possible lead. Using MagicaVoxel, CloudCompare and FileToVox (https://github.com/Zarbuz/FileToVox), I could potentially achieve my goal.

A few things that I know for certain:
  1. MagicaVoxel has both the options to export your mesh as a "point clouds" OR "PLY mesh", which appear to be relevant for my case
  • FileToVox pretty much allows me to convert any point cloud or PLY mesh into a VOX file, which in theory seems like it'd be the solution, but, whatever point cloud I can generate from my voxel OBJ mesh in CloudCompare, once said point cloud has gone through FileVox, I am not able to get an identical 1:1 replica of the original voxel mesh I started with in MagicaVoxel. This could be due to CloudCompare's generated point cloud not being a perfect grid (using the "Sample points" function) and/or a failure of FileToVox's part.
Basically, if I end up going with the "point cloud" approach to solve my problem, I feel like my workflow would have to be: MagicaVoxel > Cinema 4D > CloudCompare > FileToVox > Back in MagicaVoxel. Unfortunately, because of the reasons detailed above, I'm unable to get a 1:1 result.

I think I'm gonna cut it there because this topic is getting way too long, but I wanted to make sure I would explain myself thoroughly.

At this point, any glimpse of help or guidance would be greatly appreciated, as I feel quite lost currently, despite feeling "close" in some ways.

Thanks a ton(!) in advance.
daniel
Site Admin
Posts: 7721
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Re-voxelizing a voxel mesh (Sorry for the length)

Post by daniel »

Sorry, I'm not sure how these voxel meshes work!

But definitely, the 'Mesh > Sample points' is not regular. It randomly generates points on the mesh (triangles) surface.

If you want a regular cloud, you'll need to play with the 'Edit > Octree > Resample' tool, or maybe the 'Tools > Sand box (research) > Distance map' tool (this one works directly on a mesh). Maybe in combination with some color interpolation between the various entities...

And then, I'm not sure what convention your tool uses for the voxel centers... Hopefully the voxel center.

These are really all random guesses :D
Daniel, CloudCompare admin
justinL_cc
Posts: 2
Joined: Mon Sep 27, 2021 8:03 pm

Re: Re-voxelizing a voxel mesh (Sorry for the length)

Post by justinL_cc »

Hey Daniel!

Thanks a ton for your insight. Truly. Your reply actually led me on a path that, for the time being, seems to have potential. I have no idea about the outcome just yet, but I'm excited to explore it.

I'll make sure to update this thread with any findings or related questions.

Thanks again!
Post Reply