r.Lumen.RadianceCache.HardwareRayTracing

r.Lumen.RadianceCache.HardwareRayTracing

#Overview

name: r.Lumen.RadianceCache.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.Lumen.RadianceCache.HardwareRayTracing is to enable or disable hardware ray tracing for the Lumen radiance cache in Unreal Engine 5’s rendering system. This setting variable is primarily used in the Lumen subsystem, which is part of UE5’s global illumination solution.

The Unreal Engine subsystem that relies on this setting variable is the Lumen rendering module, specifically the radiance cache component. This can be seen from the file location (LumenRadianceCacheHardwareRayTracing.cpp) and the namespace (Lumen) in which it’s used.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1, meaning hardware ray tracing for the Lumen radiance cache is enabled by default. Developers can change this value at runtime using console commands or through project settings.

This variable interacts with other ray tracing and Lumen-related variables. For example, it’s used in conjunction with IsRayTracingEnabled() and Lumen::UseHardwareRayTracing(ViewFamily) to determine if hardware ray traced radiance cache should be used.

Developers must be aware that this variable only takes effect if ray tracing is enabled in the project and if the hardware supports it. They should also consider the performance implications of enabling hardware ray tracing, as it can be computationally expensive.

Best practices when using this variable include:

  1. Only enable it when targeting hardware that supports ray tracing.
  2. Consider providing in-game options to toggle this feature for performance reasons.
  3. Test the visual quality and performance impact with and without this feature enabled.

Regarding the associated variable CVarLumenRadianceCacheHardwareRayTracing, it’s the actual console variable object that controls the setting. It’s used internally by the engine to store and retrieve the current value of the setting. The purpose and usage are the same as described for r.Lumen.RadianceCache.HardwareRayTracing. Developers typically don’t need to interact with this variable directly, as they can use the console command or project settings to modify the value.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCacheHardwareRayTracing.cpp:20

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarLumenRadianceCacheHardwareRayTracing(
	TEXT("r.Lumen.RadianceCache.HardwareRayTracing"),
	1,
	TEXT("Enables hardware ray tracing for Lumen radiance cache (Default = 1)"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarLumenRadianceCacheTemporaryBufferAllocationDownsampleFactor(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCacheHardwareRayTracing.cpp:19

Scope: file

Source code excerpt:

#include "LumenHardwareRayTracingCommon.h"

static TAutoConsoleVariable<int32> CVarLumenRadianceCacheHardwareRayTracing(
	TEXT("r.Lumen.RadianceCache.HardwareRayTracing"),
	1,
	TEXT("Enables hardware ray tracing for Lumen radiance cache (Default = 1)"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenRadianceCacheHardwareRayTracing.cpp:49

Scope (from outer to inner):

file
namespace    Lumen
function     bool UseHardwareRayTracedRadianceCache

Source code excerpt:

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