fx.QualityLevelSpawnRateScaleReferenceLevel
fx.QualityLevelSpawnRateScaleReferenceLevel
#Overview
name: fx.QualityLevelSpawnRateScaleReferenceLevel
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Controls the reference level for quality level based spawn rate scaling. This is the FX quality level\nat which spawn rate is not scaled down; Spawn rate scaling will happen by each emitter\'s\nQualityLevelSpawnRateScale value for each reduction in level below the reference level.\n\nDefault = 2. Value should range from 0 to the maximum FX quality level.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of fx.QualityLevelSpawnRateScaleReferenceLevel is to control the reference level for quality-based spawn rate scaling in the particle system of Unreal Engine 5. It is primarily used in the rendering system, specifically for particle effects.
This setting variable is relied upon by the Engine module, particularly in the particle components subsystem. It’s used to determine how particle spawn rates should be scaled based on the current graphics quality settings.
The value of this variable is set as a console variable with a default value of 2. It can be modified at runtime through the console or programmatically.
The associated variable CVarQLSpawnRateReferenceLevel directly interacts with fx.QualityLevelSpawnRateScaleReferenceLevel. They share the same value and purpose.
Developers must be aware that this variable affects the performance and visual quality of particle effects. It determines the baseline quality level at which no spawn rate scaling occurs. For quality levels below this reference, spawn rates will be scaled down according to each emitter’s QualityLevelSpawnRateScale value.
Best practices when using this variable include:
- Carefully consider the default value (2) and adjust it based on your game’s performance targets and visual requirements.
- Ensure that particle emitters’ QualityLevelSpawnRateScale values are set appropriately to work well with this reference level.
- Test thoroughly across different quality settings to ensure a smooth degradation of particle effects as quality decreases.
Regarding the associated variable CVarQLSpawnRateReferenceLevel:
- Its purpose is identical to fx.QualityLevelSpawnRateScaleReferenceLevel.
- It’s used in the UParticleEmitter::GetQualityLevelSpawnRateMult function to calculate the spawn rate multiplier based on the current effects quality and the reference level.
- The value is retrieved using GetValueOnAnyThread, indicating it can be accessed from multiple threads.
- Developers should be aware that changes to this variable will affect all particle emitters in the game.
- Best practices include ensuring thread-safe access when modifying this value and considering the performance implications of frequent changes.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:196
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarQLSpawnRateReferenceLevel(
TEXT("fx.QualityLevelSpawnRateScaleReferenceLevel"),
2,
TEXT("Controls the reference level for quality level based spawn rate scaling. This is the FX quality level\n")
TEXT("at which spawn rate is not scaled down; Spawn rate scaling will happen by each emitter's\n")
TEXT("QualityLevelSpawnRateScale value for each reduction in level below the reference level.\n")
TEXT("\n")
TEXT("Default = 2. Value should range from 0 to the maximum FX quality level."),
#Associated Variable and Callsites
This variable is associated with another variable named CVarQLSpawnRateReferenceLevel
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:195
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarQLSpawnRateReferenceLevel(
TEXT("fx.QualityLevelSpawnRateScaleReferenceLevel"),
2,
TEXT("Controls the reference level for quality level based spawn rate scaling. This is the FX quality level\n")
TEXT("at which spawn rate is not scaled down; Spawn rate scaling will happen by each emitter's\n")
TEXT("QualityLevelSpawnRateScale value for each reduction in level below the reference level.\n")
TEXT("\n")
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:1978
Scope (from outer to inner):
file
function float UParticleEmitter::GetQualityLevelSpawnRateMult
Source code excerpt:
{
int32 EffectsQuality = Scalability::GetEffectsQualityDirect(IsInGameThread() || IsInParallelGameThread());
int32 ReferenceLevel = CVarQLSpawnRateReferenceLevel.GetValueOnAnyThread(true);
float Level = (ReferenceLevel - EffectsQuality);
float Q = FMath::Pow(QualityLevelSpawnRateScale, Level);
return FMath::Min(1.0f, Q);
}
bool UParticleEmitter::HasAnyEnabledLODs()const