spimort / TerraBrush

MIT License
645 stars 23 forks source link

Cannot bake navigation region for default terrabrush terrain #111

Closed YajJackson closed 3 months ago

YajJackson commented 3 months ago

Attempting to generate bake navmesh fails/ crashes for default terrabrush terrain.

Steps to reproduce:

  1. Create a new node3d scene
  2. Add NavigationRegion3D
  3. Add NavigationMesh to nav region
  4. Save (so that terrabrush can generate "Data Path"
  5. Add TerraBrush node to nav region
  6. Select TerraBrush node -> Add terrain via "CreateTerrain" button
  7. Select nav region node -> Click "Bake NavigationMesh" button in the top of scene viewport
  8. See that Godot fails to bake navigation, and crashes.

Crash message:

WARNING: NavigationMesh baking process will likely fail.
Source geometry is suspiciously big for the current Cell Size and Cell Height in the NavMesh Resource bake settings.
If baking does not fail, the resulting NavigationMesh will create serious pathfinding performance issues.
It is advised to increase Cell Size and/or Cell Height in the NavMesh Resource bake settings or reduce the size / scale of the source geometry.

Extra info: terrabrush version: version="0.7.0-alpha" godot version: v4.2.1.stable.mono.official

A note: Just thought I'd mention that this is a wonderful project and more than appreciate the work you're doing :)

YajJackson commented 3 months ago

Related to

It may be that we should not expect to bake navigation for terrain, I'm just not sure what the workflow should be.

YajJackson commented 3 months ago

After poking around, I've found that this may be related to LODs.

If I reduce the number of Lod Levels to 1, then baking seems to succeed. However, the resulting navmesh extends much further than the terrain that's generated.

Screenshot 2024-06-02 at 6 42 29 PM Screenshot 2024-06-02 at 6 43 09 PM
saintrider commented 3 months ago

However, the resulting navmesh extends much further than the terrain that's generated.

This problem disappears for me if I set "Parsed Geometry Type" to "Static Colliders" in the Navigation Mesh. Thanks for the research in this issue so far!

spimort commented 3 months ago

I was about to say that as well, can you try to change the "Parsed Geometry" to "Static Colliders". This is how I got the best results so far 🙂

On this image, you can see that the navmesh has been built only on the terrain without going too far : image

YajJackson commented 3 months ago

@spimort @saintrider It looks like that has done the trick! Thank you :)