Merging meshes generated with different parameters

63 views
Skip to first unread message

Silouane

unread,
May 16, 2023, 2:22:14 PM5/16/23
to recastnavigation
Hello,

I am trying to generate detailed meshes to create a navmesh from them.
But the catch is that I would like to have some meshes generated using erode area and some other not using it. The reason is because for some polygons I make sur that the creature won't clip through the wall in the locomotion code and since the corridor is really narrow, erode will just get rid of all the polygons.

Is there a way to merge different detail meshes inside the rcPolyMeshDetail?
Or does someone see a way for me to achieve what I would like?

Here is the pipeline I use to generate the navmesh:
- rcCreateHeightfield
- rcGetChunksOverlappingRect
- rcRasterizeTriangles
- rcFilterLowHangingWalkableObstacles
- rcFilterLedgeSpans
- rcFilterWalkableLowHeightSpans
- rcBuildCompactHeightfield
- rcErodeWalkableArea (should not call this one in some cases)
- rcBuildDistanceField
- rcBuildRegions
- rcBuildContours
- rcBuildPolyMesh
- rcBuildPolyMeshDetail
- dtCreateNavMeshData

Note: For now what I do, is that a have 2 set of detail meshes and create tiles for both and add them to the navmesh with a different layer index. But the problem is that there is no interaction between them like clipping of polygon...

Graham Pentheny

unread,
May 20, 2023, 2:10:30 PM5/20/23
to recastnavigation
Hi!
  Navmesh erosion is meant to push the edges of the navmesh away from obstacles by the agent’s radius.  This allows you to simulate the agent as a single point moving through a mesh rather than a circle or cylinder.   It sounds like your locomotion code is doing some of this already.  There’s unfortunately not any existing switches to disable erosion on specific geometry.  You could fairly easily add some area flag filtering to rcErodeWalkableArea but I probably wouldn’t suggest that.  If erosion is toggled like that, you’ll end up with discontinuities in the navmesh at the area flag boundaries that will be difficult to triangulate well.  

Taking a step back I think the best way forward might be to either embrace the recast erosion system globally and modify your locomotion system to work with it, or completely disable erosion and rely entirely on locomotion to handle it.  The latter will also affect the path finding system as navmesh erosion often culls out small corridors that are too small for the agent to move through.  You’d need to detect those in the path finding system and discard possible paths that take advantage of them.

A third approach would be to keep the existing behavior you’re describing, but turn those tight corridors into authored off-mesh links.  That will let you override any navigability information in the navmesh which means you don’t need to worry about tweaking erosion settings.   It also lets you completely control how the agent moves through that space, which it sounds like you’ve already done to a degree.

I’ll be curious how you end up solving this.  If you have any other questions, feel free to post them.  Hope that helps!

Good luck,
Graham
Reply all
Reply to author
Forward
0 new messages