r.Lumen.IrradianceFieldGather.ProbeOcclusionNormalBias

r.Lumen.IrradianceFieldGather.ProbeOcclusionNormalBias

#Overview

name: r.Lumen.IrradianceFieldGather.ProbeOcclusionNormalBias

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.IrradianceFieldGather.ProbeOcclusionNormalBias is to control the bias along the normal direction to reduce self-occlusion artifacts from Probe Occlusion in Lumen’s Irradiance Field Gathering system. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically targeting the rendering and lighting subsystems.

The Lumen Irradiance Field Gather module within the Renderer subsystem relies on this setting variable. It’s used in the process of gathering irradiance information from probes while accounting for potential occlusion.

The value of this variable is set through the Unreal Engine console variable system. It’s initialized with a default value of 20 and can be modified at runtime using console commands or through project settings.

This variable interacts directly with its associated C++ variable GLumenIrradianceFieldProbeOcclusionNormalBias. They share the same value, with the console variable providing an interface for runtime modification.

Developers must be aware that this variable affects the visual quality and performance of the Lumen global illumination system. Adjusting this value can help reduce self-occlusion artifacts, but setting it too high might lead to light leaking or other visual anomalies.

Best practices when using this variable include:

  1. Start with the default value and adjust incrementally.
  2. Test in various lighting scenarios to ensure the changes don’t introduce new artifacts.
  3. Balance between reducing self-occlusion and maintaining overall lighting accuracy.
  4. Consider the performance impact of adjustments, especially in performance-critical scenes.

Regarding the associated variable GLumenIrradianceFieldProbeOcclusionNormalBias:

The purpose of GLumenIrradianceFieldProbeOcclusionNormalBias is to store the actual value used by the rendering code for the probe occlusion normal bias in Lumen’s Irradiance Field Gathering system.

This variable is used directly in the Lumen Irradiance Field Gather module of the Renderer subsystem. It’s accessed during the rendering process to apply the bias when calculating probe occlusion.

The value of this variable is set by the console variable system through r.Lumen.IrradianceFieldGather.ProbeOcclusionNormalBias. It’s initialized with a default value of 20.

GLumenIrradianceFieldProbeOcclusionNormalBias interacts directly with the console variable r.Lumen.IrradianceFieldGather.ProbeOcclusionNormalBias, serving as the actual storage for the value that the rendering code uses.

Developers should be aware that modifying this variable directly in code would be overwritten by the console variable system unless the console variable is also updated.

Best practices for this variable include:

  1. Avoid modifying it directly in code; instead, use the console variable for adjustments.
  2. When reading its value in code, be aware that it may change at runtime due to console commands or settings adjustments.
  3. Consider caching the value if used frequently in performance-critical code sections, but ensure to update the cache when the console variable changes.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenIrradianceFieldGather.cpp:111

Scope: file

Source code excerpt:

float GLumenIrradianceFieldProbeOcclusionNormalBias = 20;
FAutoConsoleVariableRef CVarLumenIrradianceFieldProbeOcclusionNormalBias(
	TEXT("r.Lumen.IrradianceFieldGather.ProbeOcclusionNormalBias"),
	GLumenIrradianceFieldProbeOcclusionNormalBias,
	TEXT("Bias along the normal to reduce self-occlusion artifacts from Probe Occlusion"),
	ECVF_RenderThreadSafe
);

int32 GLumenIrradianceFieldStats = 0;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenIrradianceFieldGather.cpp:109

Scope: file

Source code excerpt:

);

float GLumenIrradianceFieldProbeOcclusionNormalBias = 20;
FAutoConsoleVariableRef CVarLumenIrradianceFieldProbeOcclusionNormalBias(
	TEXT("r.Lumen.IrradianceFieldGather.ProbeOcclusionNormalBias"),
	GLumenIrradianceFieldProbeOcclusionNormalBias,
	TEXT("Bias along the normal to reduce self-occlusion artifacts from Probe Occlusion"),
	ECVF_RenderThreadSafe
);

int32 GLumenIrradianceFieldStats = 0;
FAutoConsoleVariableRef CVarLumenIrradianceFieldStats(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenIrradianceFieldGather.cpp:331

Scope (from outer to inner):

file
function     FSSDSignalTextures FDeferredShadingSceneRenderer::RenderLumenIrradianceFieldGather

Source code excerpt:

		LumenReflections::SetupCompositeParameters(View, PassParameters->ReflectionsCompositeParameters);
		PassParameters->ProbeOcclusionViewBias = GLumenIrradianceFieldProbeOcclusionViewBias;
		PassParameters->ProbeOcclusionNormalBias = GLumenIrradianceFieldProbeOcclusionNormalBias;

		FIrradianceFieldGatherCS::FPermutationDomain PermutationVector;
		auto ComputeShader = View.ShaderMap->GetShader<FIrradianceFieldGatherCS>(PermutationVector);

		FComputeShaderUtils::AddPass(
			GraphBuilder,