1
\$\begingroup\$

I've been trying to find the right workflow to solve my problem for over a month now. Any tip/insight would be greatly appreciated.

Scenario: I create a voxel mesh in MagicaVoxel and then, instead of using MagicaVoxel's limited tools/shaders to texture my mesh, I export my voxel mesh as an OBJ in my 3D software (Cinema 4D in my case) to texture it with bitmap-based textures and brushes. After I'm done texturing said OBJ mesh, without any change to its position/scale/rotation, I would like to export it back into MagicaVoxel (i.e. in its original voxel structure) for further sculpting/iterating.

What I've tried: I must have tried every free/paid Voxelizer out there that support color data (QuBicle, BinVox, a myriad of tools found on Github, etc) and none of them have allowed me to have control over the voxel grid matrix. This means that every Voxelizer I've tried has given me a .VOX mesh (as desired), but with tons of offset/misplaced/missing/added voxels, so not an identical 1:1 recreation of the voxel mesh I originally created in MagicaVoxel. I imagine this is due to the Voxelizer not knowing where every voxels' center is on the OBJ mesh, hence giving me a very imprecise result.

Potential lead: Thankfully, amongst many other exporting formats, MagicaVoxel allows me to export my voxel mesh as "PLY mesh" or "point clouds" data. I see a potential solution here, as I feel like I could use (for example) the point cloud data as a reference for what the voxel grid matrix should be. The question is; what software am I pumping this point cloud data into?

Conclusion: The closest I've gotten so far is feeding MagicaVoxel's point cloud data into CloudCompare and then feeding whatever I attempted (without success) in CloudCompare into FileToVox. Still... despite it all, I cannot get my newly textured OBJ mesh to be translated back into its 1:1 voxel state as a .VOX file.

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 million.

\$\endgroup\$
-1
\$\begingroup\$

I'd leave a comment, but I haven't the reputation points yet.

Check out: https://github.com/sjhalayka/point_to_mesh/blob/0e28b41e47e4d4d0bf2b2178a17cb0ad0b8dfccb/main.h#L308

It first finds the x, y, z extents of the point cloud, and then it finds an integer index for each x, y, z, where the final index is

size_t index = z_index * res * res;
index += y_index * res;
index += x_index;

Does this help at all?

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .