r.HeterogeneousVolumes.Shadows.Resolution

r.HeterogeneousVolumes.Shadows.Resolution

#Overview

name: r.HeterogeneousVolumes.Shadows.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.Shadows.Resolution is to control the resolution of the volumetric shadow map when building shadows for heterogeneous volumes in Unreal Engine 5’s rendering system.

This setting variable is primarily used in the Renderer module, specifically within the HeterogeneousVolumes subsystem. It’s part of the volumetric rendering pipeline, which is responsible for rendering complex, non-uniform volumes in the game world.

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

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

Developers should be aware of the following when using this variable:

  1. The value is clamped between 1 and 2048 when used in the GetShadowMapResolution() function.
  2. Higher resolutions will provide more detailed shadows but at the cost of increased memory usage and potentially lower performance.
  3. This setting affects the quality of shadows for heterogeneous volumes, which can have a significant impact on the visual fidelity of scenes with complex volumetric elements.

Best practices for using this variable include:

  1. Carefully balancing visual quality and performance by adjusting the resolution.
  2. Testing different values to find the optimal setting for your specific scene and target hardware.
  3. Consider exposing this setting to end-users as a graphics quality option, allowing them to adjust based on their hardware capabilities.

Regarding the associated variable CVarHeterogeneousVolumesShadowResolution:

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowResolution(
	TEXT("r.HeterogeneousVolumes.Shadows.Resolution"),
	512,
	TEXT("Resolution when building volumetric shadow map (Default = 512)\n"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<float> CVarHeterogeneousVolumesStepSizeForShadows(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowResolution(
	TEXT("r.HeterogeneousVolumes.Shadows.Resolution"),
	512,
	TEXT("Resolution when building volumetric shadow map (Default = 512)\n"),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     FIntPoint GetShadowMapResolution

Source code excerpt:

	FIntPoint GetShadowMapResolution()
	{
		return FIntPoint(FMath::Clamp(CVarHeterogeneousVolumesShadowResolution.GetValueOnRenderThread(), 1, 2048));
	}

	float GetStepSizeForShadows()
	{
		return FMath::Max(CVarHeterogeneousVolumesStepSizeForShadows.GetValueOnRenderThread(), 0.01f);
	}