r.HeterogeneousVolumes.ShadowStepSize
r.HeterogeneousVolumes.ShadowStepSize
#Overview
name: r.HeterogeneousVolumes.ShadowStepSize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The ray-marching step-size override for shadow rays (Default = -1.0, disabled)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HeterogeneousVolumes.ShadowStepSize is to control the ray-marching step size for shadow rays in heterogeneous volumes rendering. This setting is primarily used in the rendering system, specifically for handling shadows in volumetric environments.
This setting variable is relied upon by the Renderer module of Unreal Engine, particularly within the HeterogeneousVolumes subsystem. It’s defined and used in the HeterogeneousVolumes.cpp file, which is part of the rendering pipeline for complex volumetric effects.
The value of this variable is set through the console variable system in Unreal Engine. It’s initialized with a default value of -1.0, which means the feature is disabled by default. Users can modify this value at runtime using console commands or through configuration files.
The associated variable CVarHeterogeneousVolumesShadowStepSize directly interacts with r.HeterogeneousVolumes.ShadowStepSize. This console variable is used to store and retrieve the actual value of the setting.
Developers must be aware that this variable affects the performance and quality of shadow rendering in heterogeneous volumes. A smaller step size will result in more accurate shadows but at the cost of increased computational overhead. Conversely, a larger step size will be faster but may lead to less precise shadows.
Best practices when using this variable include:
- Only enable it (set to a positive value) when dealing with heterogeneous volumes that require precise shadow rendering.
- Experiment with different values to find the optimal balance between performance and visual quality for your specific use case.
- Consider exposing this setting to end-users in graphics options if your game heavily relies on volumetric effects.
Regarding the associated variable CVarHeterogeneousVolumesShadowStepSize:
- Its purpose is to provide a programmatic interface to get and set the shadow step size value.
- It’s used within the HeterogeneousVolumes namespace, specifically in the GetShadowStepSize() function.
- The value is retrieved using the GetValueOnRenderThread() method, ensuring thread-safe access in the render thread.
- Developers should use this variable when they need to read or modify the shadow step size value in C++ code, rather than directly accessing the console variable.
#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:141
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesShadowStepSize(
TEXT("r.HeterogeneousVolumes.ShadowStepSize"),
-1.0,
TEXT("The ray-marching step-size override for shadow rays (Default = -1.0, disabled)"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesSparseVoxel(
#Associated Variable and Callsites
This variable is associated with another variable named CVarHeterogeneousVolumesShadowStepSize
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:140
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesShadowStepSize(
TEXT("r.HeterogeneousVolumes.ShadowStepSize"),
-1.0,
TEXT("The ray-marching step-size override for shadow rays (Default = -1.0, disabled)"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:389
Scope (from outer to inner):
file
namespace HeterogeneousVolumes
function float GetShadowStepSize
Source code excerpt:
float GetShadowStepSize()
{
return CVarHeterogeneousVolumesShadowStepSize.GetValueOnRenderThread();
}
float GetMaxTraceDistance()
{
return CVarHeterogeneousVolumesMaxTraceDistance.GetValueOnRenderThread();
}