r.LumenScene.Radiosity.HardwareRayTracing.SurfaceBias

r.LumenScene.Radiosity.HardwareRayTracing.SurfaceBias

#Overview

name: r.LumenScene.Radiosity.HardwareRayTracing.SurfaceBias

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.LumenScene.Radiosity.HardwareRayTracing.SurfaceBias is to control the surface bias for hardware ray tracing in Lumen’s radiosity calculations. This setting is part of Unreal Engine 5’s Lumen global illumination system, specifically for the radiosity component when using hardware ray tracing.

This setting variable is primarily used in the Lumen rendering subsystem, which is part of Unreal Engine 5’s advanced rendering capabilities. It’s specifically utilized in the radiosity calculations for the Lumen global illumination system when hardware ray tracing is enabled.

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

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

Developers should be aware that this variable affects the minimum trace distance in radiosity calculations. It’s used to prevent self-intersection artifacts in ray tracing by slightly offsetting the ray origin from the surface.

Best practices when using this variable include:

  1. Keeping the value relatively small (default is 0.1) to maintain accuracy while preventing artifacts.
  2. Adjusting it if you notice self-intersection artifacts in your scene’s global illumination.
  3. Being cautious when modifying it, as extreme values could negatively impact rendering quality or performance.

Regarding the associated variable GLumenRadiosityHardwareRayTracingSurfaceBias:

The purpose of GLumenRadiosityHardwareRayTracingSurfaceBias is to store the actual value used in the rendering calculations. It’s the C++ counterpart to the console variable.

This variable is used directly in the Lumen radiosity rendering code, specifically in setting up parameters for hardware ray tracing passes.

Its value is set either through the default initialization (0.1f) or by changes to the associated console variable.

It interacts primarily with the console variable system and is used in parameter setup for rendering passes.

Developers should be aware that this is the actual variable used in calculations, so any performance or visual impacts of changing the console variable will be reflected through this variable.

Best practices include:

  1. Not modifying this variable directly in code unless absolutely necessary.
  2. Using the console variable for any runtime adjustments.
  3. Considering this variable when debugging ray tracing issues in Lumen’s radiosity calculations.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadiosity.cpp:113

Scope: file

Source code excerpt:

float GLumenRadiosityHardwareRayTracingSurfaceBias = 0.1f;
FAutoConsoleVariableRef CVarLumenRadiosityHardwareRayTracingSurfaceBias(
	TEXT("r.LumenScene.Radiosity.HardwareRayTracing.SurfaceBias"),
	GLumenRadiosityHardwareRayTracingSurfaceBias,
	TEXT("."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenRadiosityHardwareRayTracingSurfaceSlopeBias = 0.2f;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

float GLumenRadiosityHardwareRayTracingSurfaceBias = 0.1f;
FAutoConsoleVariableRef CVarLumenRadiosityHardwareRayTracingSurfaceBias(
	TEXT("r.LumenScene.Radiosity.HardwareRayTracing.SurfaceBias"),
	GLumenRadiosityHardwareRayTracingSurfaceBias,
	TEXT("."),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

float GLumenRadiosityHardwareRayTracingSurfaceSlopeBias = 0.2f;
FAutoConsoleVariableRef CVarLumenRadiosityHardwareRayTracingSlopeSurfaceBias(

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadiosity.cpp:786

Scope: file

Source code excerpt:

		PassParameters->HeightfieldSurfaceBias = Lumen::GetHeightfieldReceiverBias();
		PassParameters->MaxRayIntensity = FMath::Clamp(GLumenRadiosityMaxRayIntensity, 0.0f, 1000000.0f);
		PassParameters->MinTraceDistance = FMath::Clamp(GLumenRadiosityHardwareRayTracingSurfaceBias, 0.0f, 1000.0f);
		PassParameters->MaxTraceDistance = Lumen::GetMaxTraceDistance(View);
		PassParameters->MaxTraversalIterations = LumenHardwareRayTracing::GetMaxTraversalIterations();
		PassParameters->MinTraceDistanceToSampleSurfaceCache = LumenHardwareRayTracing::GetMinTraceDistanceToSampleSurfaceCache();

		FLumenRadiosityHardwareRayTracing::FPermutationDomain PermutationVector;