r.LumenScene.Radiosity.HardwareRayTracing

r.LumenScene.Radiosity.HardwareRayTracing

#Overview

name: r.LumenScene.Radiosity.HardwareRayTracing

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 is to enable or disable hardware ray tracing for radiosity in the Lumen global illumination system of Unreal Engine 5. This setting is part of the rendering system, specifically the Lumen lighting and global illumination subsystem.

The Lumen module within the Unreal Engine renderer relies on this setting variable. It is used to determine whether hardware ray tracing should be employed for radiosity calculations in the Lumen global illumination system.

The value of this variable is set through a console variable (CVarLumenRadiosityHardwareRayTracing) with a default value of 1 (enabled). It can be changed at runtime through console commands or programmatically.

This variable interacts with other ray tracing and Lumen-related settings. It is used in conjunction with IsRayTracingEnabled() and Lumen::UseHardwareRayTracing(ViewFamily) to determine if hardware ray traced radiosity should be used.

Developers must be aware that:

  1. This setting requires hardware support for ray tracing.
  2. Enabling this feature may have performance implications, especially on less powerful hardware.
  3. The effect of this setting is only visible when ray tracing is enabled in the project settings and supported by the hardware.

Best practices when using this variable include:

  1. Providing user options to toggle this setting for performance optimization.
  2. Fallback mechanisms for when hardware ray tracing is not supported.
  3. Performance testing with this setting enabled and disabled to understand its impact on your specific project.

Regarding the associated variable CVarLumenRadiosityHardwareRayTracing:

The purpose of CVarLumenRadiosityHardwareRayTracing is to provide a console-accessible way to control the r.LumenScene.Radiosity.HardwareRayTracing setting. It is defined as a TAutoConsoleVariable, which allows it to be changed at runtime through console commands.

This variable is used directly in the Lumen subsystem of the renderer to determine whether to use hardware ray tracing for radiosity calculations. It’s checked in the UseHardwareRayTracedRadiosity function.

The value of this variable is set to 1 by default, but can be changed through console commands or programmatically at runtime.

Developers should be aware that changes to this variable will take effect on the render thread, as indicated by the ECVF_RenderThreadSafe flag.

Best practices for using this variable include:

  1. Using it for debugging or performance testing purposes.
  2. Providing a user interface option that modifies this variable if you want to give users control over this feature.
  3. Considering the performance implications of enabling or disabling this feature in different scenarios or on 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/LumenRadiosity.cpp:128

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLumenRadiosityHardwareRayTracing(
	TEXT("r.LumenScene.Radiosity.HardwareRayTracing"),
	1,
	TEXT("Enables hardware ray tracing for radiosity (default = 1)."),
	ECVF_RenderThreadSafe
);

int32 GLumenRadiosityTemporalAccumulation = 1;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarLumenRadiosityHardwareRayTracing(
	TEXT("r.LumenScene.Radiosity.HardwareRayTracing"),
	1,
	TEXT("Enables hardware ray tracing for radiosity (default = 1)."),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
function     bool Lumen::UseHardwareRayTracedRadiosity

Source code excerpt:

	return IsRayTracingEnabled()
		&& Lumen::UseHardwareRayTracing(ViewFamily)
		&& (CVarLumenRadiosityHardwareRayTracing.GetValueOnRenderThread() != 0);
#else
	return false;
#endif
}

bool Lumen::ShouldRenderRadiosityHardwareRayTracing(const FSceneViewFamily& ViewFamily)