MinRegionArea
MinRegionArea
#Overview
name: MinRegionArea
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
It is referenced in 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MinRegionArea is to define the minimum size of navigable areas in the Unreal Engine 5 navigation mesh (NavMesh) system. It is used to discard small areas that are not significant for navigation, helping to optimize the NavMesh generation process and reduce complexity in the final navigation data.
This setting variable is primarily used in the NavigationSystem module, specifically within the RecastNavMesh subsystem. It is an integral part of the NavMesh generation process, which is responsible for creating walkable areas for AI agents in the game world.
The value of MinRegionArea is typically set in the ARecastNavMesh class, which is a subclass of ANavigationData. It can be modified through the Unreal Editor’s property system, as indicated by the UPROPERTY macro with EditAnywhere and Category=Generation attributes.
MinRegionArea interacts closely with other NavMesh generation properties, particularly:
- MergeRegionSize: Used in conjunction with MinRegionArea to determine which regions should be merged.
- CellSize: The MinRegionArea value is converted to voxel units using the CellSize during NavMesh generation.
Developers should be aware of the following when using this variable:
- The value is in Unreal units (usually centimeters) and represents an area, not a linear dimension.
- Setting MinRegionArea too high might result in the loss of important navigable areas, while setting it too low could lead to unnecessary complexity in the NavMesh.
- The actual minimum region area used in voxel space is calculated as (MinRegionArea / CellSize)^2.
Best practices for using MinRegionArea include:
- Adjust the value based on the scale of your game world and the size of your AI agents.
- Test different values to find the optimal balance between NavMesh simplicity and accurate representation of navigable space.
- Consider the relationship between MinRegionArea and other NavMesh generation properties, especially MergeRegionSize and CellSize.
- Use the NavMesh visualization tools in the Unreal Editor to verify that the generated NavMesh accurately represents the intended navigable areas after adjusting this value.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEngine.ini:2827, section: [/Script/NavigationSystem.RecastNavMesh]
- INI Section:
/Script/NavigationSystem.RecastNavMesh
- Raw value:
0.f
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavMesh/RecastNavMesh.cpp:432
Scope (from outer to inner):
file
function FRecastNavMeshGenerationProperties::FRecastNavMeshGenerationProperties
Source code excerpt:
AgentMaxSlope = 44.f;
AgentMaxStepHeight = 35.f;
MinRegionArea = 0.f;
MergeRegionSize = 400.f;
MaxSimplificationError = 1.3f; // from RecastDemo
TileNumberHardLimit = 1 << 20;
RegionPartitioning = ERecastPartitioning::Watershed;
LayerPartitioning = ERecastPartitioning::Watershed;
RegionChunkSplits = 2;
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavMesh/RecastNavMesh.cpp:464
Scope (from outer to inner):
file
function FRecastNavMeshGenerationProperties::FRecastNavMeshGenerationProperties
Source code excerpt:
AgentMaxSlope = RecastNavMesh.AgentMaxSlope;
AgentMaxStepHeight = RecastNavMesh.GetAgentMaxStepHeight(ENavigationDataResolution::Default); //FRecastNavMeshGenerationProperties is getting deprecated
MinRegionArea = RecastNavMesh.MinRegionArea;
MergeRegionSize = RecastNavMesh.MergeRegionSize;
MaxSimplificationError = RecastNavMesh.MaxSimplificationError;
TileNumberHardLimit = RecastNavMesh.TileNumberHardLimit;
RegionPartitioning = RecastNavMesh.RegionPartitioning;
LayerPartitioning = RecastNavMesh.LayerPartitioning;
RegionChunkSplits = RecastNavMesh.RegionChunkSplits;
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavMesh/RecastNavMesh.cpp:3447
Scope (from outer to inner):
file
function void ARecastNavMesh::UpdateGenerationProperties
Source code excerpt:
AgentMaxStepHeight = GenerationProps.AgentMaxStepHeight;
MinRegionArea = GenerationProps.MinRegionArea;
MergeRegionSize = GenerationProps.MergeRegionSize;
MaxSimplificationError = GenerationProps.MaxSimplificationError;
TileNumberHardLimit = GenerationProps.TileNumberHardLimit;
RegionPartitioning = GenerationProps.RegionPartitioning;
LayerPartitioning = GenerationProps.LayerPartitioning;
RegionChunkSplits = GenerationProps.RegionChunkSplits;
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavMesh/RecastNavMeshGenerator.cpp:4654
Scope (from outer to inner):
file
function void FRecastNavMeshGenerator::SetupTileConfig
Source code excerpt:
OutConfig.maxEdgeLen = (int32)(1200.0f / CellSize);
OutConfig.minRegionArea = (int32)rcSqr(DestNavMesh->MinRegionArea / CellSize);
OutConfig.mergeRegionArea = (int32)rcSqr(DestNavMesh->MergeRegionSize / CellSize);
OutConfig.tileSize = FMath::Max(FMath::TruncToInt(DestNavMesh->TileSizeUU / CellSize), 1);
UE_CLOG(OutConfig.tileSize == 1, LogNavigation, Error, TEXT("RecastNavMesh TileSize of 1 is highly discouraged. This occurence indicates an issue with RecastNavMesh\'s generation properties (specifically TileSizeUU: %f, CellSize: %f). Please ensure their correctness.")
, DestNavMesh->TileSizeUU, CellSize);
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Private/NavMesh/RecastNavMeshGenerator.cpp:4736
Scope (from outer to inner):
file
function void FRecastNavMeshGenerator::ConfigureBuildProperties
Source code excerpt:
OutConfig.detailSampleMaxError = 1.0f;
OutConfig.minRegionArea = (int32)rcSqr(DestNavMesh->MinRegionArea / CellSize);
OutConfig.mergeRegionArea = (int32)rcSqr(DestNavMesh->MergeRegionSize / CellSize);
OutConfig.maxVerticalMergeError = DestNavMesh->MaxVerticalMergeError;
OutConfig.maxSimplificationError = DestNavMesh->MaxSimplificationError;
OutConfig.simplificationElevationRatio = DestNavMesh->SimplificationElevationRatio;
OutConfig.bPerformVoxelFiltering = DestNavMesh->bPerformVoxelFiltering;
OutConfig.bMarkLowHeightAreas = DestNavMesh->bMarkLowHeightAreas;
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Public/NavMesh/RecastNavMesh.h:366
Scope: file
Source code excerpt:
/* The minimum dimension of area. Areas smaller than this will be discarded */
UPROPERTY(EditAnywhere, Category = Generation, meta = (ClampMin = "0.0"))
float MinRegionArea;
/* The size limit of regions to be merged with bigger regions (watershed partitioning only) */
UPROPERTY(EditAnywhere, Category = Generation, meta = (ClampMin = "0.0"))
float MergeRegionSize;
/** How much navigable shapes can get simplified - the higher the value the more freedom */
#Loc: <Workspace>/Engine/Source/Runtime/NavigationSystem/Public/NavMesh/RecastNavMesh.h:796
Scope (from outer to inner):
file
class class ARecastNavMesh : public ANavigationData
Source code excerpt:
/* The minimum dimension of area. Areas smaller than this will be discarded */
UPROPERTY(EditAnywhere, Category=Generation, config, meta=(ClampMin = "0.0"))
float MinRegionArea;
/* The size limit of regions to be merged with bigger regions (watershed partitioning only) */
UPROPERTY(EditAnywhere, Category=Generation, config, meta=(ClampMin = "0.0"))
float MergeRegionSize;
/** Maximum vertical deviation between raw contour points to allowing merging (in voxel).