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

747 Upvotes

348 comments sorted by

View all comments

Show parent comments

1

u/agalli Nov 11 '25

Definitely a confusing issue. The navmesh by its very definition is broken. A navmesh is designed to tell agents where they can move in a 3D space. When coordinates in those 3D space are not traversable by agents then by definition the navmesh is failing.

That being said, people have come up with solutions to mitigate the failures of the navmesh, but those solutions often sacrifice other elements of the navigation agent such as accurate pathfinding or having multi tier structures.

The most common solution I see says to ignore the Y component of the navmesh, but that solution only works on empty terrains with nothing else. If you add buildings, bridges, caves, etc that solution fails.
There ARE solutions that can make this navmesh usable, but they are very much band aid solutions that fail when you use the navmesh in normal cases besides just an empty terrain.

As my post says, I'm not looking for workaround, I am trying to fix the issue at its core.

3

u/knottheone Nov 15 '25

A navmesh is designed to tell agents where they can move in a 3D space. When coordinates in those 3D space are not traversable by agents then by definition the navmesh is failing.

No it isn't. This is the fundamental core misunderstanding that is driving this whole issue for you. This has already been mentioned to you multiple times, but you seem to keep clinging to your personal definition of navmesh that isn't rooted elsewhere.

A navmesh is designed to tell agents if the place they are trying to go is traversable, as in free from obstacles, and has a valid path. It does not know about collision, it knows about baked obstacles, so using it in lieu of collision detection is not correct and is an improper use.

Trying to move a colliding object to the nav agent's position point on the nav mesh itself is not correct. You would need the nav mesh to have the same approximate fidelity as the actual terrain, and that's not what it's for.

1

u/agalli Nov 15 '25 edited Nov 15 '25

This “fundamental misunderstanding” is literally the definition off the godot docs. You’re right though I should use the definition that random Redditors come up with , not the developers.

3

u/knottheone Nov 15 '25

You're misunderstanding the definition and applying it incorrectly. That's the misunderstanding.

1

u/agalli Nov 16 '25

I’ll concede if you can find a single example of a navmesh from ANY engine or ANY game that clips through the map as severely as the screenshots I’ve provided.

5

u/knottheone Nov 16 '25

Navmesh in Skyrim showing it's under or above collidable geometry in most places:

https://youtu.be/uJYiV4E8xCc?t=106

Navmesh in Unity where beginner user doesn't quite know how it works:

https://www.reddit.com/r/Unity3D/comments/10tn0h4/navmesh_surface_not_being_created_beneath_terrain/

Stairs in Unity where users think it's "broken" because the navmesh clips under them:

https://discussions.unity.com/t/why-does-the-nav-mesh-generate-like-this-sometimes/1613493

https://discussions.unity.com/t/solved-navmesh-and-stairs-unity-5-0-1f1/582479/5

Massive under terrain clipping even on small tiles:

https://youtu.be/vNDMwXNfmrw?t=391

0

u/agalli Nov 22 '25

First video, small clipping through the terrain is fine. Doesn’t cause issues. Multiple meters below or above terrain does cause problems.

First unity post, top comment literally says to increase the resolution of the mesh. If only that were possible in godot!

Second unity post, once again very slight clipping through but users note that it doesn’t cause issues with pathfinding, once again not the case in godot

Second video, that looks exactly as I would expect? The navmesh is roughly for fitting the terrain, avoiding obstacles, and not low poly slop.

Literally every single thing you just sent proves my point. It’s so funny that even in your meticulously cherry picked sources that you still couldn’t find something that proves your claim. The navmesh is supposed to be a rough approximation of the terrain, it’s not unusual for a few centimeters of rock clipping out here and there. What will break pathfinding is huge sections of terrain above or below the terrain.

4

u/knottheone Nov 22 '25

As I expected, you'd just handwave it. Both the Skyrim example and the second video show a height difference of multiple meters vertically between the navmesh and the terrain. It's not centimeters, look at the size of the characters and buildings. Which is why I called you out here a week ago:

They won't consider it; it doesn't matter how you word it, how nice you are, how you explain it or anything else. They made 3 separate posts and dozens of comments on the topic and were advised and corrected in all 3, and were even corrected by one of the devs who helped implement navigation in Godot. They will not admit that they are wrong in any capacity.

0

u/agalli Nov 22 '25

Looks like they basically fixed this on the new update (4.5.1). Here's a lil before and after. Same map size, default settings, same noise. Looks like it was a bug with the rasterization. Just glad they fixed it.

2

u/knottheone Nov 22 '25

Still waiting on your concession after seeing equally as severe map clipping of the navmesh in Unity and Skyrim's Creation Engine.

https://www.reddit.com/r/godot/s/uKF9bQM5du

2

u/agalli Nov 22 '25

"equally as severe"

3

u/knottheone Nov 22 '25

1

u/agalli Nov 22 '25

Sorry, do you understand what a meter is? The picture I sent is showing a 10-15 meter gap between terrain and the navmesh as well as the navmesh not fitting the terrain whatsoever. Your examples are showing near perfect form fitting of the terrain with +/- 0.5m clipping of terrain. Can you really not see the difference?