r.Lumen.ScreenProbeGather.ShortRangeAO.HardwareRayTracing.NormalBias

r.Lumen.ScreenProbeGather.ShortRangeAO.HardwareRayTracing.NormalBias

#Overview

name: r.Lumen.ScreenProbeGather.ShortRangeAO.HardwareRayTracing.NormalBias

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.ShortRangeAO.HardwareRayTracing.NormalBias is to provide a bias value for Hardware Ray Tracing (HWRT) Bent Normal calculations in Lumen’s Short Range Ambient Occlusion (AO) system. This setting is specifically designed to avoid self-intersection issues during ray tracing.

This setting variable is primarily used in the Lumen subsystem of Unreal Engine’s rendering module. It’s specifically utilized in the Short Range AO component that employs hardware ray tracing.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined with a default value of 0.1f, but can be adjusted at runtime or through configuration files.

The associated variable CVarLumenShortRangeAOHardwareRayTracingNormalBias directly interacts with this setting. It’s the C++ representation of the console variable and is used to retrieve the current value of the setting within the rendering code.

Developers should be aware that this variable affects the accuracy and visual quality of ambient occlusion in scenes using Lumen with hardware ray tracing. A higher value may help prevent self-intersection artifacts but might also reduce the accuracy of the AO effect.

Best practices when using this variable include:

  1. Start with the default value (0.1f) and adjust only if necessary.
  2. Test the variable’s impact across different types of geometry and lighting conditions.
  3. Balance between eliminating self-intersection artifacts and maintaining AO accuracy.
  4. Consider performance implications, as adjusting this value might affect ray tracing efficiency.

Regarding the associated variable CVarLumenShortRangeAOHardwareRayTracingNormalBias:

The purpose of this variable is to provide programmatic access to the r.Lumen.ScreenProbeGather.ShortRangeAO.HardwareRayTracing.NormalBias setting within the C++ code.

It’s used in the Lumen subsystem of the rendering module, specifically in the Short Range AO component with hardware ray tracing.

The value of this variable is set by the console variable system and can be accessed using the GetValueOnRenderThread() method.

This variable directly interacts with the render thread, providing the current bias value for the shader parameters.

Developers should be aware that this variable is thread-safe and can be accessed from the render thread, which is crucial for real-time adjustments to the ray tracing behavior.

Best practices for using this variable include:

  1. Always access it using GetValueOnRenderThread() when in render thread code.
  2. Avoid caching its value for extended periods, as it can be changed at runtime.
  3. Consider exposing it to the game’s graphics settings if fine-tuning is necessary for different hardware configurations.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenShortRangeAOHardwareRayTracing.cpp:28

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarLumenShortRangeAOHardwareRayTracingNormalBias(
	TEXT("r.Lumen.ScreenProbeGather.ShortRangeAO.HardwareRayTracing.NormalBias"),
	.1f,
	TEXT("Bias for HWRT Bent Normal to avoid self intersection"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

namespace Lumen

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenShortRangeAOHardwareRayTracing.cpp:27

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<float> CVarLumenShortRangeAOHardwareRayTracingNormalBias(
	TEXT("r.Lumen.ScreenProbeGather.ShortRangeAO.HardwareRayTracing.NormalBias"),
	.1f,
	TEXT("Bias for HWRT Bent Normal to avoid self intersection"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenShortRangeAOHardwareRayTracing.cpp:133

Scope: file

Source code excerpt:

		PassParameters->MaxScreenTraceFraction = MaxScreenTraceFraction;
		PassParameters->NumRays = NumPixelRays;
		PassParameters->NormalBias = CVarLumenShortRangeAOHardwareRayTracingNormalBias.GetValueOnRenderThread();
		PassParameters->Substrate = Substrate::BindSubstrateGlobalUniformParameters(View);

		if (bNeedTraceHairVoxel)
		{
			PassParameters->HairStrandsVoxel = HairStrands::BindHairStrandsVoxelUniformParameters(View);
		}