ErodeThresh
ErodeThresh
#Overview
name: ErodeThresh
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 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ErodeThresh is to control the erosion effect in the Landscape Editor tool of Unreal Engine 5. Specifically, it sets the minimum height difference required for the erosion effects to be applied to the landscape.
This setting variable is primarily used in the Landscape Editor module, which is part of the Unreal Engine’s terrain editing system. It is utilized in the erosion tool, which simulates natural erosion processes on the landscape.
The value of this variable is set in several ways:
- It is initialized in the constructor of the ULandscapeEditorObject class.
- It can be loaded from and saved to the project’s configuration file (GEditorPerProjectIni) using the Load() and Save() functions.
- It can be modified through the Unreal Editor interface, as indicated by the UPROPERTY macro with EditAnywhere attribute.
ErodeThresh interacts with other erosion-related variables such as ErodeSurfaceThickness, ErodeIterationNum, and ErosionNoiseMode. These variables work together to define the behavior of the erosion tool.
Developers should be aware that:
- ErodeThresh is clamped between 0 and 256, with a recommended UI range of 0 to 128.
- Lower values of ErodeThresh will result in more erosion being applied, as it lowers the threshold for height differences that trigger the erosion effect.
- This variable is part of the non-transactional properties, meaning changes to it are not automatically undoable in the editor.
Best practices when using this variable include:
- Experiment with different values to achieve the desired erosion effect, starting with the default value of 64.
- Consider the scale of your landscape when setting this value. Larger landscapes might require higher thresholds.
- Use in conjunction with other erosion settings for more refined control over the erosion effect.
- Be mindful of performance implications when lowering the threshold significantly, as it may increase the number of affected areas and computation time.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:739, section: [LandscapeEdit]
- INI Section:
LandscapeEdit
- Raw value:
64
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeErosionTools.cpp:121
Scope (from outer to inner):
file
class class FLandscapeToolStrokeErosion : public FLandscapeToolStrokeErosionBase
function void Apply
Source code excerpt:
// Apply the brush
uint16 Thresh = static_cast<uint16>(UISettings->ErodeThresh);
int32 WeightMoveThresh = FMath::Min<int32>(FMath::Max<int32>(Thickness >> 2, Thresh), Thickness >> 1);
TArray<float> CenterWeights;
TArray<float> NeighborWeight;
if (bWeightApplied)
{
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:55
Scope (from outer to inner):
file
function ULandscapeEditorObject::ULandscapeEditorObject
Source code excerpt:
, DetailScale(0.3f)
, ErodeThresh(64)
, ErodeSurfaceThickness(256)
, ErodeIterationNum(28)
, ErosionNoiseMode(ELandscapeToolErosionMode::Lower)
, ErosionNoiseScale(60.0f)
, bErosionUseLayerHardness(false)
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:269
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Load
Source code excerpt:
GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bCombinedLayersOperation"), bCombinedLayersOperation, GEditorPerProjectIni);
GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("ErodeThresh"), ErodeThresh, GEditorPerProjectIni);
GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("ErodeIterationNum"), ErodeIterationNum, GEditorPerProjectIni);
GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("ErodeSurfaceThickness"), ErodeSurfaceThickness, GEditorPerProjectIni);
int32 InErosionNoiseMode = (int32)ErosionNoiseMode;
GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("ErosionNoiseMode"), InErosionNoiseMode, GEditorPerProjectIni);
ErosionNoiseMode = (ELandscapeToolErosionMode)InErosionNoiseMode;
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("ErosionNoiseScale"), ErosionNoiseScale, GEditorPerProjectIni);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:422
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Save
Source code excerpt:
GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bCombinedLayersOperation"), bCombinedLayersOperation, GEditorPerProjectIni);
GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("ErodeThresh"), ErodeThresh, GEditorPerProjectIni);
GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("ErodeIterationNum"), ErodeIterationNum, GEditorPerProjectIni);
GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("ErodeSurfaceThickness"), ErodeSurfaceThickness, GEditorPerProjectIni);
GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("ErosionNoiseMode"), (int32)ErosionNoiseMode, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("ErosionNoiseScale"), ErosionNoiseScale, GEditorPerProjectIni);
GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bErosionUseLayerHardness"), bErosionUseLayerHardness, GEditorPerProjectIni);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Public/LandscapeEditorObject.h:375
Scope (from outer to inner):
file
class class ULandscapeEditorObject : public UObject
Source code excerpt:
// The minimum height difference necessary for the erosion effects to be applied. Smaller values will result in more erosion being applied
UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Threshold", ShowForTools="Erosion", ClampMin="0", ClampMax="256", UIMin="0", UIMax="128"))
int32 ErodeThresh;
// The thickness of the surface for the layer weight erosion effect
UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Surface Thickness", ShowForTools="Erosion", ClampMin="128", ClampMax="1024", UIMin="128", UIMax="512"))
int32 ErodeSurfaceThickness;
// Number of erosion iterations, more means more erosion but is slower