Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ogt_vox: instance order differences between file versions #40

Open
dougbinks opened this issue May 26, 2022 · 5 comments
Open

ogt_vox: instance order differences between file versions #40

dougbinks opened this issue May 26, 2022 · 5 comments

Comments

@dougbinks
Copy link
Collaborator

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.

@jpaver
Copy link
Owner

jpaver commented Jun 1, 2022

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!

@jpaver
Copy link
Owner

jpaver commented Jun 1, 2022

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.

@dougbinks
Copy link
Collaborator Author

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.

@mgerhardy
Copy link
Collaborator

would be another perfect match for the context discussion - adding the target version here.

@dougbinks
Copy link
Collaborator Author

dougbinks commented Jun 26, 2023

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.

Repository owner deleted a comment from micici Feb 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants