r.Lumen.HardwareRayTracing.Inline

r.Lumen.HardwareRayTracing.Inline

#Overview

name: r.Lumen.HardwareRayTracing.Inline

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.HardwareRayTracing.Inline is to control the usage of Hardware Inline Ray Tracing for selected Lumen passes in Unreal Engine 5’s rendering system. This setting variable is specifically related to the Lumen global illumination system and its ray tracing capabilities.

This setting variable is primarily used by the Lumen subsystem within the Unreal Engine 5 renderer module. Based on the callsites, it’s clear that this variable is utilized in the LumenHardwareRayTracingCommon.cpp file, which is part of the Lumen implementation.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, meaning it’s enabled by default. Developers can modify this value at runtime using console commands or through project settings.

The associated variable CVarLumenUseHardwareRayTracingInline interacts directly with r.Lumen.HardwareRayTracing.Inline. They share the same value and purpose, with CVarLumenUseHardwareRayTracingInline being the actual C++ variable used in the code to check the setting’s value.

Developers must be aware that this variable affects the performance and quality of Lumen’s global illumination. Enabling hardware inline ray tracing can potentially improve performance on supported hardware, but it may not be available on all platforms or devices.

Best practices when using this variable include:

  1. Testing the performance impact on target hardware before shipping.
  2. Providing user options to toggle this setting if performance varies significantly between hardware configurations.
  3. Ensuring fallback methods are in place for platforms that don’t support hardware inline ray tracing.

Regarding the associated variable CVarLumenUseHardwareRayTracingInline:

The purpose of CVarLumenUseHardwareRayTracingInline is to provide a programmatic way to access and modify the r.Lumen.HardwareRayTracing.Inline setting within the C++ code.

This variable is used directly in the Lumen subsystem of the Unreal Engine 5 renderer, specifically in the LumenHardwareRayTracingCommon.cpp file.

The value of CVarLumenUseHardwareRayTracingInline is set through the CVar system and can be modified at runtime.

It interacts directly with the r.Lumen.HardwareRayTracing.Inline console variable, effectively representing its value in the C++ code.

Developers should be aware that changing this variable’s value will directly affect the behavior of Lumen’s hardware ray tracing capabilities.

Best practices for using CVarLumenUseHardwareRayTracingInline include:

  1. Using GetValueOnRenderThread() to access its value in render thread code.
  2. Avoiding frequent changes to this value during gameplay, as it may cause performance hitches.
  3. Considering platform-specific overrides or quality settings that may need to modify this value.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenHardwareRayTracingCommon.cpp:45

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLumenUseHardwareRayTracingInline(
	TEXT("r.Lumen.HardwareRayTracing.Inline"),
	1,
	TEXT("Uses Hardware Inline Ray Tracing for selected Lumen passes, when available.\n"),
	ECVF_RenderThreadSafe | ECVF_Scalability
);

static TAutoConsoleVariable<float> CVarLumenHardwareRayTracingPullbackBias(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenHardwareRayTracingCommon.cpp:44

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarLumenUseHardwareRayTracingInline(
	TEXT("r.Lumen.HardwareRayTracing.Inline"),
	1,
	TEXT("Uses Hardware Inline Ray Tracing for selected Lumen passes, when available.\n"),
	ECVF_RenderThreadSafe | ECVF_Scalability
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenHardwareRayTracingCommon.cpp:164

Scope (from outer to inner):

file
function     bool Lumen::UseHardwareInlineRayTracing

Source code excerpt:

		&& LumenHardwareRayTracing::IsInlineSupported()
		// Can't disable inline tracing if RayGen isn't supported
		&& (CVarLumenUseHardwareRayTracingInline.GetValueOnRenderThread() != 0 || !LumenHardwareRayTracing::IsRayGenSupported()))
	{
		return true;
	}
#endif

	return false;