SedimentCapacity

SedimentCapacity

#Overview

name: SedimentCapacity

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 6 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of SedimentCapacity is to control the amount of sediment that water can carry during hydro erosion simulation in Unreal Engine’s landscape editing tools. It is specifically used in the hydro erosion tool for landscape modification.

This setting variable is primarily used in the LandscapeEditor module, particularly within the hydro erosion tool implementation. The main subsystem relying on this variable is the Landscape Editing system in Unreal Engine.

The value of this variable is set in the ULandscapeEditorObject constructor with a default value of 0.3f. It can be modified through the editor UI, as indicated by the UPROPERTY macro in the header file.

SedimentCapacity interacts with other variables in the hydro erosion simulation, such as RainAmount, HErodeIterationNum, and WaterData. It’s used in calculations to determine how much sediment can be carried by water and subsequently deposited or eroded from the landscape.

Developers must be aware that this variable directly affects the intensity of erosion in the simulation. Higher values will result in more erosion, as water can carry more sediment.

Best practices when using this variable include:

  1. Adjusting it in small increments to fine-tune the erosion effect.
  2. Considering it in conjunction with other erosion parameters for a balanced result.
  3. Testing different values to achieve the desired artistic effect for the landscape.
  4. Being mindful of performance impact when using high values in combination with many iterations.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:746, 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:362

Scope (from outer to inner):

file
class        class FLandscapeToolStrokeHydraErosion : public FLandscapeToolStrokeErosionBase
function     void Apply

Source code excerpt:

		const float DissolvingRatio = 0.07f * UISettings->GetCurrentToolStrength() * Pressure;  //0.01;
		const float EvaporateRatio = 0.5f;
		const float SedimentCapacity = 0.10f * UISettings->SedimentCapacity; //DissolvingRatio; //0.01;

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

		// Apply the brush

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

Scope (from outer to inner):

file
class        class FLandscapeToolStrokeHydraErosion : public FLandscapeToolStrokeErosionBase
function     void Apply

Source code excerpt:

							bWaterExist = true;
							WaterData[Center] = (uint16)(WaterData[Center] * (1.0f - EvaporateRatio));
							float SedimentCap = SedimentCapacity*WaterData[Center];
							float SedimentDiff = SedimentData[Center] - SedimentCap;
							if (SedimentDiff > 0)
							{
								SedimentData[Center] -= static_cast<uint16>(SedimentDiff);
								HeightData[Center] = FMath::Clamp<uint16>(static_cast<uint16>(HeightData[Center] + SedimentDiff), 0, LandscapeDataAccess::MaxValue);
							}

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

Scope (from outer to inner):

file
function     ULandscapeEditorObject::ULandscapeEditorObject

Source code excerpt:


	, RainAmount(128)
	, SedimentCapacity(0.3f)
	, HErodeIterationNum(75)
	, RainDistMode(ELandscapeToolHydroErosionMode::Both)
	, RainDistScale(60.0f)
	, bHErosionDetailSmooth(true)
	, HErosionDetailScale(0.01f)

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

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Load

Source code excerpt:


	GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("RainAmount"), RainAmount, GEditorPerProjectIni);
	GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("SedimentCapacity"), SedimentCapacity, GEditorPerProjectIni);
	GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("HErodeIterationNum"), HErodeIterationNum, GEditorPerProjectIni);
	int32 InRainDistMode = (int32)RainDistMode;
	GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("RainDistNoiseMode"), InRainDistMode, GEditorPerProjectIni);
	RainDistMode = (ELandscapeToolHydroErosionMode)InRainDistMode;
	GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("RainDistScale"), RainDistScale, GEditorPerProjectIni);
	GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("HErosionDetailScale"), HErosionDetailScale, GEditorPerProjectIni);

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

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Save

Source code excerpt:


	GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("RainAmount"), RainAmount, GEditorPerProjectIni);
	GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("SedimentCapacity"), SedimentCapacity, GEditorPerProjectIni);
	GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("HErodeIterationNum"), ErodeIterationNum, GEditorPerProjectIni);
	GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("RainDistMode"), (int32)RainDistMode, GEditorPerProjectIni);
	GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("RainDistScale"), RainDistScale, GEditorPerProjectIni);
	GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("HErosionDetailScale"), HErosionDetailScale, GEditorPerProjectIni);
	GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bHErosionDetailSmooth"), bHErosionDetailSmooth, GEditorPerProjectIni);

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

Scope (from outer to inner):

file
class        class ULandscapeEditorObject : public UObject

Source code excerpt:

	// The amount of sediment that the water can carry. Larger values will result in more erosion
	UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Sediment Capacity", ShowForTools="HydraErosion", ClampMin="0.1", ClampMax="1.0"))
	float SedimentCapacity;

	// Number of erosion iterations, more means more erosion but is slower
	UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Iterations", ShowForTools="HydraErosion", ClampMin="1", ClampMax="300", UIMin="1", UIMax="150"))
	int32 HErodeIterationNum;

	// Selects how rain is distributed over the brush area for hydro erosion