From d0276210285341eab8d2f7151aa1a7d0f41c75f1 Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Wed, 16 Oct 2024 19:51:05 +0200 Subject: [PATCH] Recast: set new default rasterization and polygonization values Defaults have been fine tuned and now generated much better results, especially in narrow area's such as small buildings and corridors. Previously, there usually were gaps in between door frames and tunnels. --- src/naveditor/Editor.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/naveditor/Editor.cpp b/src/naveditor/Editor.cpp index 061c7034..f331fa16 100644 --- a/src/naveditor/Editor.cpp +++ b/src/naveditor/Editor.cpp @@ -254,8 +254,8 @@ void Editor::resetCommonSettings() m_maxTileBits = 28; #endif - m_cellSize = 16.0f; - m_cellHeight = 32.0f; + m_cellSize = 8.0f; + m_cellHeight = 2.0f; m_traverseLinkDrawParams.dynamicOffset = m_traverseRayDynamicOffset; m_traverseLinkDrawParams.cellHeight = m_cellHeight; @@ -271,13 +271,13 @@ void Editor::resetCommonSettings() m_traverseRayExtraOffset = 8.0f; m_traverseEdgeMinOverlap = RD_EPS; - m_regionMinSize = 8; + m_regionMinSize = 4; m_regionMergeSize = 20; - m_edgeMaxLen = 12; - m_edgeMaxError = 1.3f; + m_edgeMaxLen = 7; + m_edgeMaxError = 1.7f; m_vertsPerPoly = 6; - m_detailSampleDist = 6.0f; - m_detailSampleMaxError = 1.0f; + m_detailSampleDist = 16.0f; + m_detailSampleMaxError = 4.0f; m_partitionType = EDITOR_PARTITION_WATERSHED; initTraverseMasks(); @@ -329,8 +329,8 @@ void Editor::handleCommonSettings() ImGui::Separator(); ImGui::Text("Region"); - ImGui::SliderInt("Min Region Size", &m_regionMinSize, 0, 750); // todo(amos): increase because of larger map scale? - ImGui::SliderInt("Merged Region Size", &m_regionMergeSize, 0, 750); // todo(amos): increase because of larger map scale? + ImGui::SliderInt("Min Region Size", &m_regionMinSize, 0, 150); + ImGui::SliderInt("Merged Region Size", &m_regionMergeSize, 0, 150); ImGui::PopItemWidth(); @@ -410,8 +410,8 @@ void Editor::handleCommonSettings() ImGui::Separator(); ImGui::Text("Detail Mesh"); - ImGui::SliderFloat("Sample Distance", &m_detailSampleDist, 1.0f, 16.0f); - ImGui::SliderFloat("Max Sample Error", &m_detailSampleMaxError, 0.0f, 16.0f); + ImGui::SliderFloat("Sample Distance", &m_detailSampleDist, 1.0f, 128.0f); + ImGui::SliderFloat("Max Sample Error", &m_detailSampleMaxError, 0.0f, 128.0f); ImGui::PopItemWidth(); @@ -1240,11 +1240,11 @@ void Editor::renderTraverseTableFineTuners() // NOTE: the climb height should never equal or exceed the agent's height, see https://groups.google.com/g/recastnavigation/c/L5rBamxcOBk/m/5xGLj6YP25kJ // Quote: "you will get into trouble in cases where there is an overhand which is low enough to step over and high enough for the agent to walk under." const hulldef hulls[NAVMESH_COUNT] = { - { g_navMeshNames[NAVMESH_SMALL] , NAI_Hull::Width(HULL_HUMAN) * NAI_Hull::Scale(HULL_HUMAN) , NAI_Hull::Height(HULL_HUMAN) , NAI_Hull::Height(HULL_HUMAN) * NAI_Hull::Scale(HULL_HUMAN) , 32, 8 }, - { g_navMeshNames[NAVMESH_MED_SHORT] , NAI_Hull::Width(HULL_PROWLER) * NAI_Hull::Scale(HULL_PROWLER), NAI_Hull::Height(HULL_PROWLER), NAI_Hull::Height(HULL_PROWLER) * NAI_Hull::Scale(HULL_PROWLER), 32, 4 }, - { g_navMeshNames[NAVMESH_MEDIUM] , NAI_Hull::Width(HULL_MEDIUM) * NAI_Hull::Scale(HULL_MEDIUM) , NAI_Hull::Height(HULL_MEDIUM) , NAI_Hull::Height(HULL_MEDIUM) * NAI_Hull::Scale(HULL_MEDIUM) , 32, 4 }, - { g_navMeshNames[NAVMESH_LARGE] , NAI_Hull::Width(HULL_TITAN) * NAI_Hull::Scale(HULL_TITAN) , NAI_Hull::Height(HULL_TITAN) , NAI_Hull::Height(HULL_TITAN) * NAI_Hull::Scale(HULL_TITAN) , 60, 2 }, - { g_navMeshNames[NAVMESH_EXTRA_LARGE], NAI_Hull::Width(HULL_GOLIATH) * NAI_Hull::Scale(HULL_GOLIATH), NAI_Hull::Height(HULL_GOLIATH), NAI_Hull::Height(HULL_GOLIATH) * NAI_Hull::Scale(HULL_GOLIATH), 60, 2 }, + { g_navMeshNames[NAVMESH_SMALL] , NAI_Hull::Width(HULL_HUMAN) * NAI_Hull::Scale(HULL_HUMAN) , NAI_Hull::Height(HULL_HUMAN) , NAI_Hull::Height(HULL_HUMAN) * NAI_Hull::Scale(HULL_HUMAN) , 64, 8 }, + { g_navMeshNames[NAVMESH_MED_SHORT] , NAI_Hull::Width(HULL_PROWLER) * NAI_Hull::Scale(HULL_PROWLER), NAI_Hull::Height(HULL_PROWLER), NAI_Hull::Height(HULL_PROWLER) * NAI_Hull::Scale(HULL_PROWLER), 64, 4 }, + { g_navMeshNames[NAVMESH_MEDIUM] , NAI_Hull::Width(HULL_MEDIUM) * NAI_Hull::Scale(HULL_MEDIUM) , NAI_Hull::Height(HULL_MEDIUM) , NAI_Hull::Height(HULL_MEDIUM) * NAI_Hull::Scale(HULL_MEDIUM) , 64, 4 }, + { g_navMeshNames[NAVMESH_LARGE] , NAI_Hull::Width(HULL_TITAN) * NAI_Hull::Scale(HULL_TITAN) , NAI_Hull::Height(HULL_TITAN) , NAI_Hull::Height(HULL_TITAN) * NAI_Hull::Scale(HULL_TITAN) , 120, 2 }, + { g_navMeshNames[NAVMESH_EXTRA_LARGE], NAI_Hull::Width(HULL_GOLIATH) * NAI_Hull::Scale(HULL_GOLIATH), NAI_Hull::Height(HULL_GOLIATH), NAI_Hull::Height(HULL_GOLIATH) * NAI_Hull::Scale(HULL_GOLIATH), 120, 2 }, }; void Editor::selectNavMeshType(const NavMeshType_e navMeshType)