r.HeterogeneousVolumes.Shadows.RelativeErrorThreshold
r.HeterogeneousVolumes.Shadows.RelativeErrorThreshold
#Overview
name: r.HeterogeneousVolumes.Shadows.RelativeErrorThreshold
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Relative error threshold for volume shadow compression (Default = 0.05)\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HeterogeneousVolumes.Shadows.RelativeErrorThreshold is to set the relative error threshold for volume shadow compression in the heterogeneous volumes rendering system. This setting is part of Unreal Engine 5’s advanced rendering features, specifically related to the handling of volumetric shadows in heterogeneous volumes.
This setting variable is primarily used in the Renderer module of Unreal Engine 5, particularly within the heterogeneous volumes subsystem. Based on the callsites, it’s clear that this variable is utilized in the HeterogeneousVolumesVoxelGridPipeline.cpp file, which is part of the rendering pipeline for heterogeneous volumes.
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 0.05 (5%) and can be modified at runtime through console commands or configuration files.
The associated variable CVarHeterogeneousVolumesShadowRelativeErrorThreshold directly interacts with this setting. It’s used to retrieve the current value of the setting in the GetShadowRelativeErrorThreshold() function, which ensures the value is never negative by using FMath::Max().
Developers must be aware that this variable affects the quality and performance trade-off in rendering volumetric shadows. A lower value will result in higher quality shadows but may impact performance, while a higher value will improve performance at the cost of shadow quality.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your scene and target hardware.
- Testing different values to find the optimal balance between visual quality and performance.
- Considering the impact on different platforms, especially when targeting both high-end and low-end devices.
Regarding the associated variable CVarHeterogeneousVolumesShadowRelativeErrorThreshold:
- Its purpose is to provide a programmatic interface to access and modify the r.HeterogeneousVolumes.Shadows.RelativeErrorThreshold setting.
- It’s used within the Renderer module, specifically in the heterogeneous volumes rendering pipeline.
- The value is set through the CVar system and can be modified at runtime.
- It interacts directly with the r.HeterogeneousVolumes.Shadows.RelativeErrorThreshold setting, essentially serving as its in-code representation.
- Developers should be aware that changes to this variable will directly affect the shadow rendering quality and performance.
- Best practices include using the GetValueOnRenderThread() method to access its value, as shown in the GetShadowRelativeErrorThreshold() function, to ensure thread-safe access in rendering code.
#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:232
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesShadowRelativeErrorThreshold(
TEXT("r.HeterogeneousVolumes.Shadows.RelativeErrorThreshold"),
0.05,
TEXT("Relative error threshold for volume shadow compression (Default = 0.05)\n"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowUseAVSMCompression(
#Associated Variable and Callsites
This variable is associated with another variable named CVarHeterogeneousVolumesShadowRelativeErrorThreshold
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:231
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesShadowRelativeErrorThreshold(
TEXT("r.HeterogeneousVolumes.Shadows.RelativeErrorThreshold"),
0.05,
TEXT("Relative error threshold for volume shadow compression (Default = 0.05)\n"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:433
Scope (from outer to inner):
file
namespace HeterogeneousVolumes
function float GetShadowRelativeErrorThreshold
Source code excerpt:
float GetShadowRelativeErrorThreshold()
{
return FMath::Max(CVarHeterogeneousVolumesShadowRelativeErrorThreshold.GetValueOnRenderThread(), 0.0);
}
bool UseAVSMCompression()
{
return CVarHeterogeneousVolumesShadowUseAVSMCompression.GetValueOnRenderThread() != 0;
}