r.HeterogeneousVolumes.CLOD

r.HeterogeneousVolumes.CLOD

#Overview

name: r.HeterogeneousVolumes.CLOD

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.HeterogeneousVolumes.CLOD is to control the use of Continuous Level-of-Detail (CLOD) for accelerating the rendering of heterogeneous volumes in Unreal Engine 5. This setting variable is primarily used in the rendering system, specifically for optimizing the rendering of complex volumetric effects.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evidenced by its location in the HeterogeneousVolumes.cpp file within the Renderer/Private directory.

The value of this variable is set using a console variable (CVarHeterogeneousVolumesCLOD) with a default value of 1, indicating that CLOD is enabled by default. It can be changed at runtime through console commands or configuration files.

This variable interacts directly with the associated variable CVarHeterogeneousVolumesCLOD, which is the actual TAutoConsoleVariable instance that stores and manages the setting’s value. Additionally, it indirectly interacts with CVarHeterogeneousVolumesCLODBias, which is likely used to fine-tune the CLOD behavior.

Developers must be aware that this variable affects render thread performance and visual quality. Enabling CLOD (value != 0) can improve rendering performance, especially for complex heterogeneous volumes, but may have a slight impact on visual fidelity at certain distances or view angles.

Best practices when using this variable include:

  1. Testing the performance impact with and without CLOD enabled for your specific use case.
  2. Adjusting the CLOD bias (using CVarHeterogeneousVolumesCLODBias) to find the optimal balance between performance and visual quality.
  3. Considering the target hardware when deciding whether to enable or disable CLOD.

Regarding the associated variable CVarHeterogeneousVolumesCLOD:

The purpose of CVarHeterogeneousVolumesCLOD is to provide a runtime-configurable way to enable or disable Continuous Level-of-Detail for heterogeneous volume rendering. It’s part of the Renderer module in Unreal Engine 5.

This variable is defined and set in the HeterogeneousVolumes.cpp file. Its value is accessed through the GetValueOnRenderThread() method, as seen in the UseContinuousLOD() function.

CVarHeterogeneousVolumesCLOD interacts directly with the r.HeterogeneousVolumes.CLOD console command and indirectly with CVarHeterogeneousVolumesCLODBias.

Developers should be aware that this variable is marked as ECVF_RenderThreadSafe, meaning it’s safe to modify from the render thread. Changes to this variable will affect rendering performance and potentially visual quality.

Best practices for using CVarHeterogeneousVolumesCLOD include:

  1. Using it in conjunction with performance profiling tools to measure its impact.
  2. Considering exposing it as a user-configurable option for high-end systems.
  3. Ensuring that any code accessing this variable does so using the appropriate thread-safe methods, such as GetValueOnRenderThread().

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:247

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesCLOD(
	TEXT("r.HeterogeneousVolumes.CLOD"),
	1,
	TEXT("Uses Continuous Level-of-Detail to accelerate rendering (Default = 1)"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<float> CVarHeterogeneousVolumesCLODBias(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:246

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesCLOD(
	TEXT("r.HeterogeneousVolumes.CLOD"),
	1,
	TEXT("Uses Continuous Level-of-Detail to accelerate rendering (Default = 1)"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:508

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     bool UseContinuousLOD

Source code excerpt:

	bool UseContinuousLOD()
	{
		return CVarHeterogeneousVolumesCLOD.GetValueOnRenderThread() != 0;
	}

	float GetCLODBias()
	{
		return CVarHeterogeneousVolumesCLODBias.GetValueOnRenderThread();
	}