mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: add option to disable the filtering of neighbor slopes
This causes many problems in titanfall and apex maps due to the large voxel sizes we have to use to generate navmeshes. A single unwalkable voxel makes a large difference. disabling these feature results in much better results. The problems this test filters away can be fixed with setting proper cell heights in our case.
This commit is contained in:
parent
40cea14a49
commit
247a99765c
@ -146,6 +146,7 @@ Editor::Editor() :
|
||||
m_ignoreWindingOrder(false),
|
||||
m_filterLowHangingObstacles(true),
|
||||
m_filterLedgeSpans(true),
|
||||
m_filterNeighborSlopes(false),
|
||||
m_filterWalkableLowHeightSpans(true),
|
||||
m_buildTraversePortals(true),
|
||||
m_traverseRayDynamicOffset(true),
|
||||
@ -425,9 +426,16 @@ void Editor::handleCommonSettings()
|
||||
ImGui::Separator();
|
||||
ImGui::Text("Filtering");
|
||||
ImGui::Checkbox("Low Hanging Obstacles##FilterSettings", &m_filterLowHangingObstacles);
|
||||
ImGui::Checkbox("Ledge Spans##FilterSettings", &m_filterLedgeSpans);
|
||||
ImGui::Checkbox("Walkable Low Height Spans##FilterSettings", &m_filterWalkableLowHeightSpans);
|
||||
|
||||
ImGui::Checkbox("Ledge Spans##FilterSettings", &m_filterLedgeSpans);
|
||||
if (m_filterLedgeSpans)
|
||||
{
|
||||
ImGui::Indent();
|
||||
ImGui::Checkbox("Neighbor Slopes##FilterSettings", &m_filterNeighborSlopes);
|
||||
ImGui::Unindent();
|
||||
}
|
||||
|
||||
ImGui::PushItemWidth(145.f);
|
||||
ImGui::Separator();
|
||||
|
||||
|
@ -262,7 +262,7 @@ bool Editor_SoloMesh::handleBuild()
|
||||
if (m_filterLowHangingObstacles)
|
||||
rcFilterLowHangingWalkableObstacles(m_ctx, m_cfg.walkableClimb, *m_solid);
|
||||
if (m_filterLedgeSpans)
|
||||
rcFilterLedgeSpans(m_ctx, m_cfg.walkableHeight, m_cfg.walkableClimb, *m_solid);
|
||||
rcFilterLedgeSpans(m_ctx, m_cfg.walkableHeight, m_cfg.walkableClimb, m_filterNeighborSlopes , *m_solid);
|
||||
if (m_filterWalkableLowHeightSpans)
|
||||
rcFilterWalkableLowHeightSpans(m_ctx, m_cfg.walkableHeight, *m_solid);
|
||||
|
||||
|
@ -335,7 +335,7 @@ int Editor_TempObstacles::rasterizeTileLayers(
|
||||
if (m_filterLowHangingObstacles)
|
||||
rcFilterLowHangingWalkableObstacles(m_ctx, tcfg.walkableClimb, *rc.solid);
|
||||
if (m_filterLedgeSpans)
|
||||
rcFilterLedgeSpans(m_ctx, tcfg.walkableHeight, tcfg.walkableClimb, *rc.solid);
|
||||
rcFilterLedgeSpans(m_ctx, tcfg.walkableHeight, tcfg.walkableClimb, m_filterNeighborSlopes , *rc.solid);
|
||||
if (m_filterWalkableLowHeightSpans)
|
||||
rcFilterWalkableLowHeightSpans(m_ctx, tcfg.walkableHeight, *rc.solid);
|
||||
|
||||
|
@ -1104,7 +1104,7 @@ unsigned char* Editor_TileMesh::buildTileMesh(const int tx, const int ty, const
|
||||
if (m_filterLowHangingObstacles)
|
||||
rcFilterLowHangingWalkableObstacles(m_ctx, m_cfg.walkableClimb, *m_solid);
|
||||
if (m_filterLedgeSpans)
|
||||
rcFilterLedgeSpans(m_ctx, m_cfg.walkableHeight, m_cfg.walkableClimb, *m_solid);
|
||||
rcFilterLedgeSpans(m_ctx, m_cfg.walkableHeight, m_cfg.walkableClimb, m_filterNeighborSlopes, *m_solid);
|
||||
if (m_filterWalkableLowHeightSpans)
|
||||
rcFilterWalkableLowHeightSpans(m_ctx, m_cfg.walkableHeight, *m_solid);
|
||||
|
||||
|
@ -239,6 +239,7 @@ protected:
|
||||
bool m_ignoreWindingOrder;
|
||||
bool m_filterLowHangingObstacles;
|
||||
bool m_filterLedgeSpans;
|
||||
bool m_filterNeighborSlopes;
|
||||
bool m_filterWalkableLowHeightSpans;
|
||||
bool m_buildTraversePortals;
|
||||
bool m_traverseRayDynamicOffset;
|
||||
|
11
src/thirdparty/recast/Recast/Include/Recast.h
vendored
11
src/thirdparty/recast/Recast/Include/Recast.h
vendored
@ -870,12 +870,13 @@ void rcFilterLowHangingWalkableObstacles(rcContext* context, int walkableClimb,
|
||||
///
|
||||
/// @ingroup recast
|
||||
/// @param[in,out] context The build context to use during the operation.
|
||||
/// @param[in] walkableHeight Minimum floor to 'ceiling' height that will still allow the floor area to
|
||||
/// be considered walkable. [Limit: >= 3] [Units: vx]
|
||||
/// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable.
|
||||
/// [Limit: >=0] [Units: vx]
|
||||
/// @param[in] walkableHeight Minimum floor to 'ceiling' height that will still allow the floor area to
|
||||
/// be considered walkable. [Limit: >= 3] [Units: vx]
|
||||
/// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable.
|
||||
/// @param[in] cullSteepNeiSlopes Whether to mark spans having neighbors not within the walkable climb range as non walkable.
|
||||
/// [Limit: >=0] [Units: vx]
|
||||
/// @param[in,out] heightfield A fully built heightfield. (All spans have been added.)
|
||||
void rcFilterLedgeSpans(rcContext* context, int walkableHeight, int walkableClimb, rcHeightfield& heightfield);
|
||||
void rcFilterLedgeSpans(rcContext* context, int walkableHeight, int walkableClimb, bool cullSteepNeiSlopes, rcHeightfield& heightfield);
|
||||
|
||||
/// Marks walkable spans as not walkable if the clearance above the span is less than the specified height.
|
||||
///
|
||||
|
@ -58,7 +58,7 @@ void rcFilterLowHangingWalkableObstacles(rcContext* context, const int walkableC
|
||||
}
|
||||
|
||||
void rcFilterLedgeSpans(rcContext* context, const int walkableHeight, const int walkableClimb,
|
||||
rcHeightfield& heightfield)
|
||||
const bool cullSteepNeiSlopes, rcHeightfield& heightfield)
|
||||
{
|
||||
rdAssert(context);
|
||||
|
||||
@ -146,7 +146,14 @@ void rcFilterLedgeSpans(rcContext* context, const int walkableHeight, const int
|
||||
}
|
||||
// If the difference between all neighbours is too large,
|
||||
// we are at steep slope, mark the span as ledge.
|
||||
else if ((accessibleNeighborMaxHeight - accessibleNeighborMinHeight) > walkableClimb)
|
||||
//
|
||||
// note(amos): since we mostly work with relatively large
|
||||
// voxels (8 - 15), this test can be quite aggressive
|
||||
// causing the beginning of stairs to be culled away due
|
||||
// to the limited amount of voxels that could fit inside
|
||||
// the agent's radius. However, these spans perfectly
|
||||
// climbable. Added an option to opt out of this feature.
|
||||
else if (cullSteepNeiSlopes && (accessibleNeighborMaxHeight - accessibleNeighborMinHeight) > walkableClimb)
|
||||
{
|
||||
span->area = RC_NULL_AREA;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user