r.HeterogeneousVolumes.Shadows.StepSize

r.HeterogeneousVolumes.Shadows.StepSize

#Overview

name: r.HeterogeneousVolumes.Shadows.StepSize

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.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:

  1. Balancing quality and performance by adjusting the step size.
  2. Testing different values to find the optimal setting for your specific scene.
  3. Considering the impact on performance, especially for less powerful hardware.
  4. Using it in conjunction with other shadow-related settings for best results.

Regarding the associated variable CVarHeterogeneousVolumesStepSizeForShadows:

#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);
	}