r.HeterogeneousVolumes.Shadows.AbsoluteErrorThreshold

r.HeterogeneousVolumes.Shadows.AbsoluteErrorThreshold

#Overview

name: r.HeterogeneousVolumes.Shadows.AbsoluteErrorThreshold

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.Shadows.AbsoluteErrorThreshold is to set an absolute error threshold for volume shadow compression in the heterogeneous volumes rendering system.

This setting variable is primarily used by the rendering system, specifically within the heterogeneous volumes subsystem of Unreal Engine 5. Based on the callsites, it appears to be part of the Renderer module.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable with a default value of 0.0.

This variable interacts with another variable named CVarHeterogeneousVolumesShadowRelativeErrorThreshold, which sets a relative error threshold for the same purpose.

Developers must be aware that this variable affects the compression of volume shadows in heterogeneous volumes. A higher value will allow for more compression, potentially improving performance at the cost of shadow quality. A value of 0.0 (the default) means no absolute error threshold is applied.

Best practices when using this variable include:

  1. Use it in conjunction with the relative error threshold for fine-tuned control over shadow compression.
  2. Adjust it carefully, as it directly impacts the visual quality of shadows in heterogeneous volumes.
  3. Test different values to find the right balance between performance and visual quality for your specific use case.

Regarding the associated variable CVarHeterogeneousVolumesShadowAbsoluteErrorThreshold:

This is the actual console variable object that stores and manages the r.HeterogeneousVolumes.Shadows.AbsoluteErrorThreshold setting. It’s used internally by the engine to access the current value of the setting.

The value of this variable is accessed in the GetShadowAbsoluteErrorThreshold() function within the HeterogeneousVolumes namespace. This function ensures that the returned value is never negative by using FMath::Max().

Developers should be aware that this variable is marked as ECVF_RenderThreadSafe, meaning it can be safely accessed from the render thread.

When working with this variable, it’s important to use the GetValueOnRenderThread() method to access its value, as shown in the GetShadowAbsoluteErrorThreshold() function. This ensures thread-safe access to the variable’s value.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarHeterogeneousVolumesShadowAbsoluteErrorThreshold(
	TEXT("r.HeterogeneousVolumes.Shadows.AbsoluteErrorThreshold"),
	0.0,
	TEXT("Absolute error threshold for volume shadow compression (Default = 0.0)\n"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<float> CVarHeterogeneousVolumesShadowRelativeErrorThreshold(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<float> CVarHeterogeneousVolumesShadowAbsoluteErrorThreshold(
	TEXT("r.HeterogeneousVolumes.Shadows.AbsoluteErrorThreshold"),
	0.0,
	TEXT("Absolute error threshold for volume shadow compression (Default = 0.0)\n"),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     float GetShadowAbsoluteErrorThreshold

Source code excerpt:

	float GetShadowAbsoluteErrorThreshold()
	{
		return FMath::Max(CVarHeterogeneousVolumesShadowAbsoluteErrorThreshold.GetValueOnRenderThread(), 0.0);
	}

	float GetShadowRelativeErrorThreshold()
	{
		return FMath::Max(CVarHeterogeneousVolumesShadowRelativeErrorThreshold.GetValueOnRenderThread(), 0.0);
	}