r.Lumen.RadianceCache.Update
r.Lumen.RadianceCache.Update
#Overview
name: r.Lumen.RadianceCache.Update
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to update radiance cache every frame
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.RadianceCache.Update is to control whether the radiance cache in Unreal Engine 5’s Lumen global illumination system is updated every frame.
This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. Specifically, it’s utilized in the radiance cache component of Lumen, which is responsible for storing and updating global illumination data.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.
The variable directly interacts with GRadianceCacheUpdate, which is the actual integer variable that stores the setting’s value. When r.Lumen.RadianceCache.Update is set, it updates GRadianceCacheUpdate.
Developers should be aware that this variable significantly impacts performance and visual quality. Enabling it (setting it to non-zero) will update the radiance cache every frame, which can improve lighting accuracy but at the cost of performance. Disabling it (setting it to zero) will prevent updates, which can boost performance but may result in less accurate lighting in dynamic scenes.
Best practices for using this variable include:
- Enable it for final renders or when accurate dynamic lighting is crucial.
- Consider disabling it for performance-critical scenarios or on lower-end hardware.
- Test thoroughly with both settings to find the right balance between visual quality and performance for your specific project.
Regarding the associated variable GRadianceCacheUpdate:
The purpose of GRadianceCacheUpdate is to store the actual value that determines whether the radiance cache should be updated every frame.
This variable is used directly in the Lumen radiance cache update logic within the rendering module. It’s checked in the UpdateRadianceCaches function to determine whether to proceed with the update process.
The value of GRadianceCacheUpdate is set by the r.Lumen.RadianceCache.Update console variable. They are intrinsically linked, with the console variable providing an interface to modify the internal variable.
GRadianceCacheUpdate interacts closely with the radiance cache update logic. When it’s non-zero, the update process is executed; when it’s zero, the update is skipped.
Developers should be aware that modifying GRadianceCacheUpdate directly is not recommended. Instead, they should use the r.Lumen.RadianceCache.Update console variable to control this setting.
Best practices for GRadianceCacheUpdate include:
- Avoid modifying it directly in code; use the console variable instead.
- Be aware of its value when debugging radiance cache behavior.
- Consider exposing it as a user-configurable setting in your game’s options menu if dynamic control over radiance cache updates is desired.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:13
Scope: file
Source code excerpt:
int32 GRadianceCacheUpdate = 1;
FAutoConsoleVariableRef CVarRadianceCacheUpdate(
TEXT("r.Lumen.RadianceCache.Update"),
GRadianceCacheUpdate,
TEXT("Whether to update radiance cache every frame"),
ECVF_RenderThreadSafe
);
int32 GRadianceCacheForceFullUpdate = 0;
#Associated Variable and Callsites
This variable is associated with another variable named GRadianceCacheUpdate
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:11
Scope: file
Source code excerpt:
#include "ShaderPrintParameters.h"
int32 GRadianceCacheUpdate = 1;
FAutoConsoleVariableRef CVarRadianceCacheUpdate(
TEXT("r.Lumen.RadianceCache.Update"),
GRadianceCacheUpdate,
TEXT("Whether to update radiance cache every frame"),
ECVF_RenderThreadSafe
);
int32 GRadianceCacheForceFullUpdate = 0;
FAutoConsoleVariableRef CVarRadianceForceFullUpdate(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:1131
Scope (from outer to inner):
file
namespace LumenRadianceCache
function void UpdateRadianceCaches
Source code excerpt:
ERDGPassFlags ComputePassFlags)
{
if (GRadianceCacheUpdate != 0)
{
RDG_EVENT_SCOPE(GraphBuilder, "UpdateRadianceCaches");
check(InputArray.Num() == OutputArray.Num());
TInlineArray<FRadianceCacheSetup> SetupOutputArray(InputArray.Num());
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:2268
Scope (from outer to inner):
file
namespace LumenRadianceCache
function void UpdateRadianceCaches
Source code excerpt:
}
}
else // GRadianceCacheUpdate != 0
{
for (int32 RadianceCacheIndex = 0; RadianceCacheIndex < InputArray.Num(); RadianceCacheIndex++)
{
const FUpdateInputs& Inputs = InputArray[RadianceCacheIndex];
FUpdateOutputs& Outputs = OutputArray[RadianceCacheIndex];