r.HeterogeneousVolumes.Tessellation.FarPlaneAutoTransition

r.HeterogeneousVolumes.Tessellation.FarPlaneAutoTransition

#Overview

name: r.HeterogeneousVolumes.Tessellation.FarPlaneAutoTransition

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.FarPlaneAutoTransition is to control the automatic transitioning of the far-plane distance in heterogeneous volume rendering, specifically for tessellation. This setting is part of Unreal Engine’s rendering system, focusing on the heterogeneous volumes feature.

This setting variable is primarily used in the Renderer module of Unreal Engine, specifically within the HeterogeneousVolumes subsystem. It’s defined and used in the HeterogeneousVolumesVoxelGridPipeline.cpp file, which suggests it’s related to the voxel grid pipeline for heterogeneous volumes.

The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 1, meaning the feature is enabled by default. Developers can change this value at runtime using console commands or through configuration files.

This variable interacts closely with its associated C++ variable CVarHeterogeneousVolumesFarPlaneAutoTransition. They share the same value and purpose. The C++ variable is used to query the current state of this setting in the code.

Developers should be aware that this setting affects the performance and visual quality of heterogeneous volume rendering. When enabled (value != 0), it automatically adjusts the far-plane distance based on the projected minimum voxel size. This can help optimize rendering performance and quality for different viewing distances.

Best practices for using this variable include:

  1. Leave it enabled (default) unless specific rendering artifacts or performance issues are observed.
  2. If disabling, ensure to manually set appropriate far-plane distances for different scenarios.
  3. Monitor performance and visual quality when adjusting this setting, as it can have significant impacts on both.

Regarding the associated variable CVarHeterogeneousVolumesFarPlaneAutoTransition:

The purpose of CVarHeterogeneousVolumesFarPlaneAutoTransition is to provide a programmatic way to access and modify the r.HeterogeneousVolumes.Tessellation.FarPlaneAutoTransition setting within the C++ code.

This variable is used within the Renderer module, specifically in the HeterogeneousVolumes namespace. It’s queried in the EnableFarPlaneAutoTransition() function, which likely controls whether the far-plane auto-transition feature is active.

The value of this variable is set through the CVar system, mirroring the r.HeterogeneousVolumes.Tessellation.FarPlaneAutoTransition setting.

This variable directly interacts with the r.HeterogeneousVolumes.Tessellation.FarPlaneAutoTransition setting, serving as its C++ representation.

Developers should be aware that changes to this variable will immediately affect the rendering behavior of heterogeneous volumes. It’s accessed on the render thread, so modifications should be thread-safe.

Best practices for using this variable include:

  1. Use GetValueOnRenderThread() when accessing its value to ensure thread safety.
  2. Consider caching the value if used frequently to avoid repeated CVar lookups.
  3. Be cautious when modifying this value during runtime, as it can affect rendering performance and quality.

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesFarPlaneAutoTransition(
	TEXT("r.HeterogeneousVolumes.Tessellation.FarPlaneAutoTransition"),
	1,
	TEXT("Enables auto transitioning of far-plane distance, based on projected minimum voxel size (Default = 1)\n"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesEnableTopLevelBitmask(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesFarPlaneAutoTransition(
	TEXT("r.HeterogeneousVolumes.Tessellation.FarPlaneAutoTransition"),
	1,
	TEXT("Enables auto transitioning of far-plane distance, based on projected minimum voxel size (Default = 1)\n"),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     bool EnableFarPlaneAutoTransition

Source code excerpt:

	bool EnableFarPlaneAutoTransition()
	{
		return CVarHeterogeneousVolumesFarPlaneAutoTransition.GetValueOnRenderThread() != 0;
	}

	float GetMinimumVoxelSizeInFrustum()
	{
		return FMath::Max(CVarHeterogeneousVolumesMinimumVoxelSizeInFrustum.GetValueOnRenderThread(), 0.01);
	}