r.ParticleLODBias
r.ParticleLODBias
#Overview
name: r.ParticleLODBias
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
LOD bias for particle systems, default is 0
It is referenced in 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ParticleLODBias is to control the Level of Detail (LOD) bias for particle systems in Unreal Engine 5. It affects the rendering system, specifically the particle system rendering.
This setting variable is primarily used in the Engine’s particle system component and the MovieRenderPipeline plugin. The main subsystems that rely on this variable are:
- Particle System Component in the Engine module
- Movie Render Pipeline Core module
The value of this variable is set through the console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.
The associated variable GParticleLODBias interacts directly with r.ParticleLODBias. They share the same value, with GParticleLODBias being the actual integer variable used in the code, while r.ParticleLODBias is the console variable name used for setting and retrieving the value.
Developers should be aware of the following when using this variable:
- The default value is 0, which means no bias is applied.
- Positive values will increase the LOD level, potentially reducing visual quality but improving performance.
- Negative values will decrease the LOD level, potentially improving visual quality at the cost of performance.
- This variable is marked with ECVF_Scalability, indicating it’s intended for adjusting performance scaling.
Best practices when using this variable include:
- Use it for performance optimization, especially on lower-end hardware.
- Be cautious when setting extreme values, as they may significantly impact visual quality or performance.
- Consider using it in conjunction with other LOD-related settings for a balanced approach to performance optimization.
- When using the Movie Render Pipeline, be aware that it’s automatically set to -10 to ensure high-quality particle rendering during movie creation.
Regarding the associated variable GParticleLODBias:
The purpose of GParticleLODBias is to provide a C++ accessible integer that reflects the value of r.ParticleLODBias. It’s used internally by the engine to apply the LOD bias to particle systems.
This variable is used directly in the UParticleSystemComponent::SetLODLevel function to adjust the LOD level of particle systems. It’s added to the input LOD level before clamping to the available range of LOD levels.
Developers should be aware that modifying GParticleLODBias directly in C++ code is not recommended. Instead, they should use the r.ParticleLODBias console variable to ensure consistency across the engine.
Best practices for GParticleLODBias are similar to those for r.ParticleLODBias, with the additional note that reading this variable in C++ code is preferable to accessing the console variable directly for performance reasons.
#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:189
Scope: file
Source code excerpt:
int32 GParticleLODBias = 0;
FAutoConsoleVariableRef CVarParticleLODBias(
TEXT("r.ParticleLODBias"),
GParticleLODBias,
TEXT("LOD bias for particle systems, default is 0"),
ECVF_Scalability
);
static TAutoConsoleVariable<float> CVarQLSpawnRateReferenceLevel(
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/Graph/Nodes/MovieGraphGlobalGameOverrides.cpp:52
Scope (from outer to inner):
file
function void UMovieGraphGlobalGameOverridesNode::BuildNewProcessCommandLineArgsImpl
Source code excerpt:
InOutDeviceProfileCvars.Add(TEXT("r.ForceLOD=0"));
InOutDeviceProfileCvars.Add(TEXT("r.SkeletalMeshLODBias=-10"));
InOutDeviceProfileCvars.Add(TEXT("r.ParticleLODBias=-10"));
InOutDeviceProfileCvars.Add(TEXT("foliage.DitheredLOD=0"));
InOutDeviceProfileCvars.Add(TEXT("foliage.ForceLOD=0"));
}
if (bDisableHLODs)
{
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/Graph/Nodes/MovieGraphGlobalGameOverrides.cpp:118
Scope (from outer to inner):
file
function void UMovieGraphGlobalGameOverridesNode::ApplySettings
Source code excerpt:
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousForceLOD, TEXT("r.ForceLOD"), 0, bOverrideValues);
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousSkeletalMeshBias, TEXT("r.SkeletalMeshLODBias"), -10, bOverrideValues);
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousParticleLODBias, TEXT("r.ParticleLODBias"), -10, bOverrideValues);
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousFoliageDitheredLOD, TEXT("foliage.DitheredLOD"), 0, bOverrideValues);
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousFoliageForceLOD, TEXT("foliage.ForceLOD"), 0, bOverrideValues);
}
if (bDisableHLODs)
{
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineGameOverrideSetting.cpp:66
Scope (from outer to inner):
file
function void UMoviePipelineGameOverrideSetting::ApplyCVarSettings
Source code excerpt:
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousForceLOD, TEXT("r.ForceLOD"), 0, bOverrideValues);
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousSkeletalMeshBias, TEXT("r.SkeletalMeshLODBias"), -10, bOverrideValues);
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousParticleLODBias, TEXT("r.ParticleLODBias"), -10, bOverrideValues);
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousFoliageDitheredLOD, TEXT("foliage.DitheredLOD"), 0, bOverrideValues);
MOVIEPIPELINE_STORE_AND_OVERRIDE_CVAR_INT(PreviousFoliageForceLOD, TEXT("foliage.ForceLOD"), 0, bOverrideValues);
}
if (bDisableHLODs)
{
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Private/MoviePipelineGameOverrideSetting.cpp:192
Scope (from outer to inner):
file
function void UMoviePipelineGameOverrideSetting::BuildNewProcessCommandLineArgsImpl
Source code excerpt:
InOutDeviceProfileCvars.Add(TEXT("r.ForceLOD=0"));
InOutDeviceProfileCvars.Add(TEXT("r.SkeletalMeshLODBias=-10"));
InOutDeviceProfileCvars.Add(TEXT("r.ParticleLODBias=-10"));
InOutDeviceProfileCvars.Add(TEXT("foliage.DitheredLOD=0"));
InOutDeviceProfileCvars.Add(TEXT("foliage.ForceLOD=0"));
}
if (bDisableHLODs)
{
#Loc: <Workspace>/Engine/Plugins/MovieScene/MovieRenderPipeline/Source/MovieRenderPipelineCore/Public/Graph/Nodes/MovieGraphGlobalGameOverrides.h:119
Scope (from outer to inner):
file
function class MOVIERENDERPIPELINECORE_API UMovieGraphGlobalGameOverridesNode : public UMovieGraphSettingNode { GENERATED_BODY
Source code excerpt:
* - r.ForceLOD
* - r.SkeletalMeshLODBias
* - r.ParticleLODBias
* - foliage.DitheredLOD
* - foliage.ForceLOD
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Rendering", meta = (EditCondition = "bOverride_bDisableLODs"))
bool bDisableLODs;
/**
* Determines if hierarchical LODs should be disabled and their real meshes used instead, regardless of distance.
* Note that this does not affect World Partition HLODs.
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Rendering", meta = (EditCondition = "bOverride_bDisableHLODs"))
bool bDisableHLODs;
/**
* Flushing level streaming ensures that any pending changes to sub-levels or world partition are fully processed before we render
* the frame. This feature generally only adds to render times on the frames that have level visibility state changes, so generally
#Associated Variable and Callsites
This variable is associated with another variable named GParticleLODBias
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:187
Scope: file
Source code excerpt:
//////////////////////////////////////////////////////////////////////////
int32 GParticleLODBias = 0;
FAutoConsoleVariableRef CVarParticleLODBias(
TEXT("r.ParticleLODBias"),
GParticleLODBias,
TEXT("LOD bias for particle systems, default is 0"),
ECVF_Scalability
);
static TAutoConsoleVariable<float> CVarQLSpawnRateReferenceLevel(
TEXT("fx.QualityLevelSpawnRateScaleReferenceLevel"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleComponents.cpp:7386
Scope (from outer to inner):
file
function void UParticleSystemComponent::SetLODLevel
Source code excerpt:
}
int32 NewLODLevel = FMath::Clamp(InLODLevel + GParticleLODBias, 0, Template->GetLODLevelCount() - 1);
if (LODLevel != NewLODLevel)
{
MarkRenderStateDirty();
const int32 OldLODLevel = LODLevel;
LODLevel = NewLODLevel;