r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max

r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max

#Overview

name: r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max

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.Tessellation.MajorantGrid.Max is to enable the building of majorant grids for accelerating volume tracking in the heterogeneous volumes rendering system of Unreal Engine 5.

This setting variable is primarily used in the Renderer module, specifically within the heterogeneous volumes subsystem. Based on the callsites, it’s part of the voxel grid pipeline for heterogeneous volumes rendering.

The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It’s initialized with a default value of 0, meaning the feature is disabled by default.

The associated variable CVarHeterogeneousVolumesEnableMajorantGridMax directly interacts with r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max. They share the same value and purpose.

Developers must be aware that:

  1. This variable is render thread safe, as indicated by the ECVF_RenderThreadSafe flag.
  2. Enabling this feature (by setting it to a non-zero value) may impact performance, as it involves additional computations for building majorant grids.

Best practices when using this variable include:

  1. Only enable it when necessary, as it may have performance implications.
  2. Test thoroughly with both enabled and disabled states to ensure it provides the desired acceleration without introducing visual artifacts.
  3. Consider exposing this setting in the game’s graphics options for advanced users, allowing them to fine-tune performance.

Regarding the associated variable CVarHeterogeneousVolumesEnableMajorantGridMax:

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesEnableMajorantGridMax(
	TEXT("r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max"),
	0,
	TEXT("Enables building majorant grids to accelerate volume tracking (Default = 0)\n"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowCameraDownsampleFactor(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesEnableMajorantGridMax(
	TEXT("r.HeterogeneousVolumes.Tessellation.MajorantGrid.Max"),
	0,
	TEXT("Enables building majorant grids to accelerate volume tracking (Default = 0)\n"),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
function     void BuildMajorantVoxelGrid

Source code excerpt:

		}

		bool bUseMax = CVarHeterogeneousVolumesEnableMajorantGridMax.GetValueOnRenderThread() != 0;
		if (bUseMax)
		{

			// Downsample majorant grid
			FIntVector InputDimensions = TopLevelGridResolution;
			FRDGBufferRef InputBuffer = MajorantVoxelGridBuffer;