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

Question about BL16 index order #131

Open
norman784 opened this Issue Jan 4, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@norman784
Copy link

norman784 commented Jan 4, 2019

Hi, I'm writing a gox file parser and I've got with a strange behaviour (or maybe I'm doing something wrong while reading the BL16 colors).

image

Using as example the small tree generated by code, I got it rendered (or to be more precise exported as .obj) fliped, seems to be that the Z axis is the Y axis, I'm calculating the index like this x + y * size + size_cubed * z, tried to change the order but seems that the only way the mesh is generated as the original (except for the rotation) is using that.

I'm missing something? I readed the file specs and also tried to jump between the code but in some parts seems too obscure for someone not used to C and C++.

Regards

@guillaumechereau

This comment has been minimized.

Copy link
Owner

guillaumechereau commented Jan 5, 2019

You are correct that the voxels index in a BL16 block is: x + y * 16 + z * 16^2.
The colors are stored as 4 bytes: RGBA.

On a side note: at some point in the future I think I will update the gox format to use a binary json representation instead of my hand made format, so that it will be easier for people to implement parser and manipulation tools in other language.

@norman784

This comment has been minimized.

Copy link

norman784 commented Jan 6, 2019

It's weird that my implementation isn't reading it right then, will continue to debug and try to find what's going on. The transform contained in layer doesn't have any rotation information?

Will be cool to have it, did you have some ETA to have it or start working on it?

Edit: If you have some sort of curiosity about my library is written in rust and I just called it gox (isn't available yet as a crate because isn't ready yet), maybe you can take a look and give me some hints, tips or even check if something that you think I'm doing it wrong, tried to emulate the way you parse it but isn't as optimized as yours yet.

@guillaumechereau

This comment has been minimized.

Copy link
Owner

guillaumechereau commented Jan 6, 2019

The 'mat' attribute in the layer is a 4x4 matrix that encodes both a rotation and translation. Note that this is only used for special layers: normal mesh layers don't have an transformation applied.

This discussion makes me realize how easier the gox format could be. I really think I will update it at some point to be based around a json binary representation, something like amazon ion. The 'trick' I used of saving the blocks as png files is also not really needed I think.

@norman784

This comment has been minimized.

Copy link

norman784 commented Jan 6, 2019

How much changes requires to migrate from the current file format to binary json? I mean you don't need to change anything besides the save/load in gox.c?

@guillaumechereau

This comment has been minimized.

Copy link
Owner

guillaumechereau commented Jan 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment