r.Lumen.ScreenProbeGather.ImportanceSample.BRDFOctahedronResolution

r.Lumen.ScreenProbeGather.ImportanceSample.BRDFOctahedronResolution

#Overview

name: r.Lumen.ScreenProbeGather.ImportanceSample.BRDFOctahedronResolution

This variable is created as a Console Variable (cvar).

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.Lumen.ScreenProbeGather.ImportanceSample.BRDFOctahedronResolution is to set the resolution of the BRDF PDF octahedron per probe in Lumen’s screen probe gathering system. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically for the screen probe importance sampling feature.

This setting variable is primarily used in the Lumen rendering subsystem, which is part of Unreal Engine 5’s advanced rendering capabilities. It’s referenced in the LumenScreenProbeImportanceSampling.cpp file, indicating its relevance to the screen probe gathering and importance sampling processes within Lumen.

The value of this variable is set through the Unreal Engine console variable system. It’s declared as an FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files.

The associated variable GLumenScreenProbeBRDFOctahedronResolution directly interacts with this setting. They share the same value, with GLumenScreenProbeBRDFOctahedronResolution being the actual integer variable used in the code.

Developers must be aware that this variable affects the resolution of the BRDF (Bidirectional Reflectance Distribution Function) PDF (Probability Density Function) octahedron for each screen probe. A higher resolution may provide more accurate lighting results but at the cost of increased memory usage and potential performance impact.

Best practices when using this variable include:

  1. Balancing quality and performance by adjusting the resolution based on the project’s needs.
  2. Testing different values to find the optimal setting for your specific scene and target hardware.
  3. Considering scalability options, as the variable is marked with ECVF_Scalability flag.

Regarding the associated variable GLumenScreenProbeBRDFOctahedronResolution:

The purpose of GLumenScreenProbeBRDFOctahedronResolution is to store the actual integer value of the BRDF octahedron resolution used in the Lumen screen probe gathering system.

This variable is used directly in the Lumen rendering subsystem, specifically in the GenerateBRDF_PDF function within the LumenScreenProbeImportanceSampling.cpp file.

The value of this variable is set by the console variable system through the r.Lumen.ScreenProbeGather.ImportanceSample.BRDFOctahedronResolution setting.

It interacts with the ScreenProbeParameters structure, setting the ImportanceSampling.ScreenProbeBRDFOctahedronResolution field.

Developers should be aware that this variable directly affects the size of buffers and textures used in the screen probe gathering process. Changes to this value will impact memory usage and potentially rendering performance.

Best practices include:

  1. Monitoring performance and memory usage when modifying this value.
  2. Ensuring that changes to this variable are reflected in any custom shaders or rendering code that relies on the BRDF octahedron resolution.
  3. Considering the target hardware capabilities when setting this value, especially for projects aiming for multi-platform release.

#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:48

Scope: file

Source code excerpt:

int32 GLumenScreenProbeBRDFOctahedronResolution = 8;
FAutoConsoleVariableRef CVarLumenScreenProbeBRDFOctahedronResolution(
	TEXT("r.Lumen.ScreenProbeGather.ImportanceSample.BRDFOctahedronResolution"),
	GLumenScreenProbeBRDFOctahedronResolution,
	TEXT("Resolution of the BRDF PDF octahedron per probe."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenScreenProbeImportanceSamplingMinPDFToTrace = .1f;

#Associated Variable and Callsites

This variable is associated with another variable named GLumenScreenProbeBRDFOctahedronResolution. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeImportanceSampling.cpp:46

Scope: file

Source code excerpt:

);

int32 GLumenScreenProbeBRDFOctahedronResolution = 8;
FAutoConsoleVariableRef CVarLumenScreenProbeBRDFOctahedronResolution(
	TEXT("r.Lumen.ScreenProbeGather.ImportanceSample.BRDFOctahedronResolution"),
	GLumenScreenProbeBRDFOctahedronResolution,
	TEXT("Resolution of the BRDF PDF octahedron per probe."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenScreenProbeImportanceSamplingMinPDFToTrace = .1f;
FAutoConsoleVariableRef GVarLumenScreenProbeImportanceSamplingMinPDFToTrace(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenScreenProbeImportanceSampling.cpp:248

Scope (from outer to inner):

file
function     void GenerateBRDF_PDF

Source code excerpt:


	{		
		const uint32 BRDFOctahedronResolution = GLumenScreenProbeBRDFOctahedronResolution;
		ScreenProbeParameters.ImportanceSampling.ScreenProbeBRDFOctahedronResolution = BRDFOctahedronResolution;

		FIntPoint PDFBufferSize = ScreenProbeParameters.ScreenProbeAtlasBufferSize * BRDFOctahedronResolution;
		FRDGTextureDesc BRDFProbabilityDensityFunctionDesc(FRDGTextureDesc::Create2D(PDFBufferSize, PF_R16F, FClearValueBinding::Black, TexCreate_ShaderResource | TexCreate_UAV));
		BRDFProbabilityDensityFunction = GraphBuilder.CreateTexture(BRDFProbabilityDensityFunctionDesc, TEXT("Lumen.ScreenProbeGather.BRDFProbabilityDensityFunction"));