r.HeterogeneousVolumes.Shadows.StepSize
r.HeterogeneousVolumes.Shadows.StepSize
#Overview
name: r.HeterogeneousVolumes.Shadows.StepSize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Ray marching step size when building volumetric shadow map (Default = 2.0)\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.HeterogeneousVolumes.Shadows.StepSize is to control the ray marching step size when building volumetric shadow maps in Unreal Engine’s heterogeneous volumes rendering system.
This setting variable is primarily used in the rendering system, specifically for the heterogeneous volumes feature. It is part of Unreal Engine’s advanced rendering capabilities, focusing on volumetric effects and shadows.
Based on the callsites, this variable is utilized in the Renderer module, particularly within the HeterogeneousVolumes namespace. It’s referenced in the file HeterogeneousVolumesVoxelGridPipeline.cpp, which suggests it’s part of the voxel grid 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 2.0, but can be modified at runtime through console commands or project settings.
The associated variable CVarHeterogeneousVolumesStepSizeForShadows directly interacts with r.HeterogeneousVolumes.Shadows.StepSize. They share the same value and purpose.
Developers must be aware that this variable affects the quality and performance of volumetric shadows. A smaller step size can result in higher quality shadows but at the cost of increased rendering time.
Best practices when using this variable include:
- Balancing quality and performance by adjusting the step size.
- Testing different values to find the optimal setting for your specific scene.
- Considering the impact on performance, especially for less powerful hardware.
- Using it in conjunction with other shadow-related settings for best results.
Regarding the associated variable CVarHeterogeneousVolumesStepSizeForShadows:
- It’s a TAutoConsoleVariable of type float, allowing for runtime modifications.
- It’s used in the GetStepSizeForShadows() function, which ensures the value is never less than 0.01f for stability.
- The variable is accessed using GetValueOnRenderThread(), indicating it’s safe for use in render thread operations.
- Developers should use this variable through the provided GetStepSizeForShadows() function to ensure proper clamping 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/HeterogeneousVolumesVoxelGridPipeline.cpp:211
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesStepSizeForShadows(
TEXT("r.HeterogeneousVolumes.Shadows.StepSize"),
2.0,
TEXT("Ray marching step size when building volumetric shadow map (Default = 2.0)\n"),
ECVF_RenderThreadSafe
);
static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowMaxSampleCount(
#Associated Variable and Callsites
This variable is associated with another variable named CVarHeterogeneousVolumesStepSizeForShadows
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:210
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<float> CVarHeterogeneousVolumesStepSizeForShadows(
TEXT("r.HeterogeneousVolumes.Shadows.StepSize"),
2.0,
TEXT("Ray marching step size when building volumetric shadow map (Default = 2.0)\n"),
ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumesVoxelGridPipeline.cpp:418
Scope (from outer to inner):
file
namespace HeterogeneousVolumes
function float GetStepSizeForShadows
Source code excerpt:
float GetStepSizeForShadows()
{
return FMath::Max(CVarHeterogeneousVolumesStepSizeForShadows.GetValueOnRenderThread(), 0.01f);
}
uint32 GetShadowMaxSampleCount()
{
return FMath::Clamp(CVarHeterogeneousVolumesShadowMaxSampleCount.GetValueOnRenderThread(), 2, 64);
}