r.HeterogeneousVolumes.StepSize

r.HeterogeneousVolumes.StepSize

#Overview

name: r.HeterogeneousVolumes.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.StepSize is to control the ray-marching step size in the heterogeneous volumes rendering system of Unreal Engine 5. This setting variable is specifically used for fine-tuning the rendering of volumetric effects.

This setting variable is primarily used in the Renderer module of Unreal Engine, specifically within the heterogeneous volumes rendering subsystem. It’s referenced in the file “HeterogeneousVolumes.cpp”, which suggests it’s a core part of the volumetric rendering pipeline.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of -1.0, which means the feature is disabled by default. Developers can change this value at runtime using console commands or through engine configuration files.

The associated variable CVarHeterogeneousVolumesStepSize directly interacts with r.HeterogeneousVolumes.StepSize. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the performance and quality of volumetric rendering. A smaller step size will result in higher quality but at the cost of performance, while a larger step size will improve performance but may reduce visual quality.

Best practices when using this variable include:

  1. Only enable it (set to a positive value) when fine control over volumetric rendering is needed.
  2. Balance between visual quality and performance by adjusting the step size.
  3. Test thoroughly with different values to find the optimal setting for your specific use case.
  4. Be cautious when changing this value at runtime, as it may have immediate visual impacts.

Regarding the associated variable CVarHeterogeneousVolumesStepSize:

The purpose of CVarHeterogeneousVolumesStepSize is to provide a programmatic interface to control the r.HeterogeneousVolumes.StepSize setting within the C++ code of the engine.

This variable is used in the Renderer module, specifically in the heterogeneous volumes rendering system. It’s defined and used in the same file as r.HeterogeneousVolumes.StepSize.

The value of CVarHeterogeneousVolumesStepSize is set when the r.HeterogeneousVolumes.StepSize console variable is modified. It’s retrieved in the GetStepSize() function, which suggests it’s used to provide the current step size value to other parts of the rendering system.

No other variables directly interact with CVarHeterogeneousVolumesStepSize besides r.HeterogeneousVolumes.StepSize.

Developers should be aware that this is an internal engine variable and should not be modified directly. Instead, they should use the r.HeterogeneousVolumes.StepSize console variable to control the step size.

Best practices for CVarHeterogeneousVolumesStepSize include:

  1. Use the GetValueOnRenderThread() method to retrieve its value, as shown in the GetStepSize() function.
  2. Do not attempt to modify this variable directly; use the console variable system instead.
  3. Be aware of potential thread safety issues, as indicated by the ECVF_RenderThreadSafe flag in its definition.

#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:176

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarHeterogeneousVolumesStepSize(
	TEXT("r.HeterogeneousVolumes.StepSize"),
	-1.0,
	TEXT("The ray-marching step-size override (Default = -1.0, disabled)"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesLightingCache(

#Associated Variable and Callsites

This variable is associated with another variable named CVarHeterogeneousVolumesStepSize. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:175

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<float> CVarHeterogeneousVolumesStepSize(
	TEXT("r.HeterogeneousVolumes.StepSize"),
	-1.0,
	TEXT("The ray-marching step-size override (Default = -1.0, disabled)"),
	ECVF_RenderThreadSafe
);

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/HeterogeneousVolumes/HeterogeneousVolumes.cpp:404

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     float GetStepSize

Source code excerpt:

	float GetStepSize()
	{
		return CVarHeterogeneousVolumesStepSize.GetValueOnRenderThread();
	}

	float GetMaxStepCount()
	{
		return CVarHeterogeneousVolumesMaxStepCount.GetValueOnRenderThread();
	}