r.HeterogeneousVolumes.FrustumGrid.NearPlaneDistance

r.HeterogeneousVolumes.FrustumGrid.NearPlaneDistance

#Overview

name: r.HeterogeneousVolumes.FrustumGrid.NearPlaneDistance

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.FrustumGrid.NearPlaneDistance is to set the near-plane distance for the frustum grid in the Heterogeneous Volumes rendering system. This setting is crucial for controlling the rendering of volumetric effects in Unreal Engine 5.

This setting variable is primarily used by the Renderer module, specifically within the Heterogeneous Volumes subsystem. It’s part of the advanced rendering features in Unreal Engine 5 that handle complex volumetric effects.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined with a default value of 1.0, but can be changed at runtime or through configuration files.

The associated variable CVarHeterogeneousVolumesFrustumGridNearPlaneDistance directly interacts with this setting. It’s the C++ representation of the console variable and is used to access the value in the engine’s code.

Developers must be aware that this variable affects the rendering performance and visual quality of volumetric effects. Adjusting this value can impact the detail and accuracy of volumetric rendering close to the camera.

Best practices when using this variable include:

  1. Carefully balancing performance and visual quality when adjusting the value.
  2. Testing the impact of changes across different hardware configurations.
  3. Considering the interaction with other volumetric rendering settings.

Regarding the associated variable CVarHeterogeneousVolumesFrustumGridNearPlaneDistance:

This is the C++ representation of the console variable. It’s used internally by the engine to access and modify the near-plane distance for the frustum grid. The GetNearPlaneDistanceForFrustumGrid() function uses this variable to retrieve the current value for use in rendering calculations.

Developers should note that this variable is marked as ECVF_RenderThreadSafe, meaning it’s safe to access from the render thread. When modifying or reading this value in custom code, ensure thread safety is maintained.

The best practice when working with this associated variable is to use the provided getter function (GetNearPlaneDistanceForFrustumGrid()) rather than accessing the console variable directly, as this ensures proper thread safety and potential future-proofing.

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarHeterogeneousVolumesFrustumGridNearPlaneDistance(
	TEXT("r.HeterogeneousVolumes.FrustumGrid.NearPlaneDistance"),
	1.0,
	TEXT("Sets near-plane distance for the frustum grid (Default = 1.0)\n"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<float> CVarHeterogeneousVolumesFrustumGridFarPlaneDistance(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<float> CVarHeterogeneousVolumesFrustumGridNearPlaneDistance(
	TEXT("r.HeterogeneousVolumes.FrustumGrid.NearPlaneDistance"),
	1.0,
	TEXT("Sets near-plane distance for the frustum grid (Default = 1.0)\n"),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     float GetNearPlaneDistanceForFrustumGrid

Source code excerpt:

	float GetNearPlaneDistanceForFrustumGrid()
	{
		return CVarHeterogeneousVolumesFrustumGridNearPlaneDistance.GetValueOnRenderThread();
	}

	float GetFarPlaneDistanceForFrustumGrid()
	{
		return CVarHeterogeneousVolumesFrustumGridFarPlaneDistance.GetValueOnRenderThread();
	}