r.HeterogeneousVolumes.VolumeResolution.X

r.HeterogeneousVolumes.VolumeResolution.X

#Overview

name: r.HeterogeneousVolumes.VolumeResolution.X

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

This setting variable is primarily used by the Renderer module, specifically within the HeterogeneousVolumes subsystem. It’s part of the rendering pipeline that deals with volumetric effects and lighting.

The value of this variable is set through the console variable system in Unreal Engine. It’s defined as a TAutoConsoleVariable, which means it can be changed at runtime through console commands or configuration files.

This variable interacts with two other similar variables for Y and Z dimensions (not shown in the provided code, but implied by the usage). Together, they form a 3D resolution setting for heterogeneous volumes.

Developers must be aware that:

  1. The default value is 0, which means the override is disabled.
  2. Setting a value greater than 0 will override the per-volume attribute for resolution in the X dimension.
  3. This setting affects both preshading and lighting calculations for heterogeneous volumes.

Best practices when using this variable include:

  1. Only override when necessary, as it affects all heterogeneous volumes in the scene.
  2. Consider performance implications when increasing resolution.
  3. Ensure consistent settings across X, Y, and Z dimensions for balanced results.

Regarding the associated variable CVarHeterogeneousVolumesPreshadingVolumeResolutionX:

This is the actual console variable object that stores and manages the r.HeterogeneousVolumes.VolumeResolution.X setting. It’s used internally by the engine to access and modify the setting value.

The purpose of this variable is to provide a programmatic interface to the r.HeterogeneousVolumes.VolumeResolution.X setting within the C++ code.

It’s used in the HeterogeneousVolumes namespace, specifically in the GetVolumeResolution function, to determine the final volume resolution. The value is retrieved using the GetValueOnRenderThread() method, ensuring thread-safe access in the rendering pipeline.

Developers should be aware that:

  1. This variable is render thread safe (ECVF_RenderThreadSafe flag).
  2. It’s used to create an override vector that’s applied to the existing volume resolution.

Best practices include:

  1. Always access this variable on the render thread when used in rendering code.
  2. Use the GetValueOnRenderThread() method for thread-safe access.
  3. Consider caching the value if used frequently, as console variable access can have a small performance cost.

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesPreshadingVolumeResolutionX(
	TEXT("r.HeterogeneousVolumes.VolumeResolution.X"),
	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 X\n"),
	ECVF_RenderThreadSafe
);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesPreshadingVolumeResolutionX(
	TEXT("r.HeterogeneousVolumes.VolumeResolution.X"),
	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 X\n"),
	ECVF_RenderThreadSafe

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

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     FIntVector GetVolumeResolution

Source code excerpt:


		FIntVector OverrideVolumeResolution = FIntVector(
			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;