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

gltfpack: Preserve custom vertex attributes during optimization #529

Closed
FreakTheMighty opened this issue Jan 13, 2023 · 4 comments · Fixed by #568
Closed

gltfpack: Preserve custom vertex attributes during optimization #529

FreakTheMighty opened this issue Jan 13, 2023 · 4 comments · Fixed by #568

Comments

@FreakTheMighty
Copy link

FreakTheMighty commented Jan 13, 2023

It would be helpful to preserve custom attributes when using gltfpack. Currently, if I pass a glb in with a custom _ID vertex attribute, the resulting file has that attribute stripped. Instead, I'd like to see those attributes preserved, and when simplification is applied the indexes that survive simplification should be copied to the new model.

Attached are two glbs with custom _ID vertex attributes.

Archive.zip

@zeux
Copy link
Owner

zeux commented Jan 19, 2023

Yeah, I had a similar request related to _BATCHID from glTF files. gltfpack in general can't reasonably support completely custom attributes because it requires knowledge about the attribute meaning to be able to pack/compress/optimize it, however it feels very reasonable to support IDs specifically. I was planning on doing this as part of eventual support for EXT_mesh_features but there's probably no specific reason why it can't be done for ID attributes separately.

@zeux zeux added the gltfpack label Jan 19, 2023
@ru-imajion
Copy link

Potential patch for copying the ID attributes. 55d7092

@FreakTheMighty
Copy link
Author

@zeux I'm not entirely understanding why we can't generically handle vertex attributes - I'm probably missing something.

If a user has a custom vertex attribute of a specific type, I'd expect that whichever vertexes are removed, the corresponding indexes for that attribute would also be removed. Is it more complicated than that?

@zeux
Copy link
Owner

zeux commented Jan 20, 2023

It's not about copying or removal, it's about whether to preserve the type, how to encode the attribute and which compression filters to use, and how/whether to modify the attribute under various transformations. gltfpack performs a full scene reassembly so it ideally needs to know the semantics behind every component of the scene to perform it correctly and optimally. It's possible to encode every attribute as vec4 of floats with no compression, but that defeats the purpose of using gltfpack and may still misbehave under certain transformations like mesh merging depending on what the attribute means.

@zeux zeux changed the title Preserve custom attributes during optimization gltfpack: Preserve custom vertex attributes during optimization Mar 5, 2023
@zeux zeux closed this as completed in #568 Jun 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants