r.Lumen.ScreenProbeGather.DiffuseIntegralMethod
r.Lumen.ScreenProbeGather.DiffuseIntegralMethod
#Overview
name: r.Lumen.ScreenProbeGather.DiffuseIntegralMethod
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Spherical Harmonic = 0, Importance Sample BRDF = 1, Numerical Integral Reference = 2
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.ScreenProbeGather.DiffuseIntegralMethod is to control the method used for calculating diffuse integral in Lumen’s screen probe gathering process. This setting is part of the Lumen global illumination system in Unreal Engine 5’s rendering pipeline.
This setting variable is primarily used by the Lumen subsystem within the Renderer module of Unreal Engine 5. It specifically affects the screen probe gathering process, which is a crucial part of Lumen’s real-time global illumination calculations.
The value of this variable is set through the Unreal Engine console or configuration files. It’s defined as an FAutoConsoleVariableRef, which means it can be changed at runtime.
The associated integer variable GLumenScreenProbeDiffuseIntegralMethod directly interacts with this console variable. They share the same value, with GLumenScreenProbeDiffuseIntegralMethod being the C++ variable that the engine code uses internally.
Developers should be aware that this variable accepts three possible values: 0 - Spherical Harmonic 1 - Importance Sample BRDF 2 - Numerical Integral Reference
Each method has different performance and quality implications. The Spherical Harmonic method (0) is likely the fastest but may be less accurate, while the Numerical Integral Reference (2) is probably the most accurate but potentially the slowest.
Best practices when using this variable include:
- Understanding the performance impact of each method in your specific scene.
- Using the Spherical Harmonic method (0) for performance-critical scenarios or on lower-end hardware.
- Using the Numerical Integral Reference (2) when accuracy is crucial and performance allows.
- Testing different methods to find the best balance between quality and performance for your specific use case.
Regarding the associated variable GLumenScreenProbeDiffuseIntegralMethod:
The purpose of GLumenScreenProbeDiffuseIntegralMethod is to store the selected diffuse integral method for use within the C++ code of the Lumen system.
This variable is used directly in the Lumen subsystem of the Renderer module. It’s accessed in the GetDiffuseIntegralMethod() function within the LumenScreenProbeGather namespace.
The value of this variable is set by the r.Lumen.ScreenProbeGather.DiffuseIntegralMethod console variable.
It interacts with another variable GLumenScreenProbeGatherReferenceMode in the GetDiffuseIntegralMethod() function. If GLumenScreenProbeGatherReferenceMode is true, it overrides the value to always return 2 (Numerical Integral Reference).
Developers should be aware that changes to r.Lumen.ScreenProbeGather.DiffuseIntegralMethod will directly affect this variable, and vice versa.
Best practices include:
- Avoid directly modifying GLumenScreenProbeDiffuseIntegralMethod in code; instead, use the console variable to ensure consistency.
- Be aware of the GLumenScreenProbeGatherReferenceMode variable, as it can override the diffuse integral method selection.
- When debugging or profiling Lumen performance, check both the console variable and this C++ variable to ensure they are set as expected.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:131
Scope: file
Source code excerpt:
int32 GLumenScreenProbeDiffuseIntegralMethod = 0;
FAutoConsoleVariableRef CVarLumenScreenProbeDiffuseIntegralMethod(
TEXT("r.Lumen.ScreenProbeGather.DiffuseIntegralMethod"),
GLumenScreenProbeDiffuseIntegralMethod,
TEXT("Spherical Harmonic = 0, Importance Sample BRDF = 1, Numerical Integral Reference = 2"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenScreenProbeMaterialAO = 1;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenScreenProbeDiffuseIntegralMethod
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:129
Scope: file
Source code excerpt:
);
int32 GLumenScreenProbeDiffuseIntegralMethod = 0;
FAutoConsoleVariableRef CVarLumenScreenProbeDiffuseIntegralMethod(
TEXT("r.Lumen.ScreenProbeGather.DiffuseIntegralMethod"),
GLumenScreenProbeDiffuseIntegralMethod,
TEXT("Spherical Harmonic = 0, Importance Sample BRDF = 1, Numerical Integral Reference = 2"),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GLumenScreenProbeMaterialAO = 1;
FAutoConsoleVariableRef CVarLumenScreenProbeMaterialAO(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeGather.cpp:394
Scope (from outer to inner):
file
namespace LumenScreenProbeGather
function int32 GetDiffuseIntegralMethod
Source code excerpt:
int32 GetDiffuseIntegralMethod()
{
return GLumenScreenProbeGatherReferenceMode ? 2 : GLumenScreenProbeDiffuseIntegralMethod;
}
EScreenProbeIrradianceFormat GetScreenProbeIrradianceFormat(const FEngineShowFlags& ShowFlags)
{
const bool bApplyShortRangeAO = UseShortRangeAmbientOcclusion(ShowFlags) && ApplyShortRangeAODuringIntegration();
if (bApplyShortRangeAO)