r.Lumen.RadianceCache.SortTraceTiles
r.Lumen.RadianceCache.SortTraceTiles
#Overview
name: r.Lumen.RadianceCache.SortTraceTiles
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to sort Trace Tiles by direction before tracing to extract coherency
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.RadianceCache.SortTraceTiles is to control whether Trace Tiles are sorted by direction before tracing to extract coherency in the Lumen Radiance Cache system. This setting is part of Unreal Engine 5’s rendering system, specifically the Lumen global illumination feature.
This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. It’s 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’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime through console commands or configuration files.
The associated variable GRadianceCacheSortTraceTiles directly interacts with r.Lumen.RadianceCache.SortTraceTiles. They share the same value, with GRadianceCacheSortTraceTiles being the actual integer variable used in the code logic.
Developers should be aware that this variable affects the performance and potentially the quality of the Lumen Radiance Cache system. Enabling this feature (setting it to 1) will cause the engine to sort Trace Tiles by direction before tracing, which may improve coherency but could also introduce additional computational overhead.
Best practices when using this variable include:
- Testing performance with both enabled and disabled states to determine the optimal setting for your specific scene.
- Considering the trade-off between potential improvements in trace coherency and the additional sorting step.
- Using it in conjunction with other Lumen settings to fine-tune the global illumination system’s performance and quality.
Regarding the associated variable GRadianceCacheSortTraceTiles:
The purpose of GRadianceCacheSortTraceTiles is to serve as the actual integer flag used in the C++ code to determine whether trace tile sorting should be performed.
This variable is used within the Lumen Radiance Cache update function in the rendering system. It’s checked in the UpdateRadianceCaches function to determine whether to perform the sorting step.
The value of GRadianceCacheSortTraceTiles is set through the r.Lumen.RadianceCache.SortTraceTiles console variable.
When GRadianceCacheSortTraceTiles is true (non-zero), the code creates a sorted buffer for probe trace tile data and sets up parameters for a compute shader to perform the sorting.
Developers should be aware that changing this variable will directly affect the behavior of the Radiance Cache update process. Enabling it may improve trace coherency but will also add an additional sorting step to the rendering pipeline.
Best practices include profiling the performance impact of enabling this feature in your specific use case and considering it as part of a holistic approach to optimizing Lumen’s global illumination system.
#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:60
Scope: file
Source code excerpt:
int32 GRadianceCacheSortTraceTiles = 0;
FAutoConsoleVariableRef CVarRadianceCacheSortTraceTiles(
TEXT("r.Lumen.RadianceCache.SortTraceTiles"),
GRadianceCacheSortTraceTiles,
TEXT("Whether to sort Trace Tiles by direction before tracing to extract coherency"),
ECVF_RenderThreadSafe
);
float GLumenRadianceCacheFilterMaxRadianceHitAngle = .2f;
#Associated Variable and Callsites
This variable is associated with another variable named GRadianceCacheSortTraceTiles
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:58
Scope: file
Source code excerpt:
);
int32 GRadianceCacheSortTraceTiles = 0;
FAutoConsoleVariableRef CVarRadianceCacheSortTraceTiles(
TEXT("r.Lumen.RadianceCache.SortTraceTiles"),
GRadianceCacheSortTraceTiles,
TEXT("Whether to sort Trace Tiles by direction before tracing to extract coherency"),
ECVF_RenderThreadSafe
);
float GLumenRadianceCacheFilterMaxRadianceHitAngle = .2f;
FAutoConsoleVariableRef GVarLumenRadianceCacheFilterMaxRadianceHitAngle(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:1960
Scope (from outer to inner):
file
namespace LumenRadianceCache
function void UpdateRadianceCaches
Source code excerpt:
FRadianceCacheInterpolationParameters& RadianceCacheParameters = Outputs.RadianceCacheParameters;
if (GRadianceCacheSortTraceTiles)
{
FRDGBufferRef SortedProbeTraceTileData = GraphBuilder.CreateBuffer(ProbeTraceTileData[RadianceCacheIndex]->Desc, TEXT("Lumen.RadianceCache.SortedProbeTraceTileData"));
FSortProbeTraceTilesCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FSortProbeTraceTilesCS::FParameters>();
PassParameters->RWProbeTraceTileData = GraphBuilder.CreateUAV(FRDGBufferUAVDesc(SortedProbeTraceTileData, PF_R32G32_UINT));
PassParameters->ProbeTraceData = GraphBuilder.CreateSRV(FRDGBufferSRVDesc(ProbeTraceData[RadianceCacheIndex], PF_A32B32G32R32F));