r.HeterogeneousVolumes.ShadowStepSize

r.HeterogeneousVolumes.ShadowStepSize

#Overview

name: r.HeterogeneousVolumes.ShadowStepSize

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

  1. Only enable it (set to a positive value) when dealing with heterogeneous volumes that require precise shadow rendering.
  2. Experiment with different values to find the optimal balance between performance and visual quality for your specific use case.
  3. Consider exposing this setting to end-users in graphics options if your game heavily relies on volumetric effects.

Regarding the associated variable CVarHeterogeneousVolumesShadowStepSize:

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