NoiseMode
NoiseMode
#Overview
name: NoiseMode
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 11
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of NoiseMode is to control the behavior of noise generation in various Unreal Engine subsystems, particularly in landscape editing and particle effects.
NoiseMode is primarily used in the Niagara particle system and the Landscape Editor module of Unreal Engine 5. Based on the callsites, we can see that it’s utilized in the following subsystems and modules:
- Niagara FX system (Plugins/FX/Niagara)
- Landscape Editor (Source/Editor/LandscapeEditor)
The value of this variable is set in different ways depending on the context:
- In Niagara, it’s set as a property of the UNiagaraStatelessModule_CurlNoiseForce class.
- In the Landscape Editor, it’s set as a property of the ULandscapeEditorObject class and can be modified through the editor interface.
NoiseMode interacts with other variables such as NoiseFrequency, NoiseTexture, and NoiseScale. These variables work together to define the characteristics of the noise being generated.
Developers should be aware that:
- The interpretation of NoiseMode can vary between different systems (e.g., Niagara vs. Landscape Editor).
- In the Landscape Editor, NoiseMode affects how noise is applied to the landscape (raising, lowering, or both).
- In Niagara, NoiseMode is used in curl noise force calculations for particle systems.
Best practices when using this variable include:
- Understand the context in which NoiseMode is being used (Niagara or Landscape Editor).
- When working with Niagara, ensure that the NoiseMode is set appropriately for the desired curl noise effect.
- In Landscape Editing, experiment with different NoiseMode settings to achieve the desired terrain modification effect.
- Always consider the interaction between NoiseMode and related variables (NoiseScale, NoiseFrequency, etc.) to achieve the desired outcome.
- Use the appropriate enum values (e.g., ELandscapeToolNoiseMode or ENSM_NoiseMode) when setting the NoiseMode to ensure type safety and clarity.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:752, section: [LandscapeEdit]
- INI Section:
LandscapeEdit
- Raw value:
0
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Internal/Stateless/Modules/NiagaraStatelessModuleCommon.h:33
Scope (from outer to inner):
file
namespace NiagaraStateless
Source code excerpt:
float NoiseFrequency = 0.0f;
UObject* NoiseTexture = nullptr;
int32 NoiseMode = 0;
int32 NoiseLUTOffset = 0;
int32 NoiseLUTNumChannel = 0;
int32 NoiseLUTChannelWidth = 0;
};
}
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Internal/Stateless/Modules/NiagaraStatelessModule_CurlNoiseForce.h:32
Scope (from outer to inner):
file
class class UNiagaraStatelessModule_CurlNoiseForce : public UNiagaraStatelessModule
Source code excerpt:
UPROPERTY(EditAnywhere, Category = "Parameters")
ENSM_NoiseMode NoiseMode = ENSM_NoiseMode::VectorField;
UPROPERTY(EditAnywhere, Category = "Parameters", meta = (AllowedClasses = "/Script/Engine.VectorField,/Script/Engine.VolumeTexture,/Script/Engine.TextureRenderTargetVolume"))
TObjectPtr<UObject> NoiseTexture;
virtual void BuildEmitterData(FNiagaraStatelessEmitterDataBuildContext& BuildContext) const override;
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Internal/Stateless/Modules/NiagaraStatelessModule_SolveVelocitiesAndForces.h:46
Scope (from outer to inner):
file
class class UNiagaraStatelessModule_SolveVelocitiesAndForces : public UNiagaraStatelessModule
function virtual void BuildEmitterData
Source code excerpt:
BuiltData->NoiseFrequency = PhysicsBuildData.NoiseFrequency;
BuiltData->NoiseTexture = PhysicsBuildData.NoiseTexture;
BuiltData->NoiseMode = PhysicsBuildData.NoiseMode;
BuiltData->NoiseLUTOffset = PhysicsBuildData.NoiseLUTOffset;
BuiltData->NoiseLUTNumChannel = PhysicsBuildData.NoiseLUTNumChannel;
BuiltData->NoiseLUTChannelWidth = PhysicsBuildData.NoiseLUTChannelWidth;
}
virtual void SetShaderParameters(const FNiagaraStatelessSetShaderParameterContext& SetShaderParameterContext) const override
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Internal/Stateless/Modules/NiagaraStatelessModule_SolveVelocitiesAndForces.h:85
Scope (from outer to inner):
file
class class UNiagaraStatelessModule_SolveVelocitiesAndForces : public UNiagaraStatelessModule
function virtual void SetShaderParameters
Source code excerpt:
Parameters->SolveVelocitiesAndForces_NoiseFrequency = FVector3f(ModuleBuiltData->NoiseFrequency, ModuleBuiltData->NoiseFrequency, ModuleBuiltData->NoiseFrequency);
//SetShaderParameterContext.SetTextureResource(&Parameters->SolveVelocitiesAndForces_NoiseTexture, ModuleBuildData->NoiseTexture);
Parameters->SolveVelocitiesAndForces_NoiseMode = ModuleBuiltData->NoiseMode;
Parameters->SolveVelocitiesAndForces_NoiseLUTOffset = ModuleBuiltData->NoiseLUTOffset;
Parameters->SolveVelocitiesAndForces_NoiseLUTNumChannel = ModuleBuiltData->NoiseLUTNumChannel;
Parameters->SolveVelocitiesAndForces_NoiseLUTChannelWidth = ModuleBuiltData->NoiseLUTChannelWidth;
FVectorFieldTextureAccessor TextureAccessor(Cast<UVectorField>(ModuleBuiltData->NoiseTexture));
#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/Stateless/Modules/NiagaraStatelessModule_CurlNoiseForce.cpp:312
Scope (from outer to inner):
file
function void UNiagaraStatelessModule_CurlNoiseForce::BuildEmitterData
Source code excerpt:
PhysicsBuildData.NoiseFrequency = NoiseFrequency;
PhysicsBuildData.NoiseTexture = NoiseTexture;
PhysicsBuildData.NoiseMode = int32(NoiseMode);
// Build LUT
{
static int32 NumChannelsToBuild = 64;
static int32 ChannelWidth = 64;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModePaintTools.cpp:1347
Scope (from outer to inner):
file
class class FLandscapeToolStrokeNoise : public FLandscapeToolStrokePaintBase<ToolTarget>
function void Apply
Source code excerpt:
FNoiseParameter NoiseParam(0, UISettings->NoiseScale, 255.0f / 2.0f);
float DestValue = NoiseModeConversion(ELandscapeToolNoiseMode::Add, NoiseParam.NoiseAmount, NoiseParam.Sample(X, Y)) * UISettings->WeightTargetValue;
switch (UISettings->NoiseMode)
{
case ELandscapeToolNoiseMode::Add:
if (OriginalValue >= DestValue)
{
continue;
}
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModePaintTools.cpp:1369
Scope (from outer to inner):
file
class class FLandscapeToolStrokeNoise : public FLandscapeToolStrokePaintBase<ToolTarget>
function void Apply
Source code excerpt:
float TotalStrength = BrushValue * PaintStrength * Pressure * ToolTarget::StrengthMultiplier(this->LandscapeInfo, UISettings->GetCurrentToolBrushRadius());
FNoiseParameter NoiseParam(0, UISettings->NoiseScale, TotalStrength * BrushSizeAdjust);
float PaintAmount = NoiseModeConversion(UISettings->NoiseMode, NoiseParam.NoiseAmount, NoiseParam.Sample(X, Y));
DataScanline[X] = static_cast<ValueType>(ToolTarget::CacheClass::ClampValue(static_cast<int32>(OriginalValue + PaintAmount)));
}
}
}
}
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:70
Scope (from outer to inner):
file
function ULandscapeEditorObject::ULandscapeEditorObject
Source code excerpt:
, HErosionDetailScale(0.01f)
, NoiseMode(ELandscapeToolNoiseMode::Both)
, NoiseScale(128.0f)
, bUseSelectedRegion(true)
, bUseNegativeMask(true)
, PasteMode(ELandscapeToolPasteMode::Both)
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:290
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Load
Source code excerpt:
bHErosionDetailSmooth = InbHErosionDetailSmooth;
int32 InNoiseMode = (int32)NoiseMode;
GConfig->GetInt(TEXT("LandscapeEdit"), TEXT("NoiseMode"), InNoiseMode, GEditorPerProjectIni);
NoiseMode = (ELandscapeToolNoiseMode)InNoiseMode;
GConfig->GetFloat(TEXT("LandscapeEdit"), TEXT("NoiseScale"), NoiseScale, GEditorPerProjectIni);
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);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:437
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Save
Source code excerpt:
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);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("DetailScale"), DetailScale, GEditorPerProjectIni);
GConfig->SetBool(TEXT("LandscapeEdit"), TEXT("bDetailSmooth"), bDetailSmooth, GEditorPerProjectIni);
GConfig->SetFloat(TEXT("LandscapeEdit"), TEXT("MaximumValueRadius"), MaximumValueRadius, GEditorPerProjectIni);
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Public/LandscapeEditorObject.h:431
Scope (from outer to inner):
file
class class ULandscapeEditorObject : public UObject
Source code excerpt:
// Whether to apply noise that raises, lowers, or both
UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Noise Mode", ShowForTools="Noise"))
ELandscapeToolNoiseMode NoiseMode;
// The size of the perlin noise filter used
UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Noise Scale", ShowForTools="Noise", ClampMin="1", ClampMax="512", UIMin="1.1", UIMax="256"))
float NoiseScale;
// Mask Tool: