Skip to content

gltfpack needs too much memory/time to parse models with redundant accessors #884

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

Closed
Alluofuyo opened this issue May 9, 2025 · 3 comments · Fixed by #885
Closed

gltfpack needs too much memory/time to parse models with redundant accessors #884

Alluofuyo opened this issue May 9, 2025 · 3 comments · Fixed by #885

Comments

@Alluofuyo
Copy link

When I use gltfpack to optimize this file, it failed:

Image

Image

Image

download model here

How to avoid this?
Should I optimize the model during creating?

@Alluofuyo Alluofuyo added the bug label May 9, 2025
@zeux
Copy link
Owner

zeux commented May 9, 2025

That’s a peculiar mesh; do you know what program produced it?

It uses the same, very large, accessor for all positions, and lots of tiny index buffers for each individual object. gltfpack reads each mesh from the source file as a standalone object so it duplicates a very large redundant vertex buffer for each mesh. This would need to be adjusted for this type of asset to load quickly.

Adding the mesh as attachment just in case we need it in the future for profiling.
triangle5.glb.zip

@zeux zeux added the gltfpack label May 9, 2025
@zeux zeux changed the title gltfpack allocate large memory ( 20+GB ) to parse ~70 Mb glb model and throw bad alloc exception. gltfpack needs too much memory/time to parse models with redundant accessors May 9, 2025
@Alluofuyo
Copy link
Author

I exported the model from a BIM software. Every component of the building can be selected standalone and reflects the structure's information, so that's very special.

@Alluofuyo
Copy link
Author

Splendid!

I have optimized the model successfully by updating the codes. It looks like all components using the same material are merged to an entirety. But that's OK, I'll maintain an octree in the memory so that user can select one component.

Thanks a lot for your work!

@zeux zeux closed this as completed in #885 May 12, 2025
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.

2 participants