r.VolumetricCloud.SkyAO.Filtering

r.VolumetricCloud.SkyAO.Filtering

#Overview

name: r.VolumetricCloud.SkyAO.Filtering

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.VolumetricCloud.SkyAO.Filtering is to enable or disable the sky Ambient Occlusion (AO) dilation/smoothing filter in the volumetric cloud rendering system.

This setting variable is primarily used in the rendering system, specifically for volumetric cloud rendering. It is part of Unreal Engine’s renderer module, as evidenced by its location in the VolumetricCloudRendering.cpp file.

The Unreal Engine subsystem that relies on this setting variable is the volumetric cloud rendering system, which is a part of the broader rendering pipeline.

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

This variable interacts with the associated variable CVarVolumetricCloudSkyAOFiltering, which is the actual console variable object. They share the same value and purpose.

Developers must be aware that this variable affects the visual quality and performance of volumetric cloud rendering. Enabling the filter (value > 0) will apply a dilation/smoothing effect to the sky AO, potentially improving visual quality at the cost of some performance.

Best practices when using this variable include:

  1. Consider performance implications when enabling the filter.
  2. Test the visual difference between enabled and disabled states to determine if the quality improvement justifies the performance cost for your specific use case.
  3. Use this in conjunction with other volumetric cloud settings for optimal results.

Regarding the associated variable CVarVolumetricCloudSkyAOFiltering:

The purpose of CVarVolumetricCloudSkyAOFiltering is to provide a programmable interface for the r.VolumetricCloud.SkyAO.Filtering setting.

It is used in the same volumetric cloud rendering system within the renderer module.

The value of this variable is set when the console variable is created, but can be changed at runtime using console commands or through code.

This variable directly controls whether the sky AO filtering is applied in the volumetric cloud rendering process, as seen in the InitVolumetricCloudsForViews function.

Developers should be aware that this variable is marked as render thread safe and scalability-related, meaning it can be safely changed on the render thread and may affect performance scaling.

Best practices for using CVarVolumetricCloudSkyAOFiltering include:

  1. Use GetValueOnAnyThread() when accessing its value, as shown in the code example.
  2. Consider exposing this setting in user-facing graphics options if fine-tuning of volumetric cloud quality is desired.
  3. Profile the performance impact of enabling/disabling this feature in various scenarios to make informed decisions about its usage.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:126

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarVolumetricCloudSkyAOFiltering(
	TEXT("r.VolumetricCloud.SkyAO.Filtering"), 1,
	TEXT("Enable/disable the sky AO dilation/smoothing filter."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

////////////////////////////////////////////////////////////////////////// Cloud shadow map

static TAutoConsoleVariable<int32> CVarVolumetricCloudShadowMap(

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:125

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarVolumetricCloudSkyAOFiltering(
	TEXT("r.VolumetricCloud.SkyAO.Filtering"), 1,
	TEXT("Enable/disable the sky AO dilation/smoothing filter."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

////////////////////////////////////////////////////////////////////////// Cloud shadow map

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp:1885

Scope (from outer to inner):

file
function     void FSceneRenderer::InitVolumetricCloudsForViews

Source code excerpt:

						TraceCloudTexture(CloudSkyAOTexture, true, TraceVolumetricCloudSkyAOParamsUB);

						if (CVarVolumetricCloudSkyAOFiltering.GetValueOnAnyThread() > 0)
						{
							const float CloudAOTextureTexelWorldSize = GetVolumetricCloudSkyAOExtentKm(SkyLight) * KilometersToCentimeters * VolumetricCloudParamsAO.VolumetricCloud.CloudSkyAOSizeInvSize.Z;
							const FVector4f CloudAOTextureTexelWorldSizeInvSize = FVector4f(CloudAOTextureTexelWorldSize, CloudAOTextureTexelWorldSize, 1.0f / CloudAOTextureTexelWorldSize, 1.0f / CloudAOTextureTexelWorldSize);

							FilterTracedCloudTexture(&CloudSkyAOTexture, VolumetricCloudParamsAO.VolumetricCloud.CloudSkyAOSizeInvSize, CloudAOTextureTexelWorldSizeInvSize, true);
						}