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

Utils.mergeVertices generates distinct hashes for nearby values within tolerance. #221

Open
closedcontour opened this issue Dec 21, 2023 · 1 comment

Comments

@closedcontour
Copy link

In the course of getting strange, very long paths, I found that Utils.mergeVertices isn't merging vertices within tolerance distance of each other:

image

This debugging image shows the navmesh with vertices randomly colored. The discontinuity shows up because nearby but distinct vertices aren't being merged.

Just before I hit the "Submit" button, I searched a bit more and found that this is just a manifestation of mrdoob/three.js#24621. It doesn't look like their mitigation was brought over. That said, I think I will use a rounding based approach before I hand over the BufferGeometry to three-pathfinding. All that said, I'm creating this issue in case anyone else runs into this.

Thank you for this and your other amazing three.js related libraries!

@donmccurdy
Copy link
Owner

Note that the newer implementation in three.js is not fully able to solve this situation either, though it does reduce the occurrences, see mrdoob/three.js#24621 (comment).

I've written a vertex merging implementation before that would avoid the issue entirely, I think, but it was very slow. I'm hesitant to drop that somewhat complex code into this project.

That said, I think I will use a rounding based approach before I hand over the BufferGeometry to three-pathfinding...

I think that's a great solution if it solves the problems for your meshes! Just note that you'll probably want to remove any vertex attributes other than position before doing this, so normals and UVs don't affect the merge.

I'd also be happy to review a PR upgrading Utils.mergeVertices to the newer approach in three.js, if that seems to be working better.

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

No branches or pull requests

2 participants