r.HeterogeneousVolumes.Shadows.UseAVSMCompression

r.HeterogeneousVolumes.Shadows.UseAVSMCompression

#Overview

name: r.HeterogeneousVolumes.Shadows.UseAVSMCompression

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.UseAVSMCompression is to enable or disable AVSM (Adaptive Volumetric Shadow Maps) compression for heterogeneous volumes in the rendering system.

This setting variable is primarily used by the Renderer module, specifically in the Heterogeneous Volumes subsystem. It affects the shadow rendering pipeline for volumetric effects.

The value of this variable is set through a console variable (CVar) system. It’s initialized with a default value of 1 (enabled) and can be changed at runtime.

The associated variable CVarHeterogeneousVolumesShadowUseAVSMCompression directly interacts with this setting. It’s a TAutoConsoleVariable that holds the actual value and provides thread-safe access to it.

Developers must be aware that this setting affects the quality and performance of shadow rendering for heterogeneous volumes. Enabling AVSM compression (default) can improve performance at the cost of some shadow quality.

Best practices when using this variable include:

  1. Keep it enabled (1) for better performance unless shadow quality issues are observed.
  2. Test thoroughly with both enabled and disabled states to ensure your game’s visuals are not negatively impacted.
  3. Consider exposing this setting to end-users if shadow quality vs. performance is a critical aspect of your game.

Regarding the associated variable CVarHeterogeneousVolumesShadowUseAVSMCompression:

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowUseAVSMCompression(
	TEXT("r.HeterogeneousVolumes.Shadows.UseAVSMCompression"),
	1,
	TEXT("Enables AVSM compression (Default = 1)\n"),
	ECVF_RenderThreadSafe
);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowDebugTweak(

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

);

static TAutoConsoleVariable<int32> CVarHeterogeneousVolumesShadowUseAVSMCompression(
	TEXT("r.HeterogeneousVolumes.Shadows.UseAVSMCompression"),
	1,
	TEXT("Enables AVSM compression (Default = 1)\n"),
	ECVF_RenderThreadSafe
);

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

Scope (from outer to inner):

file
namespace    HeterogeneousVolumes
function     bool UseAVSMCompression

Source code excerpt:

	bool UseAVSMCompression()
	{
		return CVarHeterogeneousVolumesShadowUseAVSMCompression.GetValueOnRenderThread() != 0;
	}

	float GetCameraDownsampleFactor()
	{
		return FMath::Max(CVarHeterogeneousVolumesShadowCameraDownsampleFactor.GetValueOnRenderThread(), 1);
	}