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

simplifySloppy aggressively welds vertices causing issues for attribute discontinuities #71

Open
FreakTheMighty opened this issue Oct 24, 2019 · 3 comments

Comments

@FreakTheMighty
Copy link

When I use the aggressive option in gltfpack I find that the model shading looks off. This appears to be caused by the normal being a bit messy. Attached is a screen shot from the babylon.js viewer with normal preview turned on for one of the meshes (hence the beautiful rainbow).

Screen Shot 2019-10-24 at 3 00 30 PM

I'm not sure if this is an unavoidable artifact, or something that can be improved. Also, I realize the input model is already pretty sparse. Nonetheless, the vertex removals seem reasonable, if only the normals were better preserved.

Here's an example of the command I'm using. I've also attached the input and output GLBs I'm using.

gltfpack -i /tmp/input.glb -o /tmp/output.glb -si 0.8 -sa -v

Archive.zip

@FreakTheMighty FreakTheMighty changed the title Any way to improve normal when using aggressive simplification? Any way to improve normals when using aggressive simplification? Oct 24, 2019
@zeux
Copy link
Owner

zeux commented Oct 24, 2019

This is the current deficiency of the aggressive mode, or more specifically the sloppy simplifier. It does not preserve attribute discontinuities which causes issues like this. I have thoughts about improving this in the future but for now that’s expected.

@FreakTheMighty
Copy link
Author

Sounds good @zeux. Out of curiosity, would throwing out the normals and recalculating them after decimation work, or is the problem more complex than that?

@zeux
Copy link
Owner

zeux commented Oct 25, 2019

It would work as an option but this requires reindexing - it’s fine to do as part of gltfpack, but it doesn’t work with the simplifier interface. Additionally this doesn’t work for texture coordinates. So my hope is that this can be solved during simplification, but it’s certainly possible that that doesn’t work well enough and we’ll need to recompute normals and give up on UVs. Regular simplifier doesn’t have this issue but it respects the mesh topology which makes it get “stuck” on some models.

@zeux zeux changed the title Any way to improve normals when using aggressive simplification? simplifySloppy aggressively welds vertices causing issues for attribute discontinuities Dec 28, 2020
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