DetailScale
DetailScale
#Overview
name: DetailScale
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 7
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of DetailScale is to control the level of detail smoothing in the Unreal Engine 5 landscape editing system. It is used specifically within the smooth tool functionality of the landscape editor.
This setting variable is primarily used in the LandscapeEditor module, which is part of the Unreal Engine’s landscape editing system. It is utilized in the smooth tool operations, particularly in the LowPassFilter function.
The value of this variable is set in the ULandscapeEditorObject constructor with a default value of 0.3f. It can be modified through the Unreal Engine editor interface and is saved to and loaded from the project’s configuration file (GEditorPerProjectIni).
DetailScale interacts with the bDetailSmooth boolean variable, which determines whether detail smoothing is applied. When bDetailSmooth is true, the DetailScale value is used in the smoothing calculations.
Developers should be aware that DetailScale affects the level of detail preservation during smoothing operations. Larger values remove more details, while smaller values preserve more details. The variable is clamped between 0 and 0.99 in the editor interface.
Best practices when using this variable include:
- Adjusting it incrementally to find the right balance between smoothing and detail preservation for your specific landscape.
- Using it in conjunction with other smoothing parameters like SmoothFilterKernelSize for more precise control.
- Testing the effects on different scales of landscape features to ensure desired results across the entire terrain.
- Considering performance implications when using very small values, as they may result in more detailed calculations.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:755, section: [LandscapeEdit]
- INI Section:
LandscapeEdit
- Raw value:
0.300000
- 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/LandscapeEdModePaintTools.cpp:763
Scope (from outer to inner):
file
class class FLandscapeToolStrokeSmooth : public FLandscapeToolStrokePaintBase<ToolTarget>
function void Apply
Source code excerpt:
if (UISettings->bDetailSmooth)
{
LowPassFilter<ValueType>(X1, Y1, X2, Y2, BrushInfo, Data, UISettings->DetailScale, ToolStrength);
}
else
{
const int32 FilterRadius = UISettings->SmoothFilterKernelSize;
for (int32 Y = BrushInfo.GetBounds().Min.Y; Y < BrushInfo.GetBounds().Max.Y; Y++)
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeTools.h:164
Scope (from outer to inner):
file
function inline void LowPassFilter
Source code excerpt:
template<typename DataType>
inline void LowPassFilter(int32 X1, int32 Y1, int32 X2, int32 Y2, FLandscapeBrushData& BrushInfo, TArray<DataType>& Data, const float DetailScale, const float ApplyRatio = 1.0f)
{
#if WITH_KISSFFT
// Low-pass filter
int32 FFTWidth = X2 - X1 - 1;
int32 FFTHeight = Y2 - Y1 - 1;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeTools.h:233
Scope (from outer to inner):
file
function inline void LowPassFilter
Source code excerpt:
}
// High frequency removal
float Ratio = 1.0f - DetailScale;
float Dist = FMath::Min<float>((Dims[0] * Ratio)*(Dims[0] * Ratio), (Dims[1] * Ratio)*(Dims[1] * Ratio));
float Filter = 1.0f / (1.0f + DistFromCenter / Dist);
CA_SUPPRESS(6385);
out[X + Y*Dims[1]].r *= Filter;
out[X + Y*Dims[1]].i *= Filter;
}
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:53
Scope (from outer to inner):
file
function ULandscapeEditorObject::ULandscapeEditorObject
Source code excerpt:
, SmoothFilterKernelSize(4)
, bDetailSmooth(false)
, DetailScale(0.3f)
, ErodeThresh(64)
, ErodeSurfaceThickness(256)
, ErodeIterationNum(28)
, ErosionNoiseMode(ELandscapeToolErosionMode::Lower)
, ErosionNoiseScale(60.0f)
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:296
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Load
Source code excerpt:
GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("SmoothFilterKernelSize"), SmoothFilterKernelSize, GEditorPerProjectIni);
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("DetailScale"), DetailScale, GEditorPerProjectIni);
bool InbDetailSmooth = bDetailSmooth;
GConfig->GetBool(TEXT("LandscapeEdit"), TEXT("bDetailSmooth"), InbDetailSmooth, GEditorPerProjectIni);
bDetailSmooth = InbDetailSmooth;
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("MaximumValueRadius"), MaximumValueRadius, GEditorPerProjectIni);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:440
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Save
Source code excerpt:
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("NoiseScale"), NoiseScale, GEditorPerProjectIni);
GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("SmoothFilterKernelSize"), SmoothFilterKernelSize, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("DetailScale"), DetailScale, GEditorPerProjectIni);
GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bDetailSmooth"), bDetailSmooth, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("MaximumValueRadius"), MaximumValueRadius, GEditorPerProjectIni);
GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bSmoothGizmoBrush"), bSmoothGizmoBrush, GEditorPerProjectIni);
GConfig->SetInt(TEXT("LandscapeEdit"), TEXT("PasteMode"), (int32)PasteMode, GEditorPerProjectIni);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Public/LandscapeEditorObject.h:369
Scope (from outer to inner):
file
class class ULandscapeEditorObject : public UObject
Source code excerpt:
// Larger detail smoothing values remove more details, while smaller values preserve more details
UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Detail Smooth", EditCondition="bDetailSmooth", ShowForTools="Smooth", ClampMin="0", ClampMax="0.99"))
float DetailScale;
// Erosion Tool:
// 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;