r.Lumen.Visualize.TraceRadianceCache
r.Lumen.Visualize.TraceRadianceCache
#Overview
name: r.Lumen.Visualize.TraceRadianceCache
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to use radiance cache for Lumen scene visualization.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.Visualize.TraceRadianceCache is to control whether the radiance cache is used for Lumen scene visualization. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically for debugging and visualization purposes.
This setting variable is primarily used in the Renderer module, particularly in the Lumen subsystem. It’s used in the visualization and debugging features of Lumen, which is Unreal Engine 5’s real-time global illumination solution.
The value of this variable is set through the Unreal Engine console variable system. It’s defined as an integer (int32) and is initialized to 0 by default.
The associated variable GVisualizeLumenSceneTraceRadianceCache interacts directly with r.Lumen.Visualize.TraceRadianceCache. They share the same value, with GVisualizeLumenSceneTraceRadianceCache being the actual variable used in the C++ code.
Developers should be aware that:
- This variable is primarily for visualization and debugging purposes.
- It affects the Lumen scene visualization, potentially changing how the scene is rendered when visualization is enabled.
- It’s render thread safe, meaning it can be changed at runtime without causing thread safety issues.
Best practices when using this variable include:
- Use it primarily for debugging and visualizing the Lumen system’s behavior.
- Be aware that enabling this might have performance implications, as it’s adding additional visualization steps to the rendering process.
- Remember to disable it in production builds or when not actively debugging Lumen visualization.
Regarding the associated variable GVisualizeLumenSceneTraceRadianceCache:
- It’s used in the same context as r.Lumen.Visualize.TraceRadianceCache, specifically for Lumen scene visualization.
- It’s checked in the VisualizeLumenScene function to determine whether to use the radiance cache in the visualization process.
- When non-zero and when radiance cache is available, it enables a specific permutation of the visualization shader (FVisualizeLumenSceneCS::FRadianceCache).
- Developers should treat it with the same considerations as the console variable, understanding that it directly impacts the visualization process of the Lumen system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:99
Scope: file
Source code excerpt:
int32 GVisualizeLumenSceneTraceRadianceCache = 0;
FAutoConsoleVariableRef CVarVisualizeLumenSceneTraceRadianceCache(
TEXT("r.Lumen.Visualize.TraceRadianceCache"),
GVisualizeLumenSceneTraceRadianceCache,
TEXT("Whether to use radiance cache for Lumen scene visualization."),
ECVF_RenderThreadSafe
);
float GVisualizeLumenSceneConeAngle = 0.0f;
#Associated Variable and Callsites
This variable is associated with another variable named GVisualizeLumenSceneTraceRadianceCache
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCache.cpp:237
Scope (from outer to inner):
file
function void MarkUsedProbesForVisualize
Source code excerpt:
ERDGPassFlags ComputePassFlags)
{
extern int32 GVisualizeLumenSceneTraceRadianceCache;
if (View.Family->EngineShowFlags.VisualizeLumen && GVisualizeLumenSceneTraceRadianceCache != 0)
{
FMarkRadianceProbesUsedByVisualizeCS::FParameters* PassParameters = GraphBuilder.AllocParameters<FMarkRadianceProbesUsedByVisualizeCS::FParameters>();
PassParameters->View = View.ViewUniformBuffer;
PassParameters->RadianceCacheMarkParameters = RadianceCacheMarkParameters;
auto ComputeShader = View.ShaderMap->GetShader<FMarkRadianceProbesUsedByVisualizeCS>(0);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:97
Scope: file
Source code excerpt:
);
int32 GVisualizeLumenSceneTraceRadianceCache = 0;
FAutoConsoleVariableRef CVarVisualizeLumenSceneTraceRadianceCache(
TEXT("r.Lumen.Visualize.TraceRadianceCache"),
GVisualizeLumenSceneTraceRadianceCache,
TEXT("Whether to use radiance cache for Lumen scene visualization."),
ECVF_RenderThreadSafe
);
float GVisualizeLumenSceneConeAngle = 0.0f;
FAutoConsoleVariableRef CVarVisualizeLumenSceneConeAngle(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenVisualize.cpp:819
Scope (from outer to inner):
file
function void VisualizeLumenScene
Source code excerpt:
PermutationVector.Set<FVisualizeLumenSceneCS::FTraceGlobalSDF>(bTraceGlobalSDF);
PermutationVector.Set<FVisualizeLumenSceneCS::FSimpleCoverageBasedExpand>(bTraceGlobalSDF && Lumen::UseGlobalSDFSimpleCoverageBasedExpand());
PermutationVector.Set<FVisualizeLumenSceneCS::FRadianceCache>(GVisualizeLumenSceneTraceRadianceCache != 0 && LumenScreenProbeGather::UseRadianceCache(View));
PermutationVector.Set<FVisualizeLumenSceneCS::FTraceHeightfields>(Lumen::UseHeightfieldTracing(*View.Family, *Scene->GetLumenSceneData(View)));
PermutationVector = FVisualizeLumenSceneCS::RemapPermutation(PermutationVector);
auto ComputeShader = View.ShaderMap->GetShader<FVisualizeLumenSceneCS>(PermutationVector);
FIntPoint GroupSize(FIntPoint::DivideAndRoundUp(VisualizeParameters.CommonParameters.OutputViewSize, FVisualizeLumenSceneCS::GetGroupSize()));