r.HeterogeneousVolumes.Shadows.Mode
r.HeterogeneousVolumes.Shadows.Mode
#Overview
name: r.HeterogeneousVolumes.Shadows.Mode
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0: Live-Shading (Default)1: Preshaded Voxel Grid
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HeterogeneousVolumes.Shadows.Mode is to control the shadow rendering mode for heterogeneous volumes in Unreal Engine 5’s rendering system. It allows developers to choose between two shadow rendering techniques for heterogeneous volumes: live-shading (default) or preshaded voxel grid.
This setting variable is primarily used by the Renderer module, specifically within the HeterogeneousVolumes subsystem. It’s defined and utilized in the HeterogeneousVolumes.cpp file, which is part of the rendering pipeline for handling heterogeneous volumes.
The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 0, which corresponds to the live-shading mode. Developers can change this value at runtime using console commands or through code.
The associated variable CVarHeterogeneousVolumesShadowMode directly interacts with r.HeterogeneousVolumes.Shadows.Mode. It’s an instance of TAutoConsoleVariable
Developers must be aware that this variable affects the performance and visual quality of shadow rendering for heterogeneous volumes. The choice between live-shading and preshaded voxel grid can have implications on both rendering speed and shadow quality.
Best practices when using this variable include:
- Testing both modes (0 and 1) to determine which provides the best balance of performance and visual quality for your specific use case.
- Considering the impact on performance, especially in scenes with complex heterogeneous volumes.
- Using the GetShadowMode() function to retrieve the current mode in code, ensuring thread-safe access on the render thread.
Regarding the associated variable CVarHeterogeneousVolumesShadowMode:
- Its purpose is to provide a programmatic interface to the r.HeterogeneousVolumes.Shadows.Mode setting.
- It’s used within the Renderer module, specifically in the HeterogeneousVolumes namespace.
- Its value is set through the console variable system and can be accessed using GetValueOnRenderThread().
- It directly determines the behavior of the GetShadowMode() function, which returns an EShadowMode enum based on the current value.
- Developers should be aware that this variable is render thread safe and should be accessed accordingly.
- Best practices include using the provided GetShadowMode() function instead of directly accessing the console variable, as it ensures proper typing and thread safety.
#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:43
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowMode(
TEXT("r.HeterogeneousVolumes.Shadows.Mode"),
0,
TEXT("0: Live-Shading (Default)")
TEXT("1: Preshaded Voxel Grid"),
ECVF_RenderThreadSafe
);
#Associated Variable and Callsites
This variable is associated with another variable named CVarHeterogeneousVolumesShadowMode
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:42
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowMode(
TEXT("r.HeterogeneousVolumes.Shadows.Mode"),
0,
TEXT("0: Live-Shading (Default)")
TEXT("1: Preshaded Voxel Grid"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:430
Scope (from outer to inner):
file
namespace HeterogeneousVolumes
function EShadowMode GetShadowMode
Source code excerpt:
EShadowMode GetShadowMode()
{
return static_cast<EShadowMode>(CVarHeterogeneousVolumesShadowMode.GetValueOnRenderThread());
}
bool UseSparseVoxelPipeline()
{
return CVarHeterogeneousVolumesSparseVoxel.GetValueOnRenderThread() != 0;
}