Skip to content

-sa option in gltfpack causes texture mapping issues after simplification #866

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
Yeah-Zi opened this issue Apr 7, 2025 · 3 comments
Closed

Comments

@Yeah-Zi
Copy link

Yeah-Zi commented Apr 7, 2025

When simplifying a model using the gltfpack tool, enabling the -sa (simplify attributes) parameter causes texture mapping to become incorrect or distorted. The UV coordinates appear to be mismatched or improperly preserved, leading to visible artifacts on the model's surface.

before simplify:
Image

after simplify:
Image

I’d appreciate any suggestions or guidance on how to address this issue

@Yeah-Zi Yeah-Zi added the bug label Apr 7, 2025
@Yeah-Zi
Copy link
Author

Yeah-Zi commented Apr 7, 2025

Here is a sample glTF file for testing purposes.
Gltf.zip

@zeux
Copy link
Owner

zeux commented Apr 7, 2025

-sa stands for “aggressive simplification” and has these artifacts by design. You’re looking for -sv. This naming is not ideal but -sa was introduced long before attribute simplification, so the name had to be preserved.

@zeux
Copy link
Owner

zeux commented Apr 7, 2025

Looking at the model, it doesn't seem to be UV mapped properly, while the texture contains reasonable parts of the buildings, they are mapped in a strange manner with overlaps between shells and such. The default simplification mode thus mostly refuses to simplify this because any changes in topology would break the texturing, and using aggressive simplification breaks the texturing. So I think even modulo the settings confusion, this is more or less expected behavior. Some future improvements to aggressive simplification are tracked in #71, but I'm not sure to what extent they will help here and when I'll have time to look into that one.

Image

Image

Image

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

No branches or pull requests

2 participants