r.ParticleLightQuality
r.ParticleLightQuality
#Overview
name: r.ParticleLightQuality
The value of this variable can be defined or overridden in .ini config files. 5
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0: No lights. 1:Only simple lights. 2:Simple+HQ lights
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ParticleLightQuality is to control the quality of particle lighting in the rendering system of Unreal Engine 5. It determines the level of detail and complexity for particle lights within the game or application.
This setting variable is primarily used by the particle system and rendering modules of Unreal Engine. Based on the callsites, it’s directly referenced in the Engine module, specifically in the particle systems implementation.
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 2, which represents the highest quality setting. The value can be changed at runtime through console commands or programmatically.
The r.ParticleLightQuality variable interacts closely with its associated variable CVarParticleLightQuality. They share the same value and purpose, with CVarParticleLightQuality being the actual TAutoConsoleVariable object that manages the setting.
Developers must be aware that this variable has three possible values: 0: No particle lights 1: Only simple particle lights 2: Both simple and high-quality particle lights
When using this variable, developers should consider the performance implications of higher quality settings. Higher values may impact performance, especially on lower-end hardware.
Best practices for using this variable include:
- Adjusting it based on the target platform and performance requirements.
- Using it in conjunction with other particle and lighting settings for a balanced approach to visual quality and performance.
- Potentially exposing it as a user-configurable setting for players to adjust based on their hardware capabilities.
Regarding the associated variable CVarParticleLightQuality:
The purpose of CVarParticleLightQuality is to provide a programmatic interface for the r.ParticleLightQuality setting. It’s an instance of TAutoConsoleVariable
This variable is used directly in the particle system implementation, specifically in the UParticleModuleLight::SpawnEx function, to determine the level of particle lighting to apply.
The value of CVarParticleLightQuality is set at the same time as r.ParticleLightQuality, through the console variable system.
Developers should be aware that changes to CVarParticleLightQuality will directly affect the particle lighting behavior in the engine. It’s important to use the GetValueOnAnyThread() method when accessing this variable to ensure thread-safe operations.
Best practices for CVarParticleLightQuality include:
- Using it for runtime checks of the particle light quality setting.
- Considering its value when implementing custom particle lighting logic.
- Potentially caching its value locally if it’s accessed frequently in performance-critical code paths.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:625, section: [EffectsQuality@0]
- INI Section:
EffectsQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:652, section: [EffectsQuality@1]
- INI Section:
EffectsQuality@1
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:679, section: [EffectsQuality@2]
- INI Section:
EffectsQuality@2
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:706, section: [EffectsQuality@3]
- INI Section:
EffectsQuality@3
- Raw value:
2
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:734, section: [EffectsQuality@Cine]
- INI Section:
EffectsQuality@Cine
- Raw value:
2
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleModules.cpp:3039
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarParticleLightQuality(
TEXT("r.ParticleLightQuality"),
2,
TEXT("0: No lights. 1:Only simple lights. 2:Simple+HQ lights"),
ECVF_Scalability
);
static TAutoConsoleVariable<int32> CVarParticleDefaultLightInverseExposureBlend(
#Associated Variable and Callsites
This variable is associated with another variable named CVarParticleLightQuality
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleModules.cpp:3038
Scope: file
Source code excerpt:
}
static TAutoConsoleVariable<int32> CVarParticleLightQuality(
TEXT("r.ParticleLightQuality"),
2,
TEXT("0: No lights. 1:Only simple lights. 2:Simple+HQ lights"),
ECVF_Scalability
);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleModules.cpp:3054
Scope (from outer to inner):
file
function void UParticleModuleLight::SpawnEx
Source code excerpt:
void UParticleModuleLight::SpawnEx(FParticleEmitterInstance* Owner, int32 Offset, float SpawnTime, struct FRandomStream* InRandomStream, FBaseParticle* ParticleBase)
{
int32 ParticleLightQuality = CVarParticleLightQuality.GetValueOnAnyThread();
if (ParticleLightQuality > 0)
{
SPAWN_INIT;
PARTICLE_ELEMENT(FLightParticlePayload, LightData);
const float Brightness = BrightnessOverLife.GetValue(Particle.RelativeTime, Owner->Component, InRandomStream);
LightData.ColorScale = (FVector3f)ColorScaleOverLife.GetValue(Particle.RelativeTime, Owner->Component, 0, InRandomStream) * Brightness;