r.Lumen.RadianceCache.OverrideCacheOcclusionLighting
r.Lumen.RadianceCache.OverrideCacheOcclusionLighting
#Overview
name: r.Lumen.RadianceCache.OverrideCacheOcclusionLighting
This variable is created as a Console Variable (cvar).
- type:
Var
- help: ``
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.RadianceCache.OverrideCacheOcclusionLighting is to control the behavior of the Radiance Cache in Lumen, Unreal Engine 5’s global illumination system. It is specifically used to override the cache occlusion lighting in the Radiance Cache.
This setting variable is primarily used in the Lumen subsystem of Unreal Engine 5’s rendering module. It is referenced in the LumenRadianceCache.cpp file, which is part of the Renderer’s private implementation.
The value of this variable is set through the Unreal Engine console variable system. It is declared as an integer (int32) and initialized to 0. The FAutoConsoleVariableRef is used to expose this variable to the engine’s console, allowing it to be changed at runtime.
This variable interacts directly with GRadianceCacheOverrideCacheOcclusionLighting, which is the actual integer variable that stores the value. The console variable r.Lumen.RadianceCache.OverrideCacheOcclusionLighting is linked to this global variable.
Developers should be aware that this variable is render thread safe (ECVF_RenderThreadSafe), meaning it can be safely accessed and modified from the render thread. It’s used in the GetInterpolationParametersNoResources function within the LumenRadianceCache namespace to set the OverrideCacheOcclusionLighting parameter.
Best practices when using this variable include:
- Use it for debugging or fine-tuning the Radiance Cache behavior in Lumen.
- Be cautious when modifying it in a shipping build, as it may impact performance or visual quality.
- Consider the interaction with other Lumen settings when adjusting this value.
Regarding the associated variable GRadianceCacheOverrideCacheOcclusionLighting:
This is the actual integer variable that stores the value controlled by the r.Lumen.RadianceCache.OverrideCacheOcclusionLighting console variable. It is initialized to 0 and is used directly in the Lumen Radiance Cache code.
The purpose of this variable is to provide a way to override the cache occlusion lighting in the Radiance Cache system. It’s used in the GetInterpolationParametersNoResources function to set the OverrideCacheOcclusionLighting parameter of the output structure.
Developers should be aware that modifying this variable directly in code is not recommended. Instead, they should use the console variable r.Lumen.RadianceCache.OverrideCacheOcclusionLighting to change its value, which ensures thread-safety and proper engine integration.
Best practices for this variable include:
- Treat it as read-only in most scenarios, relying on the console variable for modifications.
- When reading its value, be aware of potential threading issues and ensure you’re accessing it from the appropriate thread (likely the render thread).
- Consider the performance implications of enabling this override, as it may affect the Radiance Cache’s behavior and potentially impact rendering performance.
#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:36
Scope: file
Source code excerpt:
int32 GRadianceCacheOverrideCacheOcclusionLighting = 0;
FAutoConsoleVariableRef CVarRadianceCacheShowOnlyRadianceCacheLighting(
TEXT("r.Lumen.RadianceCache.OverrideCacheOcclusionLighting"),
GRadianceCacheOverrideCacheOcclusionLighting,
TEXT(""),
ECVF_RenderThreadSafe
);
int32 GRadianceCacheShowBlackRadianceCacheLighting = 0;
#Associated Variable and Callsites
This variable is associated with another variable named GRadianceCacheOverrideCacheOcclusionLighting
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:34
Scope: file
Source code excerpt:
);
int32 GRadianceCacheOverrideCacheOcclusionLighting = 0;
FAutoConsoleVariableRef CVarRadianceCacheShowOnlyRadianceCacheLighting(
TEXT("r.Lumen.RadianceCache.OverrideCacheOcclusionLighting"),
GRadianceCacheOverrideCacheOcclusionLighting,
TEXT(""),
ECVF_RenderThreadSafe
);
int32 GRadianceCacheShowBlackRadianceCacheLighting = 0;
FAutoConsoleVariableRef CVarRadianceCacheShowBlackRadianceCacheLighting(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:135
Scope (from outer to inner):
file
namespace LumenRadianceCache
function void GetInterpolationParametersNoResources
Source code excerpt:
OutParameters.RadianceCacheDepthAtlas = nullptr;
OutParameters.ProbeWorldOffset = nullptr;
OutParameters.OverrideCacheOcclusionLighting = GRadianceCacheOverrideCacheOcclusionLighting;
OutParameters.ShowBlackRadianceCacheLighting = GRadianceCacheShowBlackRadianceCacheLighting;
OutParameters.ProbeAtlasResolutionModuloMask = (1u << FMath::FloorLog2(RadianceCacheInputs.ProbeAtlasResolutionInProbes.X)) - 1;
OutParameters.ProbeAtlasResolutionDivideShift = FMath::FloorLog2(RadianceCacheInputs.ProbeAtlasResolutionInProbes.X);
for (int32 ClipmapIndex = 0; ClipmapIndex < RadianceCacheState.Clipmaps.Num(); ++ClipmapIndex)
{