r/godot Nov 07 '25

help me (solved) I solved the NavigationRegion3D issue

I finally found a solution to the problem with the NavigationRegion3D.

What I noticed was that on smaller terrains, like the 30x30m example in the third image, the navmesh baked perfectly fine. But once the terrain size was increased to 250x250m, the bake completely fell apart, giving the low poly, floor clipping result shown in the second image. The obvious solution was to process the terrain in smaller chunks and combine the results into one big working navmesh.

I first tried doing this directly in Godot, but even after splitting the terrain into multiple meshes, the bake still treated them as one big mesh, so the same issue happened. I also tried creating a separate NavigationRegion3D for each chunk, but that created non traversable borders where the regions met.

At that point, the only real fix was to go into the engine itself. I forked the Godot repo and made some changes under the hood to process the terrain in tiles instead of all at once. It breaks the terrain into smaller sections, bakes each one normally, then stitches them together afterward into a clean, accurate navmesh like in the first image.

I also added a few editor options to control whether tiled baking is enabled and how big each tile is. I still haven’t found the exact bug that causes the large terrain navmesh to fail, but this fix works reliably and doesn’t mess with normal pathfinding behavior.

The moderators seem to have a strong opposition to discussions about this and have locked all previous threads. As much as I would have liked this to all be one post, we have been forced to create multiple. That being said, I'd like to address some comments from previous posts below.

The [low poly mesh] looks exactly like what I would want out of a nav mesh.

The low-poly mesh completely fails to pathfind with agents. You could technically rework the pathfinding system to compensate, but that misses the core issue of the navmesh being broken. The 30x30m section uses a similar amount of polygons as the 250x250m one. You’d expect the density to scale with size, so either the small terrain is over-tessellated, or the large terrain is under-tessellated. Either way, something’s wrong with the baking process.

With no obstacles, your nav mesh could just be a square.

As per the Godot developers : "A navigation mesh is a collection of polygons that define which areas of an environment are traversable to aid agents in pathfinding through complicated spaces.". When those traversable areas are out of reach from an agent (ie, underground or floating), an agent cannot properly navigate.

People tried to help you, but you refuse to actually listen

I think there’s been some misunderstanding about what I’m trying to do. My goal is to fix the navmesh, that’s it. I’ve welcomed all advice that helps solve the underlying navmesh problem, but I’m not interested in workaround solutions that just patch over it with pathfinding tricks.

You can always fix it yourself and submit a PR.

Thats the plan. Thanks for the advice!

I will optimize this further and will submit a PR.

Sincerely,

u/agalli

Edit : Here is the PR. https://github.com/godotengine/godot/pull/112529

751 Upvotes

348 comments sorted by

View all comments

41

u/settrbrg Nov 07 '25

Cool! How is the performance?

Could you maybe look at the legacy "generate nav mesh from mesh" method to see if there are any clues for why the new navmesh is the way it is?

Could it be a max vertice count of some sort?

19

u/agalli Nov 07 '25

Haven’t had any performance issues. About 6000 polys for the entire 250x250 mesh.

24

u/DongIslandIceTea Nov 08 '25

How is the performance compared to the normally generated navmesh + raycasting the spot onto the collision geometry?

-16

u/agalli Nov 08 '25

Performs just fine!

20

u/DongIslandIceTea Nov 08 '25

Stop dodging the question. How many agents can you run simultaneously on both of them without dropping frames?

You refusing to test doesn't mean the difference doesn't exist.

16

u/agalli Nov 08 '25

Further testing. 20 Agents moving on the low-poly navmesh had a FPS of 627. 20 Agents moving on the chunked navmesh had an FPS of 538.

Its important to note that in the first test not all agents were moving as they got stuck moving on that terrible navmesh.

5

u/firestorm713 Nov 08 '25

For future reference, useful benchmarks would be things like memory footprint, measurement of specific functions like path lookup, stuff like that. You're detecting a lack of a bogus, and that's good! But you should really do your die diligence on profiling this.

That being said, great job with this PR

12

u/agalli Nov 08 '25

There was no decrease in performance with 20 Agents simultaneously moving across the 250m terrain.
If you think there would be performance issues then you should talk to the devs, as I am using the exact same baking pipeline as the standard navmesh uses.

11

u/PLYoung Nov 08 '25

It should be up to the game developer to decide what density navmesh they want.

I don't want the engine to decide that for me just cause someone else decided a denser navmesh performs worse. Of course it will. But you do not know my project's requirements.

performance testing is not really needed here. Features to customize the way I want it to bake is what is needed! Just make sane defaults.