ErodeSurfaceThickness

ErodeSurfaceThickness

#Overview

name: ErodeSurfaceThickness

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 ErodeSurfaceThickness is to control the thickness of the surface layer during landscape erosion operations in Unreal Engine 5. This setting variable is specifically used in the landscape editing system, particularly for the erosion tool.

Based on the Callsites section, this variable is primarily used in the LandscapeEditor module. It is a part of the ULandscapeEditorObject class, which is responsible for managing various landscape editing settings.

The value of this variable is set in multiple places:

  1. It is initialized in the ULandscapeEditorObject constructor with a default value of 256.
  2. It can be loaded from and saved to the project’s configuration file (GEditorPerProjectIni) using the “LandscapeEdit” section.
  3. It can be modified through the Unreal Engine editor interface, as indicated by the UPROPERTY macro with EditAnywhere attribute.

This variable interacts with other erosion-related variables such as ErodeIterationNum, ErodeThresh, and ErosionNoiseMode. Together, these variables control different aspects of the landscape erosion process.

Developers should be aware that:

  1. The value of ErodeSurfaceThickness is clamped between 128 and 1024, with UI limits set between 128 and 512.
  2. This variable directly affects the erosion calculation in the FLandscapeToolStrokeErosion::Apply function.
  3. Changes to this value will impact the performance and visual results of the erosion tool.

Best practices when using this variable include:

  1. Experiment with different values to achieve the desired erosion effect, starting with the default value of 256.
  2. Consider the performance impact when setting higher values, especially in combination with a high ErodeIterationNum.
  3. Use this setting in conjunction with other erosion parameters for more refined control over the landscape sculpting process.
  4. Save preferred settings to the project configuration for consistency across editing sessions.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:741, section: [LandscapeEdit]

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeErosionTools.cpp:106

Scope (from outer to inner):

file
class        class FLandscapeToolStrokeErosion : public FLandscapeToolStrokeErosionBase
function     void Apply

Source code excerpt:

		const int32 NeighborNum = 4;
		const int32 Iteration = UISettings->ErodeIterationNum;
		const int32 Thickness = UISettings->ErodeSurfaceThickness;
		const int32 LayerNum = this->LandscapeInfo->Layers.Num();

		TArray<uint16> HeightData;
		LayerHeightDataCache.Initialize(this->LandscapeInfo, bCombinedLayerOperation);
		LayerHeightDataCache.Read(X1, Y1, X2, Y2, HeightData);

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:56

Scope (from outer to inner):

file
function     ULandscapeEditorObject::ULandscapeEditorObject

Source code excerpt:


	, ErodeThresh(64)
	, ErodeSurfaceThickness(256)
	, ErodeIterationNum(28)
	, ErosionNoiseMode(ELandscapeToolErosionMode::Lower)
	, ErosionNoiseScale(60.0f)
	, bErosionUseLayerHardness(false)

	, RainAmount(128)

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:271

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Load

Source code excerpt:

	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);
	GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bErosionUseLayerHardness"), bErosionUseLayerHardness, GEditorPerProjectIni);

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:424

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Save

Source code excerpt:

	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);

	GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("RainAmount"), RainAmount, GEditorPerProjectIni);
	GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("SedimentCapacity"), SedimentCapacity, GEditorPerProjectIni);

#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Public/LandscapeEditorObject.h:379

Scope (from outer to inner):

file
class        class ULandscapeEditorObject : public UObject

Source code excerpt:

	// 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
	UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Iterations", ShowForTools="Erosion", ClampMin="1", ClampMax="300", UIMin="1", UIMax="150"))
	int32 ErodeIterationNum;

	// Whether to erode by lowering, raising, or both