r.Lumen.RadianceCache.ForceFullUpdate
r.Lumen.RadianceCache.ForceFullUpdate
#Overview
name: r.Lumen.RadianceCache.ForceFullUpdate
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 9
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.RadianceCache.ForceFullUpdate
is to force a full update of the Lumen Radiance Cache in Unreal Engine 5’s rendering system. This setting is primarily used for debugging and testing purposes within the Lumen global illumination system.
-
The Unreal Engine subsystem that relies on this setting variable is the Lumen rendering system, specifically the Radiance Cache component.
-
The value of this variable is set through the console variable system, as evident from the
FAutoConsoleVariableRef
declaration. -
This variable interacts with
GRadianceCacheForceFullUpdate
, which is the internal C++ variable that stores the actual value. -
Developers must be aware that enabling this variable will force a complete update of the Radiance Cache every frame, which can significantly impact performance. It should only be used for debugging or testing purposes.
-
Best practices for using this variable include:
- Use it temporarily for debugging lighting issues or verifying Radiance Cache behavior.
- Disable it in production or release builds to maintain optimal performance.
- Be cautious when using it in large scenes, as it may cause performance drops.
Regarding the associated variable GRadianceCacheForceFullUpdate
:
- It is the internal C++ representation of the console variable.
- It is used directly in the code to control the behavior of the Radiance Cache update process.
- When set to true (non-zero), it causes the system to:
- Clear the Radiance and Irradiance atlases.
- Set the number of probes to trace to the maximum possible value.
- Disable persistence of the cache between frames.
- Adjust the temporary buffer allocation for tracing.
Developers should be aware that modifying GRadianceCacheForceFullUpdate
directly in C++ code will have the same effect as changing the console variable. It’s generally preferable to use the console variable for runtime adjustments and debugging.
#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:21
Scope: file
Source code excerpt:
int32 GRadianceCacheForceFullUpdate = 0;
FAutoConsoleVariableRef CVarRadianceForceFullUpdate(
TEXT("r.Lumen.RadianceCache.ForceFullUpdate"),
GRadianceCacheForceFullUpdate,
TEXT(""),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarRadianceCacheNumFramesToKeepCachedProbes(
#Associated Variable and Callsites
This variable is associated with another variable named GRadianceCacheForceFullUpdate
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:19
Scope: file
Source code excerpt:
);
int32 GRadianceCacheForceFullUpdate = 0;
FAutoConsoleVariableRef CVarRadianceForceFullUpdate(
TEXT("r.Lumen.RadianceCache.ForceFullUpdate"),
GRadianceCacheForceFullUpdate,
TEXT(""),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarRadianceCacheNumFramesToKeepCachedProbes(
TEXT("r.Lumen.RadianceCache.NumFramesToKeepCachedProbes"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:128
Scope (from outer to inner):
file
namespace LumenRadianceCache
function void GetInterpolationParametersNoResources
Source code excerpt:
{
OutParameters.RadianceCacheInputs = RadianceCacheInputs;
OutParameters.RadianceCacheInputs.NumProbesToTraceBudget = GRadianceCacheForceFullUpdate ? UINT32_MAX : OutParameters.RadianceCacheInputs.NumProbesToTraceBudget;
OutParameters.RadianceProbeIndirectionTexture = nullptr;
OutParameters.RadianceCacheFinalRadianceAtlas = nullptr;
OutParameters.RadianceCacheFinalIrradianceAtlas = nullptr;
OutParameters.RadianceCacheProbeOcclusionAtlas = nullptr;
OutParameters.RadianceCacheDepthAtlas = nullptr;
OutParameters.ProbeWorldOffset = nullptr;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:1199
Scope (from outer to inner):
file
namespace LumenRadianceCache
function void UpdateRadianceCaches
Source code excerpt:
}
if (GRadianceCacheForceFullUpdate)
{
AddClearUAVPass(GraphBuilder, GraphBuilder.CreateUAV(FRDGTextureUAVDesc(SetupOutputs.FinalIrradianceAtlas)), FLinearColor::Black, ComputePassFlags);
}
const FIntPoint ProbeOcclusionAtlasSize(RadianceCacheInputs.ProbeAtlasResolutionInProbes * (RadianceCacheInputs.OcclusionProbeResolution + 2 * (1 << RadianceCacheInputs.FinalRadianceAtlasMaxMip)));
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:1248
Scope (from outer to inner):
file
namespace LumenRadianceCache
function void UpdateRadianceCaches
Source code excerpt:
}
if (GRadianceCacheForceFullUpdate)
{
AddClearUAVPass(GraphBuilder, GraphBuilder.CreateUAV(FRDGTextureUAVDesc(SetupOutputs.FinalRadianceAtlas)), FLinearColor::Black, ComputePassFlags);
}
}
SetupOutputs.RadianceProbeAtlasTextureSource = nullptr;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:1287
Scope (from outer to inner):
file
namespace LumenRadianceCache
function void UpdateRadianceCaches
Source code excerpt:
RadianceCacheParameters.RadianceProbeIndirectionTexture = GraphBuilder.CreateTexture(FRDGTextureDesc(ProbeIndirectionDesc), TEXT("Lumen.RadianceCache.RadianceProbeIndirectionTexture"));
SetupOutputs.bPersistentCache = !GRadianceCacheForceFullUpdate
&& View.ViewState
&& IsValidRef(RadianceCacheState.RadianceProbeIndirectionTexture)
&& RadianceCacheState.RadianceProbeIndirectionTexture->GetDesc().GetSize() == RadianceProbeIndirectionTextureSize
&& !bResizedHistoryState
&& !bPropagateGlobalLightingChange;
}
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:1611
Scope (from outer to inner):
file
namespace LumenRadianceCache
function void UpdateRadianceCaches
Source code excerpt:
PassParameters->ProbeTraceAllocator = GraphBuilder.CreateSRV(ProbeTraceAllocator[RadianceCacheIndex], PF_R32_UINT);
const float TraceBudgetScale = bPropagateGlobalLightingChange ? 4.0f : 1.0f;
PassParameters->NumProbesToTraceBudget = GRadianceCacheForceFullUpdate ? UINT32_MAX : RadianceCacheInputs.NumProbesToTraceBudget * TraceBudgetScale;
auto ComputeShader = View.ShaderMap->GetShader<FSelectMaxPriorityBucketCS>();
FComputeShaderUtils::AddPass(
GraphBuilder,
RDG_EVENT_NAME("SelectMaxPriorityBucket"),
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCacheHardwareRayTracing.cpp:383
Scope: file
Source code excerpt:
#endif // RHI_RAYTRACING
extern int32 GRadianceCacheForceFullUpdate;
void LumenRadianceCache::RenderLumenHardwareRayTracingRadianceCache(
FRDGBuilder& GraphBuilder,
const FScene* Scene,
const FSceneTextureParameters& SceneTextures,
const FViewInfo& View,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCacheHardwareRayTracing.cpp:412
Scope (from outer to inner):
file
function void LumenRadianceCache::RenderLumenHardwareRayTracingRadianceCache
Source code excerpt:
// Overflow is possible however unlikely - only nearby probes trace at max resolution
const int32 TemporaryBufferAllocationDownsampleFactor = GRadianceCacheForceFullUpdate ? 4 : CVarLumenRadianceCacheTemporaryBufferAllocationDownsampleFactor.GetValueOnRenderThread();
const int32 TempAtlasNumTraceTilesPerProbe = FMath::DivideAndRoundUp(MaxProbeTraceTileResolution * MaxProbeTraceTileResolution, TemporaryBufferAllocationDownsampleFactor);
const int32 TempAtlasNumTraceTiles = MaxNumProbes * TempAtlasNumTraceTilesPerProbe;
const FIntPoint WrappedTraceTileLayout(
TempAtlasTraceTileStride,
FMath::DivideAndRoundUp(TempAtlasNumTraceTiles, TempAtlasTraceTileStride));
const FIntPoint TempTraceAtlasResolution = WrappedTraceTileLayout * TraceTileSize;