r.HeterogeneousVolumes.Shadows.MaxSampleCount

r.HeterogeneousVolumes.Shadows.MaxSampleCount

#Overview

name: r.HeterogeneousVolumes.Shadows.MaxSampleCount

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.MaxSampleCount is to control the maximum sample count when building volumetric shadow maps in Unreal Engine’s heterogeneous volumes rendering system.

This setting variable is primarily used by the Renderer module, specifically within the heterogeneous volumes subsystem. It affects the quality and performance of volumetric shadows in scenes with heterogeneous volumes.

The value of this variable is set as a console variable with a default value of 8. It can be modified at runtime through the console or configuration files.

The associated variable CVarHeterogeneousVolumesShadowMaxSampleCount directly interacts with r.HeterogeneousVolumes.Shadows.MaxSampleCount. It is used to retrieve the current value of the setting in the C++ code.

Developers should be aware that:

  1. The value is clamped between 2 and 64 when used in the GetShadowMaxSampleCount() function.
  2. Increasing this value will likely improve shadow quality but may impact performance.
  3. This setting is render thread safe, meaning it can be changed without causing thread synchronization issues.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of the scene and target hardware capabilities.
  2. Testing different values to find the optimal balance between visual quality and performance.
  3. Considering lower values for performance-critical scenarios or lower-end hardware.

Regarding the associated variable CVarHeterogeneousVolumesShadowMaxSampleCount:

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowMaxSampleCount(
	TEXT("r.HeterogeneousVolumes.Shadows.MaxSampleCount"),
	8,
	TEXT("Maximum sample count when building volumetric shadow map (Default = 8)\n"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<float> CVarHeterogeneousVolumesShadowAbsoluteErrorThreshold(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowMaxSampleCount(
	TEXT("r.HeterogeneousVolumes.Shadows.MaxSampleCount"),
	8,
	TEXT("Maximum sample count when building volumetric shadow map (Default = 8)\n"),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     uint32 GetShadowMaxSampleCount

Source code excerpt:

	uint32 GetShadowMaxSampleCount()
	{
		return FMath::Clamp(CVarHeterogeneousVolumesShadowMaxSampleCount.GetValueOnRenderThread(), 2, 64);
	}

	float GetShadowAbsoluteErrorThreshold()
	{
		return FMath::Max(CVarHeterogeneousVolumesShadowAbsoluteErrorThreshold.GetValueOnRenderThread(), 0.0);
	}