r.HeterogeneousVolumes.Tessellation.IndirectionGrid.Resolution

r.HeterogeneousVolumes.Tessellation.IndirectionGrid.Resolution

#Overview

name: r.HeterogeneousVolumes.Tessellation.IndirectionGrid.Resolution

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.IndirectionGrid.Resolution is to determine the intra-tile indirection grid resolution for heterogeneous volumes in the rendering system. This setting variable is primarily used in the rendering subsystem of Unreal Engine 5, specifically in the heterogeneous volumes rendering pipeline.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, as evidenced by the file location in the Renderer/Private/HeterogeneousVolumes directory.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 4 and can be changed at runtime through console commands or programmatically.

This variable interacts with its associated variable CVarHeterogeneousVolumesIndirectionGridResolution. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the resolution of the indirection grid used in heterogeneous volume rendering. A higher resolution may provide more detailed rendering but could also impact performance.

Best practices when using this variable include:

  1. Keeping the value between 1 and 4, as enforced by the GetIndirectionGridResolution() function.
  2. Testing different values to find the optimal balance between rendering quality and performance for your specific use case.
  3. Being cautious when changing this value at runtime, as it may affect rendering performance.

Regarding the associated variable CVarHeterogeneousVolumesIndirectionGridResolution:

The purpose of CVarHeterogeneousVolumesIndirectionGridResolution is the same as r.HeterogeneousVolumes.Tessellation.IndirectionGrid.Resolution. It’s an internal representation of the console variable used in the C++ code.

This variable is used directly in the GetIndirectionGridResolution() function within the HeterogeneousVolumes namespace. The function clamps the value between 1 and 4, ensuring that the indirection grid resolution stays within a valid range.

The value of this variable is set through the CVar system and can be accessed on the render thread using the GetValueOnRenderThread() method.

Developers should be aware that this variable is thread-safe for render thread access, as indicated by the ECVF_RenderThreadSafe flag in its declaration.

Best practices for using this variable include:

  1. Accessing its value using GetValueOnRenderThread() when needed in render thread contexts.
  2. Avoiding direct modification of this variable; instead, use the console variable system to change its value.
  3. Considering the performance implications of different resolution values in your specific rendering scenarios.

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesIndirectionGridResolution(
	TEXT("r.HeterogeneousVolumes.Tessellation.IndirectionGrid.Resolution"),
	4,
	TEXT("Determines intra-tile indirection grid resolution (Default = 4)"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesFarPlaneAutoTransition(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesIndirectionGridResolution(
	TEXT("r.HeterogeneousVolumes.Tessellation.IndirectionGrid.Resolution"),
	4,
	TEXT("Determines intra-tile indirection grid resolution (Default = 4)"),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     int32 GetIndirectionGridResolution

Source code excerpt:

	int32 GetIndirectionGridResolution()
	{
		return FMath::Clamp(CVarHeterogeneousVolumesIndirectionGridResolution.GetValueOnRenderThread(), 1, 4);
	}

	bool EnableLinearInterpolation()
	{
		return false;
	}