r.VolumetricCloud.SkyAO

r.VolumetricCloud.SkyAO

#Overview

name: r.VolumetricCloud.SkyAO

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 is to enable or disable cloud sky ambient occlusion in the Unreal Engine 5 rendering system. This setting is specifically related to the volumetric cloud rendering feature and affects the lighting quality of the sky and clouds in the scene.

The Unreal Engine subsystem that relies on this setting variable is the Renderer module, specifically the volumetric cloud rendering component. This can be seen from the file path where the variable is defined: “Engine/Source/Runtime/Renderer/Private/VolumetricCloudRendering.cpp”.

The value of this variable is set using a console variable (CVarVolumetricCloudSkyAO) with a default value of 1 (enabled). It can be changed at runtime through the console or programmatically.

This variable interacts closely with the Skylight component in the scene. For the cloud sky ambient occlusion to take effect, the scene must contain a Skylight component with Cloud Ambient Occlusion enabled on it.

Developers must be aware that:

  1. This setting affects rendering performance and visual quality.
  2. It requires a Skylight component with Cloud Ambient Occlusion enabled to function.
  3. The setting is render thread safe and can be adjusted for scalability purposes.

Best practices when using this variable include:

  1. Only enable it when needed, as it may impact performance.
  2. Ensure that the scene has a properly configured Skylight component.
  3. Consider exposing this setting to end-users for performance optimization on different hardware.

Regarding the associated variable CVarVolumetricCloudSkyAO:

The purpose of CVarVolumetricCloudSkyAO is to provide programmatic access to the r.VolumetricCloud.SkyAO setting. It’s an internal representation of the console variable used within the C++ code.

This variable is used in the Renderer module to determine whether cloud sky ambient occlusion should be rendered. It’s checked in the ShouldRenderCloudSkyAO function, which is likely called during the rendering process to decide if the cloud sky AO pass should be executed.

The value of this variable is set when the console variable is initialized and can be accessed using the GetValueOnRenderThread() method.

CVarVolumetricCloudSkyAO interacts directly with the Skylight component’s bCloudAmbientOcclusion property. Both need to be enabled for the feature to take effect.

Developers should be aware that:

  1. This variable is accessed on the render thread, which is important for thread safety.
  2. It’s used in conjunction with the Skylight component’s properties to determine the final rendering behavior.

Best practices for using CVarVolumetricCloudSkyAO include:

  1. Access its value using GetValueOnRenderThread() when in render thread context.
  2. Consider caching the value if it’s accessed frequently to avoid potential performance overhead.
  3. Use it in conjunction with other checks (like the Skylight component’s properties) to ensure correct behavior.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarVolumetricCloudSkyAO(
	TEXT("r.VolumetricCloud.SkyAO"), 1,
	TEXT("Enable/disable cloud sky ambient occlusion, the scene must contain a Skylight component with Cloud Ambient Occlusion enabled on it."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarVolumetricCloudSkyAODebug(
	TEXT("r.VolumetricCloud.SkyAO.Debug"), 0,
	TEXT("Print information to debug the cloud sky AO map."),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

////////////////////////////////////////////////////////////////////////// Cloud SKY AO

static TAutoConsoleVariable<int32> CVarVolumetricCloudSkyAO(
	TEXT("r.VolumetricCloud.SkyAO"), 1,
	TEXT("Enable/disable cloud sky ambient occlusion, the scene must contain a Skylight component with Cloud Ambient Occlusion enabled on it."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarVolumetricCloudSkyAODebug(
	TEXT("r.VolumetricCloud.SkyAO.Debug"), 0,

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

Scope (from outer to inner):

file
function     static bool ShouldRenderCloudSkyAO

Source code excerpt:

static bool ShouldRenderCloudSkyAO(const FSkyLightSceneProxy* SkyLight)
{
	return CVarVolumetricCloudSkyAO.GetValueOnRenderThread() > 0 && SkyLight && SkyLight->bCloudAmbientOcclusion;
}

static float GetVolumetricCloudSkyAOStrength(const FSkyLightSceneProxy* SkyLight)
{
	if (SkyLight)
	{