NoiseScale
NoiseScale
#Overview
name: NoiseScale
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 27
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of NoiseScale is to control the scale or frequency of noise applied in various Unreal Engine subsystems and plugins. It is primarily used in landscape editing, particle systems, and material generation to adjust the granularity of noise effects.
NoiseScale is utilized in several Unreal Engine subsystems and plugins:
- Landscape Editor: Used in terrain generation and editing tools.
- Particle Systems: Specifically in beam particle effects.
- Material Generation: Used in the MDL Importer plugin for material function generation.
- Camera Calibration: Applied in test scenarios for camera calibration.
- Vector Field Animation: Used in animated vector fields for visual effects.
The value of NoiseScale is typically set through editor interfaces or programmatically in C++ code. It is often exposed as an editable property in various classes and can be adjusted in the Unreal Editor.
NoiseScale frequently interacts with other variables related to noise generation, such as NoiseAmount, NoiseType, and various distribution parameters.
Developers should be aware that:
- The effect of NoiseScale can vary depending on the context it’s used in.
- It often needs to be balanced with other parameters to achieve the desired visual effect.
- Extreme values may lead to undesirable results or performance issues.
Best practices when using NoiseScale include:
- Start with small adjustments and incrementally change the value to understand its impact.
- Consider the scale of your scene or effect when setting NoiseScale.
- Use it in conjunction with other noise parameters for more complex and natural-looking results.
- When used in performance-sensitive areas like particle systems, be mindful of the computational cost of high-frequency noise.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseEditorPerProjectUserSettings.ini:753, section: [LandscapeEdit]
- INI Section:
LandscapeEdit
- Raw value:
128.000000
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/Enterprise/MDLImporter/Source/MDLImporter/Private/generator/FunctionGenerator.h:1234
Scope (from outer to inner):
file
function void BaseFlakeNoiseTexture
Source code excerpt:
UMaterialExpressionMaterialFunctionCall* MiNoise2 =
NewMaterialExpressionFunctionCall(Function, ImporterMiNoise, {NewMaterialExpressionFloor(Function, Pos3)});
UMaterialExpressionIf* NoiseScale = NewMaterialExpressionIfEqual(Function, NoiseType, 0.0f, {MiNoise2, 1}, {MiNoise, 1});
UMaterialExpressionMultiply* ReflectivityCalculation = NewMaterialExpressionMultiply(
Function, NewMaterialExpressionPower(Function, NoiseScale, NewMaterialExpressionDivide(Function, 1.0f, Density)), Intensity);
UMaterialExpressionIf* CellDistanceCheck =
NewMaterialExpressionIfGreater(Function, CellDistance, MaximumSize, 0.0f, ReflectivityCalculation);
UMaterialExpressionIf* Reflectivity = NewMaterialExpressionIfEqual(
Function, Scale, 0.0f, 0.0f, NewMaterialExpressionIfEqual(Function, NoiseType, 1.0f, CellDistanceCheck, ReflectivityCalculation));
UMaterialExpressionIf* Tint =
NewMaterialExpressionIfEqual(Function, Scale, 0.0f, {0.0f, 0.0f, 0.0f},
#Loc: <Workspace>/Engine/Plugins/VirtualProduction/CameraCalibration/Source/CameraCalibrationEditor/Private/TestCameraCalibration.cpp:199
Scope (from outer to inner):
file
namespace UE::Private::CameraCalibration::AutomatedTests
function void TestDistortionCalibration
Source code excerpt:
NoisyPoints.Points.Reserve(Object.Num());
const double NoiseScale = TestSettings->ObjectPointNoiseScale;
const double NoiseX = (FMath::SRand() - 0.5) * (NoiseScale * 2);
const double NoiseY = (FMath::SRand() - 0.5) * (NoiseScale * 2);
const double NoiseZ = (FMath::SRand() - 0.5) * (NoiseScale * 2);
for (const FVector& Point : Object)
{
NoisyPoints.Points.Add(Point + FVector(NoiseX, NoiseY, NoiseZ));
}
#Loc: <Workspace>/Engine/Plugins/VirtualProduction/CameraCalibration/Source/CameraCalibrationEditor/Private/TestCameraCalibration.cpp:224
Scope (from outer to inner):
file
namespace UE::Private::CameraCalibration::AutomatedTests
function void TestDistortionCalibration
Source code excerpt:
for (const FVector2f& Point : Image)
{
const double NoiseScale = TestSettings->ImagePointNoiseScale;
const double NoiseX = (FMath::SRand() - 0.5) * (NoiseScale * 2);
const double NoiseY = (FMath::SRand() - 0.5) * (NoiseScale * 2);
const FVector2f PointWithNoise = Point + FVector2f(NoiseX, NoiseY);
NoisyPoints.Points.Add(FVector2D(PointWithNoise.X, PointWithNoise.Y));
}
NoisyImagePoints.Add(NoisyPoints);
#Loc: <Workspace>/Engine/Plugins/VirtualProduction/CameraCalibration/Source/CameraCalibrationEditor/Private/TestCameraCalibration.cpp:379
Scope (from outer to inner):
file
namespace UE::Private::CameraCalibration::AutomatedTests
function void TestNodalOffsetCalibration
Source code excerpt:
NoisyObjectPoints.Reserve(ObjectPoints.Num());
{
const double NoiseScale = TestSettings->ObjectPointNoiseScale;
const double NoiseX = (FMath::SRand() - 0.5) * (NoiseScale * 2);
const double NoiseY = (FMath::SRand() - 0.5) * (NoiseScale * 2);
const double NoiseZ = (FMath::SRand() - 0.5) * (NoiseScale * 2);
for (const FVector& Point : ObjectPoints)
{
NoisyObjectPoints.Add(Point + FVector(NoiseX, NoiseY, NoiseZ));
}
}
#Loc: <Workspace>/Engine/Plugins/VirtualProduction/CameraCalibration/Source/CameraCalibrationEditor/Private/TestCameraCalibration.cpp:396
Scope (from outer to inner):
file
namespace UE::Private::CameraCalibration::AutomatedTests
function void TestNodalOffsetCalibration
Source code excerpt:
for (const FVector2f& Point : ImagePoints)
{
const double NoiseScale = TestSettings->ImagePointNoiseScale;
const double NoiseX = (FMath::SRand() - 0.5) * (NoiseScale * 2);
const double NoiseY = (FMath::SRand() - 0.5) * (NoiseScale * 2);
NoisyImagePoints.Add(Point + FVector2f(NoiseX, NoiseY));
}
/**
* Step 4: Run SolvePnP to solve for the camera pose using imperfect input data, including noisy data and an incorrect guess for focal length
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModePaintTools.cpp:1345
Scope (from outer to inner):
file
class class FLandscapeToolStrokeNoise : public FLandscapeToolStrokePaintBase<ToolTarget>
function void Apply
Source code excerpt:
if (bUseWeightTargetValue)
{
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)
{
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModePaintTools.cpp:1368
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/LandscapeEdModeTools.h:27
Scope: file
Source code excerpt:
{
float Base;
float NoiseScale;
float NoiseAmount;
// Constructors.
FNoiseParameter()
{
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeTools.h:37
Scope (from outer to inner):
file
function FNoiseParameter
Source code excerpt:
FNoiseParameter(float InBase, float InScale, float InAmount) :
Base(InBase),
NoiseScale(InScale),
NoiseAmount(InAmount)
{
}
// Sample
float Sample(int32 X, int32 Y) const
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeTools.h:49
Scope (from outer to inner):
file
function float Sample
Source code excerpt:
Y = FMath::Abs(Y);
if (NoiseScale > DELTA)
{
for (uint32 Octave = 0; Octave < 4; Octave++)
{
float OctaveShift = static_cast<float>(1 << Octave);
float OctaveScale = OctaveShift / NoiseScale;
Noise += PerlinNoise2D(X * OctaveScale, Y * OctaveScale) / OctaveShift;
}
}
return Base + Noise * NoiseAmount;
}
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeTools.h:67
Scope (from outer to inner):
file
function bool TestGreater
Source code excerpt:
float ParameterValue = Base;
if (NoiseScale > DELTA)
{
for (uint32 Octave = 0; Octave < 4; Octave++)
{
float OctaveShift = static_cast<float>(1 << Octave);
float OctaveAmplitude = NoiseAmount / OctaveShift;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeTools.h:82
Scope (from outer to inner):
file
function bool TestGreater
Source code excerpt:
else
{
float OctaveScale = OctaveShift / NoiseScale;
ParameterValue += PerlinNoise2D(X * OctaveScale, Y * OctaveScale) * OctaveAmplitude;
}
}
}
return TestValue >= ParameterValue;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeTools.h:100
Scope (from outer to inner):
file
function bool operator==
Source code excerpt:
{
if ((Base == SrcNoise.Base) &&
(NoiseScale == SrcNoise.NoiseScale) &&
(NoiseAmount == SrcNoise.NoiseAmount))
{
return true;
}
return false;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEdModeTools.h:112
Scope (from outer to inner):
file
function void operator=
Source code excerpt:
{
Base = SrcNoise.Base;
NoiseScale = SrcNoise.NoiseScale;
NoiseAmount = SrcNoise.NoiseAmount;
}
float Fade(float T) const
{
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:71
Scope (from outer to inner):
file
function ULandscapeEditorObject::ULandscapeEditorObject
Source code excerpt:
, NoiseMode(ELandscapeToolNoiseMode::Both)
, NoiseScale(128.0f)
, bUseSelectedRegion(true)
, bUseNegativeMask(true)
, PasteMode(ELandscapeToolPasteMode::Both)
, bApplyToAllTargets(true)
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:293
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Load
Source code excerpt:
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);
bDetailSmooth = InbDetailSmooth;
#Loc: <Workspace>/Engine/Source/Editor/LandscapeEditor/Private/LandscapeEditorObject.cpp:438
Scope (from outer to inner):
file
function void ULandscapeEditorObject::Save
Source code excerpt:
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:435
Scope (from outer to inner):
file
class class ULandscapeEditorObject : public UObject
Source code excerpt:
// 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:
// Uses selected region as a mask for other tools
UPROPERTY(Category="Tool Settings", EditAnywhere, NonTransactional, meta=(DisplayName="Use Region as Mask", ShowForTools="Mask", ShowForMask))
bool bUseSelectedRegion;
#Loc: <Workspace>/Engine/Source/Programs/Enterprise/Datasmith/DatasmithMaxExporter/Private/MaxMaterialsToUEPbr/DatasmithMaxTexmapToUEPbr.cpp:1418
Scope (from outer to inner):
file
function IDatasmithMaterialExpression* FDatasmithMaxNoiseToUEPbr::Convert
Source code excerpt:
Map2->ConnectExpression( *Lerp->GetInput(1) );
IDatasmithMaterialExpressionScalar* NoiseScale = static_cast< IDatasmithMaterialExpressionScalar* >( MaterialElement.AddMaterialExpression( EDatasmithMaterialExpressionType::ConstantScalar ) );
NoiseScale->SetName( TEXT("Noise Scale") );
NoiseScale->GetScalar() = 0.1f / NoiseParameters.Size;
IDatasmithMaterialExpressionGeneric* NoiseScaleMultiply = static_cast< IDatasmithMaterialExpressionGeneric* >( MaterialElement.AddMaterialExpression( EDatasmithMaterialExpressionType::Generic ) );
NoiseScaleMultiply->SetExpressionName( TEXT("Multiply") );
NoiseScale->ConnectExpression( *NoiseScaleMultiply->GetInput(1) );
IDatasmithMaterialExpressionFunctionCall* LocalPosition = static_cast< IDatasmithMaterialExpressionFunctionCall* >( MaterialElement.AddMaterialExpression( EDatasmithMaterialExpressionType::FunctionCall ) );
LocalPosition->SetFunctionPathName( TEXT("/Engine/Functions/Engine_MaterialFunctions02/WorldPositionOffset/LocalPosition") );
LocalPosition->ConnectExpression( *NoiseScaleMultiply->GetInput(0) );
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Particles/Beam/ParticleModuleBeamNoise.h:122
Scope (from outer to inner):
file
class class UParticleModuleBeamNoise : public UParticleModuleBeamBase
Source code excerpt:
*/
UPROPERTY(EditAnywhere, Category=LowFreq)
struct FRawDistributionFloat NoiseScale;
/** Initializes the default values for this property */
void InitializeDefaults();
//Begin UObject Interface
#if WITH_EDITOR
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/VectorField/VectorFieldAnimated.h:75
Scope (from outer to inner):
file
class class UVectorFieldAnimated : public UVectorField
Source code excerpt:
/** Scale to apply to vectors in the noise field. */
UPROPERTY(EditAnywhere, Category=Noise)
float NoiseScale;
/** The maximum magnitude of noise vectors to apply. */
UPROPERTY(EditAnywhere, Category=Noise)
float NoiseMax;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleBeamModules.cpp:392
Scope (from outer to inner):
file
function void UParticleModuleTypeDataBeam2::Update
Source code excerpt:
{
float Delta = (float)Count / (float)(Freq);
*NoiseDistanceScale = BeamNoise->NoiseScale.GetValue(Delta);
}
}
else
{
// If locked, just use the noise frequency to determine steps
BeamData->StepSize = FullMagnitude / double(Freq + 1);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleBeamModules.cpp:441
Scope (from outer to inner):
file
function void UParticleModuleTypeDataBeam2::Update
Source code excerpt:
{
float Delta = (float)Count / (float)(Freq);
*NoiseDistanceScale = BeamNoise->NoiseScale.GetValue(Delta);
}
}
else
{
// If we are not doing noisy interpolation
// Determine the step size for the full beam
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleBeamModules.cpp:1332
Scope (from outer to inner):
file
function void UParticleModuleBeamNoise::InitializeDefaults
Source code excerpt:
}
if (!NoiseScale.IsCreated())
{
NoiseScale.Distribution = NewObject<UDistributionFloatConstantCurve>(this, TEXT("DistributionNoiseScale"));
}
}
void UParticleModuleBeamNoise::PostInitProperties()
{
Super::PostInitProperties();
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleBeamModules.cpp:1359
Scope (from outer to inner):
file
function void UParticleModuleBeamNoise::PostInitProperties
Source code excerpt:
NoiseTangentStrength.Distribution = DistributionNoiseTangentStrength;
NoiseScale.Distribution = NewObject<UDistributionFloatConstantCurve>(this, TEXT("DistributionNoiseScale"));
}
}
void UParticleModuleBeamNoise::Spawn(FParticleEmitterInstance* Owner, int32 Offset, float SpawnTime, FBaseParticle* ParticleBase)
{
if (bLowFreq_Enabled == false)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VectorField.cpp:943
Scope: file
Source code excerpt:
SHADER_PARAMETER( FVector3f, VoxelSize )
SHADER_PARAMETER( float, FrameLerp )
SHADER_PARAMETER( float, NoiseScale )
SHADER_PARAMETER( float, NoiseMax )
SHADER_PARAMETER( uint32, Op )
END_GLOBAL_SHADER_PARAMETER_STRUCT()
IMPLEMENT_GLOBAL_SHADER_PARAMETER_STRUCT(FCompositeAnimatedVectorFieldUniformParameters,"CVF");
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/VectorField.cpp:1150
Scope (from outer to inner):
file
class class FVectorFieldAnimatedResource : public FVectorFieldResource
function virtual void Update
Source code excerpt:
Parameters.VoxelSize = FVector3f(1.0f / SizeX, 1.0f / SizeY, 1.0f / SizeZ);
Parameters.FrameLerp = FMath::Fractional(FrameTime);
Parameters.NoiseScale = AnimatedVectorField->NoiseScale;
Parameters.NoiseMax = AnimatedVectorField->NoiseMax;
Parameters.Op = (uint32)AnimatedVectorField->ConstructionOp;
FCompositeAnimatedVectorFieldUniformBufferRef UniformBuffer =
FCompositeAnimatedVectorFieldUniformBufferRef::CreateUniformBufferImmediate(Parameters, UniformBuffer_SingleDraw);