Open dougbinks opened 2 years ago
Interesting, I hadn't noticed this, but thanks for filing it. I expect it is just MV export order that has changed here, but I will try do some A/B tests on 150 versus 200 files soon. Thanks again!
Hey Doug, so I just resaved the same scene from 2 different versions of magicavoxel: 1) MagicaVoxel-0.99.5.0.1-alpha 2) MagicaVoxel-0.99.7.0
I've confirmed that the above write file version 150 / 200 respectively, and that when ogt_vox loads the scenes (with group flag or without), version 200 shows instances in reversed order with respect to version 150.
ogt_vox doesn't really do anything different depending on file version -- basically it creates instances in the same order in which DAG chunks were emitted in the file, so this must be a change in MV itself.
Hopefully we can find an elegant solution here.
Thanks for the response!
I think the easiest first step for file reading is to store the file version in the ogt_vox_scene
structure and document the index order differences.
However currently it looks like ogt_vox_write_scene
is hardcoded to version 150 so reading a version 200 file and writing it back out would have the wrong index order, so some code changes would be required there.
would be another perfect match for the context discussion - adding the target version here.
I'm not sure this needs a context, perhaps just a flag to invert order depending on version.
As mentioned in my earlier post the minimum would be to store the version as part of the scene (I think this should be done anyway), and have a note about the order somewhere in the documentation and comments.
In MV vox files the instance order is important for the correct rendering of overlapping voxels. The first instance will 'replace' voxels in later instances. This instance order applies to groups and within groups.
Currently it seems that the instance order read by ogt_vox for version 200 files is inverted with respect to version 150 files. I haven't yet looked into whether this is ogt_vox or the actual file order.
My quick fix was to add a read for the version and switch order (extra note: it could be useful if the version was stored as part of the scene). I will look into this issue in more depth soon.