r.Lumen.ScreenProbeGather.ImportanceSample.MinPDFToTrace
r.Lumen.ScreenProbeGather.ImportanceSample.MinPDFToTrace
#Overview
name: r.Lumen.ScreenProbeGather.ImportanceSample.MinPDFToTrace
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Minimum normalized BRDF PDF to trace rays for. Larger values cause black corners, but reduce noise as more rays are able to be reassigned to an important direction.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.ScreenProbeGather.ImportanceSample.MinPDFToTrace is to control the minimum normalized BRDF Probability Density Function (PDF) value for ray tracing in Lumen’s screen probe gathering process. It’s part of the rendering system, specifically the Lumen global illumination system in Unreal Engine 5.
This setting variable is primarily used by the Lumen subsystem within the Rendering module of Unreal Engine 5. It’s specifically utilized in the screen probe importance sampling process, which is a crucial part of Lumen’s global illumination calculation.
The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 0.1f and can be modified at runtime.
The associated variable GLumenScreenProbeImportanceSamplingMinPDFToTrace directly interacts with this console variable. They share the same value, with the console variable acting as an interface for adjusting the value at runtime.
Developers must be aware that this variable affects the trade-off between image quality and performance. Larger values can cause black corners in the rendered image but may reduce noise as more rays are reassigned to important directions. This balance is crucial for achieving optimal visual results while maintaining performance.
Best practices when using this variable include:
- Fine-tuning the value based on the specific requirements of your scene.
- Monitoring the impact on both visual quality and performance when adjusting this value.
- Considering the interaction with other Lumen settings for a holistic approach to global illumination quality.
Regarding the associated variable GLumenScreenProbeImportanceSamplingMinPDFToTrace:
This is an internal float variable that directly represents the minimum PDF value used in the screen probe importance sampling process. It’s used in the GenerateImportanceSamplingRays function to set the MinPDFToTrace parameter for the ray generation process.
The purpose of this associated variable is to provide a quick access point for the minimum PDF value within the C++ code, allowing for efficient use in rendering calculations without needing to query the console variable system repeatedly.
Developers should be aware that modifying this variable directly in code would bypass the console variable system, potentially leading to inconsistencies. It’s generally better to modify the console variable (r.Lumen.ScreenProbeGather.ImportanceSample.MinPDFToTrace) instead, which will automatically update this associated variable.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeImportanceSampling.cpp:56
Scope: file
Source code excerpt:
float GLumenScreenProbeImportanceSamplingMinPDFToTrace = .1f;
FAutoConsoleVariableRef GVarLumenScreenProbeImportanceSamplingMinPDFToTrace(
TEXT("r.Lumen.ScreenProbeGather.ImportanceSample.MinPDFToTrace"),
GLumenScreenProbeImportanceSamplingMinPDFToTrace,
TEXT("Minimum normalized BRDF PDF to trace rays for. Larger values cause black corners, but reduce noise as more rays are able to be reassigned to an important direction."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenScreenProbeImportanceSamplingHistoryDistanceThreshold = 30;
#Associated Variable and Callsites
This variable is associated with another variable named GLumenScreenProbeImportanceSamplingMinPDFToTrace
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeImportanceSampling.cpp:54
Scope: file
Source code excerpt:
);
float GLumenScreenProbeImportanceSamplingMinPDFToTrace = .1f;
FAutoConsoleVariableRef GVarLumenScreenProbeImportanceSamplingMinPDFToTrace(
TEXT("r.Lumen.ScreenProbeGather.ImportanceSample.MinPDFToTrace"),
GLumenScreenProbeImportanceSamplingMinPDFToTrace,
TEXT("Minimum normalized BRDF PDF to trace rays for. Larger values cause black corners, but reduce noise as more rays are able to be reassigned to an important direction."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
float GLumenScreenProbeImportanceSamplingHistoryDistanceThreshold = 30;
FAutoConsoleVariableRef CVarLumenScreenProbeImportanceSamplingHistoryDistanceThreshold(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeImportanceSampling.cpp:380
Scope (from outer to inner):
file
function void GenerateImportanceSamplingRays
Source code excerpt:
PassParameters->LightingProbabilityDensityFunction = LightingProbabilityDensityFunction;
PassParameters->BRDFProbabilityDensityFunctionSH = BRDFProbabilityDensityFunctionSH;
PassParameters->MinPDFToTrace = GLumenScreenProbeImportanceSamplingMinPDFToTrace;
PassParameters->ScreenProbeParameters = ScreenProbeParameters;
const uint32 GenerateRaysGroupSize = FScreenProbeGenerateRaysCS::GetThreadGroupSize(ScreenProbeParameters.ScreenProbeTracingOctahedronResolution);
check(GenerateRaysGroupSize != MAX_uint32);
FScreenProbeGenerateRaysCS::FPermutationDomain PermutationVector;