r.Lumen.TranslucencyVolume.HardwareRayTracing

r.Lumen.TranslucencyVolume.HardwareRayTracing

#Overview

name: r.Lumen.TranslucencyVolume.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.TranslucencyVolume.HardwareRayTracing is to enable or disable hardware ray tracing for the Lumen translucency volume in Unreal Engine 5’s rendering system. This setting variable is specifically related to the Lumen global illumination system, which is a key feature of UE5’s rendering capabilities.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically the Lumen component of the rendering system. This can be seen from the file path where the variable is defined: “Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeHardwareRayTracing.cpp”.

The value of this variable is set as a console variable using the TAutoConsoleVariable class. It is initialized with a default value of 1, meaning hardware ray tracing for the Lumen translucency volume is enabled by default.

This variable interacts with another variable named CVarLumenTranslucencyVolumeHardwareRayTracing. They share the same value and are essentially the same variable, with one being the console command version and the other being the C++ variable used in the code.

Developers must be aware that this variable is render thread safe (ECVF_RenderThreadSafe), which means it can be safely modified from any thread. However, changes will only take effect on the render thread.

Best practices when using this variable include:

  1. Only disable it if you’re experiencing performance issues related to ray-traced translucency or if you’re targeting hardware that doesn’t support ray tracing.
  2. Be aware that changing this setting may affect the visual quality and performance of translucent objects in your scene.
  3. Test your scenes with both enabled and disabled states to ensure your game looks and performs well in both scenarios.

Regarding the associated variable CVarLumenTranslucencyVolumeHardwareRayTracing:

This is the actual C++ variable used in the code to check if hardware ray tracing for the Lumen translucency volume is enabled. It’s used in the UseHardwareRayTracedTranslucencyVolume function to determine if the feature should be used.

The value of this variable is retrieved using the GetValueOnRenderThread() method, which ensures thread-safe access to the variable’s value.

When working with this variable, developers should:

  1. Use GetValueOnRenderThread() when accessing the value in render thread code.
  2. Be aware that the variable’s value can change at runtime, so always check its current value rather than caching it.
  3. Consider the performance implications of frequently checking this value in performance-critical code paths.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeHardwareRayTracing.cpp:22

Scope: file

Source code excerpt:

// Console variables
static TAutoConsoleVariable<int32> CVarLumenTranslucencyVolumeHardwareRayTracing(
	TEXT("r.Lumen.TranslucencyVolume.HardwareRayTracing"),
	1,
	TEXT("Enables hardware ray tracing for Lumen translucency volume (Default = 1)"),
	ECVF_RenderThreadSafe
);

#endif // RHI_RAYTRACING

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeHardwareRayTracing.cpp:21

Scope: file

Source code excerpt:


// Console variables
static TAutoConsoleVariable<int32> CVarLumenTranslucencyVolumeHardwareRayTracing(
	TEXT("r.Lumen.TranslucencyVolume.HardwareRayTracing"),
	1,
	TEXT("Enables hardware ray tracing for Lumen translucency volume (Default = 1)"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/LumenTranslucencyVolumeHardwareRayTracing.cpp:37

Scope (from outer to inner):

file
namespace    Lumen
function     bool UseHardwareRayTracedTranslucencyVolume

Source code excerpt:

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