r.Lumen.RadianceCache.ForceFullUpdate

r.Lumen.RadianceCache.ForceFullUpdate

#Overview

name: r.Lumen.RadianceCache.ForceFullUpdate

This variable is created as a Console Variable (cvar).

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.

Regarding the associated variable GRadianceCacheForceFullUpdate:

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;