r.HeterogeneousVolumes.Debug.MarchingMode

r.HeterogeneousVolumes.Debug.MarchingMode

#Overview

name: r.HeterogeneousVolumes.Debug.MarchingMode

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.Debug.MarchingMode is to control the marching mode for heterogeneous volumes in Unreal Engine’s rendering system. This setting variable is specifically used for debugging purposes within the heterogeneous volumes rendering pipeline.

This setting variable is primarily used in the Renderer module of Unreal Engine, specifically within the HeterogeneousVolumes subsystem. The code references are found in the HeterogeneousVolumesVoxelGridPipeline.cpp file, which suggests it’s part of the voxel grid pipeline for heterogeneous volumes.

The value of this variable is set through a console variable (CVar) system, allowing it to be changed at runtime. It’s initialized with a default value of 1, but can be modified through the console or configuration files.

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

Developers must be aware that this variable affects the marching mode used in the heterogeneous volumes rendering pipeline. The available options are: 0: Ray Marching (dt=StepSize) 1: Naive DDA 2: Optimized DDA 3: Optimized DDA w/ bitmask

When using this variable, developers should consider the performance implications of each marching mode. The best practice would be to use the default value (1: Naive DDA) for most cases, and only change it when specifically debugging or optimizing the heterogeneous volumes rendering.

Regarding the associated variable CVarHeterogeneousVolumesMarchingMode:

The purpose of CVarHeterogeneousVolumesMarchingMode is to provide a programmatic interface to access and modify the r.HeterogeneousVolumes.Debug.MarchingMode setting within C++ code.

This variable is used in the Renderer module, specifically in the HeterogeneousVolumes namespace. It’s accessed in the GetMarchingMode() function, which suggests it’s used to retrieve the current marching mode setting.

The value of CVarHeterogeneousVolumesMarchingMode is set and modified through the CVar system, just like r.HeterogeneousVolumes.Debug.MarchingMode.

CVarHeterogeneousVolumesMarchingMode directly interacts with r.HeterogeneousVolumes.Debug.MarchingMode, as they represent the same setting.

Developers should be aware that when using CVarHeterogeneousVolumesMarchingMode, its value is clamped between 0 and 3 in the GetMarchingMode() function. This ensures that only valid marching mode values are used.

The best practice when using CVarHeterogeneousVolumesMarchingMode is to access it through the GetMarchingMode() function, which ensures the value is properly clamped and retrieved from the render thread.

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesMarchingMode(
	TEXT("r.HeterogeneousVolumes.Debug.MarchingMode"),
	1,
	TEXT("The marching mode (Default = 0)\n")
	TEXT("0: Ray Marching (dt=StepSize)\n")
	TEXT("1: Naive DDA\n")
	TEXT("2: Optimized DDA\n")
	TEXT("3: Optimized DDA w/ bitmask\n"),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesMarchingMode(
	TEXT("r.HeterogeneousVolumes.Debug.MarchingMode"),
	1,
	TEXT("The marching mode (Default = 0)\n")
	TEXT("0: Ray Marching (dt=StepSize)\n")
	TEXT("1: Naive DDA\n")
	TEXT("2: Optimized DDA\n")

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

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     int32 GetMarchingMode

Source code excerpt:

	int32 GetMarchingMode()
	{
		return FMath::Clamp(CVarHeterogeneousVolumesMarchingMode.GetValueOnRenderThread(), 0, 3);
	}

	bool EnableVoxelHashing()
	{
		//return CVarHeterogeneousVolumesBottomLevelGridVoxelHashing.GetValueOnRenderThread() != 0;
		return false;