r.HeterogeneousVolumes.Tessellation.BottomLevelGrid.HomogeneousAggregation

r.HeterogeneousVolumes.Tessellation.BottomLevelGrid.HomogeneousAggregation

#Overview

name: r.HeterogeneousVolumes.Tessellation.BottomLevelGrid.HomogeneousAggregation

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.BottomLevelGrid.HomogeneousAggregation is to enable or disable bottom-level voxel homogeneous aggregation in the heterogeneous volumes rendering system. This setting is part of Unreal Engine 5’s rendering system, specifically for handling heterogeneous volumes.

This setting variable is primarily used in the Renderer module, particularly in the HeterogeneousVolumes subsystem. 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 as a console variable using TAutoConsoleVariable. It’s initialized with a default value of 1, meaning the feature is enabled by default.

This variable interacts with another variable named CVarHeterogeneousVolumesBottomLevelGridHomogeneousAggregationThreshold, which likely sets the threshold for the homogeneous aggregation process.

Developers should be aware that this variable is render thread safe (ECVF_RenderThreadSafe), meaning it can be safely accessed and modified from the render thread without causing race conditions.

Best practices when using this variable include:

  1. Only modifying it when necessary, as it affects rendering performance.
  2. Testing the impact of enabling/disabling this feature on different hardware configurations.
  3. Considering the interaction with the associated threshold variable when adjusting settings.

Regarding the associated variable CVarHeterogeneousVolumesBottomLevelGridHomogeneousAggregation:

This is the actual console variable that stores the value of the r.HeterogeneousVolumes.Tessellation.BottomLevelGrid.HomogeneousAggregation setting. It’s an integer variable, where a non-zero value enables the feature and zero disables it.

The value of this variable is accessed in the EnableHomogeneousAggregation() function within the HeterogeneousVolumes namespace. This function likely controls whether the homogeneous aggregation process is applied during the rendering of heterogeneous volumes.

Developers should note that this variable is accessed using GetValueOnRenderThread(), which is the appropriate method for reading console variables from the render thread. When modifying rendering behavior based on this setting, it’s important to ensure that all accesses are done in a thread-safe manner, preferably from the render thread itself.

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesBottomLevelGridHomogeneousAggregation(
	TEXT("r.HeterogeneousVolumes.Tessellation.BottomLevelGrid.HomogeneousAggregation"),
	1,
	TEXT("Enables bottom-level voxel homogeneous aggregation (Default = 1)\n"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<float> CVarHeterogeneousVolumesBottomLevelGridHomogeneousAggregationThreshold(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesBottomLevelGridHomogeneousAggregation(
	TEXT("r.HeterogeneousVolumes.Tessellation.BottomLevelGrid.HomogeneousAggregation"),
	1,
	TEXT("Enables bottom-level voxel homogeneous aggregation (Default = 1)\n"),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     bool EnableHomogeneousAggregation

Source code excerpt:

	bool EnableHomogeneousAggregation()
	{
		return CVarHeterogeneousVolumesBottomLevelGridHomogeneousAggregation.GetValueOnRenderThread() != 0;
	}

	float GetHomogeneousAggregationThreshold()
	{
		return CVarHeterogeneousVolumesBottomLevelGridHomogeneousAggregationThreshold.GetValueOnRenderThread();
	}