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

How to check if a nTRN chunk is a duplicate of geometry? #46

Open
capslpop opened this issue Oct 3, 2021 · 1 comment
Open

How to check if a nTRN chunk is a duplicate of geometry? #46

capslpop opened this issue Oct 3, 2021 · 1 comment

Comments

@capslpop
Copy link

capslpop commented Oct 3, 2021

The way I have the .vox reader set up is that it reads each object in as a texture. Then it reads the position and rotation of the object in the nTRN chunk. However, since the objects that are stored in the XYZI chunks are not duplicated then how do you know which object the nTRN data belongs to?

I assume that happens in the nGRP or the LAYR chunk but after testing the output of both the chunks I can't find anything that correlates to the object reference. Or does that not exist?

@spaarmann
Copy link

To parse general .vox files, you need to construct the scene graph from the nTRN, nGRP, and nSHP chunks. Each instance of one of these chunks defines one element in the tree scene hierarchy with an ID. A nGRP node can have many children (identified by their ID), an nTRN node has exactly one child and transform information, and an nSHP node has no children and defines where a model is placed in the hierarchy. The nSHP node contains an extra ID that identifies the model it represents (model IDs are assigned sequentially: the first (SIZE + ) XYZI chunk has ID 0, the next ID 1, etc.).

To find the effective transform information of a given model, you need its corresponding nSHP node and the whole scene hierarchy above it (because it can be affected my multiple nTRN nodes).

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

2 participants