r.HeterogeneousVolumes.VolumeResolution.Z

r.HeterogeneousVolumes.VolumeResolution.Z

#Overview

name: r.HeterogeneousVolumes.VolumeResolution.Z

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.VolumeResolution.Z is to override the preshading and lighting volume resolution in the Z-axis for heterogeneous volumes in Unreal Engine 5’s rendering system.

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

The value of this variable is set through the console variable system. It’s defined as a TAutoConsoleVariable with an initial value of 0, which means it’s disabled by default and uses per-volume attributes instead.

This variable interacts closely with two other similar variables: CVarHeterogeneousVolumesPreshadingVolumeResolutionX and CVarHeterogeneousVolumesPreshadingVolumeResolutionY, which control the resolution in the X and Y axes respectively. Together, these three variables can override the default volume resolution in all three dimensions.

Developers must be aware that:

  1. A value of 0 means the variable is disabled, and the engine will use per-volume attributes instead.
  2. Any value greater than 0 will override the resolution in the Z-axis.
  3. The actual resolution used is clamped between 1 and 1024, as seen in the GetVolumeResolution function.

Best practices when using this variable include:

  1. Only override the resolution when necessary, as it can impact performance and memory usage.
  2. Consider the trade-offs between resolution and performance when setting a value.
  3. Ensure consistency across X, Y, and Z resolutions for uniform volume quality.

Regarding the associated variable CVarHeterogeneousVolumesPreshadingVolumeResolutionZ:

This is the actual console variable object that controls the Z-axis resolution. It’s used internally by the engine to store and retrieve the current value of the r.HeterogeneousVolumes.VolumeResolution.Z setting.

The purpose of this variable is the same as r.HeterogeneousVolumes.VolumeResolution.Z, but it represents the programmatic interface for accessing and modifying the value.

This variable is used in the GetVolumeResolution function to retrieve the current Z-axis resolution value on the render thread. It’s part of the mechanism that allows runtime modification of the volume resolution.

Developers should be aware that this variable is marked as ECVF_RenderThreadSafe, meaning it’s safe to modify from the render thread. However, changes to this variable should still be made carefully, as they can impact rendering performance and quality.

Best practices for using this variable include accessing its value using the GetValueOnRenderThread() method when in render thread contexts, and considering potential performance implications when modifying it at runtime.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesPreshadingVolumeResolutionZ(
	TEXT("r.HeterogeneousVolumes.VolumeResolution.Z"),
	0,
	TEXT("Overrides the preshading and lighting volume resolution in X (Default = 0)")
	TEXT("0: Disabled, uses per-volume attribute\n")
	TEXT(">0: Overrides resolution in Z\n"),
	ECVF_RenderThreadSafe
);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesPreshadingVolumeResolutionZ(
	TEXT("r.HeterogeneousVolumes.VolumeResolution.Z"),
	0,
	TEXT("Overrides the preshading and lighting volume resolution in X (Default = 0)")
	TEXT("0: Disabled, uses per-volume attribute\n")
	TEXT(">0: Overrides resolution in Z\n"),
	ECVF_RenderThreadSafe

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

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     FIntVector GetVolumeResolution

Source code excerpt:

			CVarHeterogeneousVolumesPreshadingVolumeResolutionX.GetValueOnRenderThread(),
			CVarHeterogeneousVolumesPreshadingVolumeResolutionY.GetValueOnRenderThread(),
			CVarHeterogeneousVolumesPreshadingVolumeResolutionZ.GetValueOnRenderThread());

		VolumeResolution.X = OverrideVolumeResolution.X > 0 ? OverrideVolumeResolution.X : VolumeResolution.X;
		VolumeResolution.Y = OverrideVolumeResolution.Y > 0 ? OverrideVolumeResolution.Y : VolumeResolution.Y;
		VolumeResolution.Z = OverrideVolumeResolution.Z > 0 ? OverrideVolumeResolution.Z : VolumeResolution.Z;

		// Clamp each dimension to [1, 1024]