r.LumenScene.DirectLighting.HardwareRayTracing

r.LumenScene.DirectLighting.HardwareRayTracing

#Overview

name: r.LumenScene.DirectLighting.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.DirectLighting.HardwareRayTracing is to enable or disable hardware ray tracing for Lumen direct lighting in Unreal Engine 5. This setting variable is part of the rendering system, specifically the Lumen global illumination system.

This setting variable is primarily used by the Lumen subsystem within the Renderer module of Unreal Engine 5. It is specifically utilized in the direct lighting calculations for Lumen scenes.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1, meaning hardware ray tracing for Lumen direct lighting is enabled by default.

The associated variable CVarLumenSceneDirectLightingHardwareRayTracing interacts directly with this setting. They share the same value and purpose.

Developers must be aware that this variable affects the rendering performance and quality. Enabling hardware ray tracing can significantly improve lighting quality but may also impact performance, especially on less capable hardware.

Best practices when using this variable include:

  1. Testing the performance impact on target hardware before finalizing settings.
  2. Considering the target platforms and their ray tracing capabilities.
  3. Balancing visual quality with performance requirements.

Regarding the associated variable CVarLumenSceneDirectLightingHardwareRayTracing:

This is the actual C++ variable that controls the setting. It is defined as a TAutoConsoleVariable, which allows it to be changed at runtime through console commands.

The variable is used in the Lumen::UseHardwareRayTracedDirectLighting function to determine whether hardware ray tracing should be used for direct lighting calculations. This function checks if ray tracing is enabled globally, if Lumen is using hardware ray tracing for the current view family, and if this specific setting is enabled.

Developers should note that this variable is marked with ECVF_Scalability and ECVF_RenderThreadSafe flags, indicating that it can be used for performance scaling and is safe to access from the render thread.

When working with this variable, developers should ensure that any changes are made in a thread-safe manner, preferably using the appropriate Unreal Engine interfaces for modifying console variables.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLightingHardwareRayTracing.cpp:17

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLumenSceneDirectLightingHardwareRayTracing(
	TEXT("r.LumenScene.DirectLighting.HardwareRayTracing"),
	1,
	TEXT("Enables hardware ray tracing for Lumen direct lighting (Default = 1)"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int> CVarLumenSceneDirectLightingHardwareRayTracingHeightfieldProjectionBias(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLightingHardwareRayTracing.cpp:16

Scope: file

Source code excerpt:

#include "LumenHardwareRayTracingCommon.h"

static TAutoConsoleVariable<int32> CVarLumenSceneDirectLightingHardwareRayTracing(
	TEXT("r.LumenScene.DirectLighting.HardwareRayTracing"),
	1,
	TEXT("Enables hardware ray tracing for Lumen direct lighting (Default = 1)"),
	ECVF_Scalability | ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenSceneDirectLightingHardwareRayTracing.cpp:46

Scope (from outer to inner):

file
namespace    Lumen
function     bool UseHardwareRayTracedDirectLighting

Source code excerpt:

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