Closed unphased closed 4 years ago
Note I also found https://github.com/aiekick/MagicaVoxel_File_Writer which looks even more promising, however this code currently has missing dependencies and cannot be built.
@ephtracy Could you check if this .vox x12.vox.zip
(corresponding to the 2nd screenshot) really has any voxels on coordinates z=59 thru z=66?
Meanwhile, I did get @aiekick’s .vox writer c++ building after he gave me the missing dependencies, so I’ll be doing tests using that to see if it has the same issue, as well as post a link to my fork of it (since the build steps are nontrivial).
thanks
I also expect things to change soon since I’ve been seeing ephtracy’s recent tweets; especially when the max model size will be jumping up to 256^3. I do consider it at least somewhat likely that newer builds would be able to load “legacy” vox files though!
I'll reopen this issue if I continue to see it with @aiekick's .vox writer. If anyone wants the code you can find it here: https://github.com/unphased/MagicaVoxel_File_Writer
It already works for me for enormous generated scenes, so I'd be surprised if it also has issues within a single 126^3 model. I think the bug comes from the janky js that I posted above.
You could check out this: https://github.com/Eisenwave/voxel-io Or my code here: https://github.com/mgerhardy/engine/blob/master/src/modules/voxelformat/VoxFormat.cpp
I'm currently using .vox format writing code that I found here: https://codepen.io/quasimondo/pen/QjqZvV This has apparently also been mirrored here: https://github.com/chaojian-zhang/MagicaVoxelWriter
I took the code from the first link and hacked it into a functioning node.js script that I use with my intermediate format which is one voxel per line, with
where M is the material/palette index.
I am having kind of bad luck so far. At first I thought it was working great, but then I realized that there is some inconsistent behavior where sometimes the top few z-slices of my .vox export appear to just be missing, lopped off.
I'm currently using .vox files to debug a triangle-aabb collision routine I'm coding up, so I have some screenshots here to illustrate:
I'm highly confident that my files contain the full set of voxels, but somewhere there is either a bug in this MV build or in my shoddy node script that is causing some number of z-layers to go missing.
The node script contents:
In particular I'm scratching my head over this code:
this.vcount * 4 + 0x434
and I wonder if that is related.I will also note that I have done checks where layer z=156 is missing and should be there, and I look in my output format and it is indeed present. Not only that, but the calculation for the z size in the node script also correctly sets the boundary size in MV to that value, just the voxels don't appear.
The ability to have the beautiful renders has already been invaluable in allowing me to troubleshoot voxel based algorithms, and I can only see myself using MV more and more for voxel based software going forward. It will only add to this tool's influence for developers to be able to rapidly create .vox exporters!
I would really appreciate a more thorough documentation of the file format representation. In particular it would be useful to be able to reliably import arbitrarily sized scenes, whether or not we have to manually break them down into 126^3 or whatever size models.