RainDistScale

RainDistScale

#Overview

name: RainDistScale

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 RainDistScale is to control the size of the noise filter used for applying initial rain to the surface in the Unreal Engine 5’s landscape erosion system. This setting variable is specifically used in the hydro-erosion tool for landscape editing.

The RainDistScale variable is primarily used in the Landscape Editor module of Unreal Engine 5. It’s part of the LandscapeEditorObject class, which handles various settings for landscape editing tools.

The value of this variable is set through the Unreal Engine editor interface, as it’s defined as an UPROPERTY with EditAnywhere attribute. It’s also loaded from and saved to the project’s configuration file (GEditorPerProjectIni) when the landscape editor is initialized or when settings are saved.

RainDistScale interacts with other erosion-related variables such as RainDistMode, HErodeIterationNum, and HErosionDetailScale. Together, these variables control different aspects of the hydro-erosion simulation on landscapes.

Developers should be aware that RainDistScale directly affects the initial distribution of rain in the erosion simulation. A larger value will create a broader, more spread-out rain distribution, while a smaller value will create a more localized, detailed rain pattern.

Best practices when using this variable include:

  1. Experimenting with different values to achieve the desired erosion effect, as the optimal value may vary depending on the scale and details of your landscape.
  2. Considering the interaction between RainDistScale and other erosion parameters to create realistic erosion patterns.
  3. Being mindful of performance implications when using very large values, as it may increase computation time for the erosion simulation.
  4. Using the clamp values (1 to 512) and UI range (1.1 to 256) as guidelines for reasonable value ranges.
  5. Saving preferred settings to the project configuration for consistency across editing sessions.

#Setting Variables

#References In INI files

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

Scope (from outer to inner):

file
class        class FLandscapeToolStrokeHydraErosion : public FLandscapeToolStrokeErosionBase
function     void Apply

Source code excerpt:


		// Only initial raining works better...
		FNoiseParameter NoiseParam(0, UISettings->RainDistScale, RainAmount);
		for (int32 Y = BrushInfo.GetBounds().Min.Y; Y < BrushInfo.GetBounds().Max.Y; Y++)
		{
			const float* BrushScanline = BrushInfo.GetDataPtr(FIntPoint(0, Y));
			auto* WaterDataScanline = WaterData.GetData() + (Y - Y1) * (X2 - X1 + 1) + (0 - X1);

			for (int32 X = BrushInfo.GetBounds().Min.X; X < BrushInfo.GetBounds().Max.X; X++)

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

Scope (from outer to inner):

file
function     ULandscapeEditorObject::ULandscapeEditorObject

Source code excerpt:

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

	, NoiseMode(ELandscapeToolNoiseMode::Both)
	, NoiseScale(128.0f)

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

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Load

Source code excerpt:

	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);
	bool InbHErosionDetailSmooth = bHErosionDetailSmooth;
	GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bHErosionDetailSmooth"), InbHErosionDetailSmooth, GEditorPerProjectIni);
	bHErosionDetailSmooth = InbHErosionDetailSmooth;

	int32 InNoiseMode = (int32)NoiseMode;

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

Scope (from outer to inner):

file
function     void ULandscapeEditorObject::Save

Source code excerpt:

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

	GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("NoiseMode"), (int32)NoiseMode, GEditorPerProjectIni);
	GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("NoiseScale"), NoiseScale, GEditorPerProjectIni);
	GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("SmoothFilterKernelSize"), SmoothFilterKernelSize, GEditorPerProjectIni);

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

Scope (from outer to inner):

file
class        class ULandscapeEditorObject : public UObject

Source code excerpt:

	// The size of the noise filter for applying initial rain to the surface
	UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(ShowForTools="HydraErosion", ClampMin="1", ClampMax="512", UIMin="1.1", UIMax="256"))
	float RainDistScale;

	// If checked, performs a detail-preserving smooth to the erosion effect using the specified detail smoothing value
	UPROPERTY(Category = "Tool Settings", NonTransactional, EditAnywhere, meta = (InlineEditConditionToggle))
	bool bHErosionDetailSmooth;

	// Larger detail smoothing values remove more details, while smaller values preserve more details