bErosionUseLayerHardness

bErosionUseLayerHardness

#Overview

name: bErosionUseLayerHardness

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 bErosionUseLayerHardness is to control whether the erosion tool in the Unreal Engine 5 Landscape system takes into account the paint layer’s hardness parameter when applying erosion effects.

This setting variable is primarily used in the Landscape editing system, specifically in the erosion tool functionality. It is part of the LandscapeEditor module, which is responsible for providing tools and features for editing landscape terrains in Unreal Engine.

The value of this variable is set in the ULandscapeEditorObject class, which is likely initialized when the Landscape editor is opened. It can be loaded from and saved to the project’s configuration file (GEditorPerProjectIni) using the Load() and Save() functions of the ULandscapeEditorObject class.

This variable interacts with the WeightCache and LayerInfo objects, which are used to store and retrieve information about the landscape layers. When bErosionUseLayerHardness is true, the erosion tool will consider the hardness values of individual layers when calculating erosion effects.

Developers should be aware that enabling this option may have performance implications, as it requires additional calculations and data retrieval for each affected landscape layer. It may also produce different results compared to when the option is disabled, potentially affecting the visual outcome of the erosion tool.

Best practices when using this variable include:

  1. Consider the desired level of detail and realism for your landscape erosion effects.
  2. Test the erosion tool with this option both enabled and disabled to determine which produces the best results for your specific landscape.
  3. Be mindful of performance impacts, especially when working with large landscapes or multiple layers.
  4. Document the chosen setting in your project guidelines to ensure consistency across the development team.
  5. Regularly review and adjust this setting as your project’s requirements evolve.

#Setting Variables

#References In INI files

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

Scope (from outer to inner):

file
class        class FLandscapeToolStrokeErosion : public FLandscapeToolStrokeErosionBase
function     void Apply

Source code excerpt:


		TArray<uint8> WeightDatas; // Weight*Layers...
		if (UISettings->bErosionUseLayerHardness || bWeightApplied)
		{
			WeightCache.CacheData(X1, Y1, X2, Y2);
			WeightCache.GetCachedData(X1, Y1, X2, Y2, WeightDatas, LayerNum);
		}

		// Apply the brush	

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

Scope (from outer to inner):

file
class        class FLandscapeToolStrokeErosion : public FLandscapeToolStrokeErosionBase
function     void Apply

Source code excerpt:

						{
							float Softness = 1.0f;
							if (UISettings->bErosionUseLayerHardness)
							{
								for (int32 Idx = 0; Idx < LayerNum; Idx++)
								{
									ULandscapeLayerInfoObject* LayerInfo = this->LandscapeInfo->Layers[Idx].LayerInfoObj;
									if (LayerInfo)
									{

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

Scope (from outer to inner):

file
function     ULandscapeEditorObject::ULandscapeEditorObject

Source code excerpt:

	, ErosionNoiseMode(ELandscapeToolErosionMode::Lower)
	, ErosionNoiseScale(60.0f)
	, bErosionUseLayerHardness(false)

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

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

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Load

Source code excerpt:

	ErosionNoiseMode = (ELandscapeToolErosionMode)InErosionNoiseMode;
	GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("ErosionNoiseScale"), ErosionNoiseScale, GEditorPerProjectIni);
	GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bErosionUseLayerHardness"), bErosionUseLayerHardness, GEditorPerProjectIni);

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

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

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Save

Source code excerpt:

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

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

Scope (from outer to inner):

file
class        class ULandscapeEditorObject : public UObject

Source code excerpt:

	// Whether the erosion tool should take into account the paint layer's hardness parameter (a hardness of 0 means the layer is fully affected by erosion, while 1 means fully unaffected)
	UPROPERTY(Category = "Tool Settings", EditAnywhere, NonTransactional, meta = (DisplayName = "Use Layer Hardness", ShowForTools = "Erosion"))
	bool bErosionUseLayerHardness;

	// Hydraulic Erosion Tool:

	// The amount of rain to apply to the surface. Larger values will result in more erosion
	UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(ShowForTools="HydraErosion", ClampMin="1", ClampMax="512", UIMin="1", UIMax="256"))
	int32 RainAmount;