Remove duplicated vertices after 3D NavigationMesh bake #92181
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Removes duplicated vertices that may exist on shared polygon corners after a ReCast navigation mesh bake.
What this does reduce is processing and NavigationMesh resource memory footprint. This does not really change anything qualitywise for the pathfinding. The NavigationServer converted a NavigationMesh resource by polygon indices to a server native mesh anyway.
While working on editor tooling for navigation mesh I noticed that I got way more vertices handles than expected. This only happened with a ReCast baked navigation mesh in 3D but not with the 2D navigation mesh baking.
Turns out because ReCast has the vertices and indices per local polygon "group" and Godot combines all the local groups to just one navigation mesh that there are often a lot of duplicated vertices everytime polygon groups shared a vertex.
On a demo that has a lot of very large navigation mesh chunks this change nearly halved the total vertices count of the used NavigationMesh resources.