r.VolumetricCloud.EnableAerialPerspectiveSampling

r.VolumetricCloud.EnableAerialPerspectiveSampling

#Overview

name: r.VolumetricCloud.EnableAerialPerspectiveSampling

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.EnableAerialPerspectiveSampling is to control the aerial perspective contribution on volumetric clouds in the rendering system of Unreal Engine 5.

This setting variable is primarily used in the Renderer module, specifically in the volumetric cloud rendering subsystem. It is defined and used within the VolumetricCloudRendering.cpp file.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1, which means the aerial perspective sampling is enabled by default. Developers can change this value at runtime using console commands or through project settings.

The associated variable CVarVolumetricCloudEnableAerialPerspectiveSampling directly interacts with r.VolumetricCloud.EnableAerialPerspectiveSampling. 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 aerial perspective sampling (value > 0) will result in more realistic cloud rendering, especially for distant clouds, but may have a performance impact.

Best practices when using this variable include:

  1. Keep it enabled (value = 1) for the most realistic cloud rendering, especially in scenes with large distances.
  2. Consider disabling it (value = 0) if performance is a critical issue and the visual difference is acceptable for your specific use case.
  3. Test the visual impact and performance with both settings to make an informed decision for your project.

Regarding the associated variable CVarVolumetricCloudEnableAerialPerspectiveSampling:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarVolumetricCloudEnableAerialPerspectiveSampling(
	TEXT("r.VolumetricCloud.EnableAerialPerspectiveSampling"), 1,
	TEXT("Enable/disable the aerial perspective contribution on clouds."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarVolumetricCloudEnableDistantSkyLightSampling(
	TEXT("r.VolumetricCloud.EnableDistantSkyLightSampling"), 1,
	TEXT("Enable/disable the distant sky light contribution on clouds."),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

////////////////////////////////////////////////////////////////////////// Lighting component controls

static TAutoConsoleVariable<int32> CVarVolumetricCloudEnableAerialPerspectiveSampling(
	TEXT("r.VolumetricCloud.EnableAerialPerspectiveSampling"), 1,
	TEXT("Enable/disable the aerial perspective contribution on clouds."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarVolumetricCloudEnableDistantSkyLightSampling(
	TEXT("r.VolumetricCloud.EnableDistantSkyLightSampling"), 1,

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

Scope (from outer to inner):

file
function     bool FSceneRenderer::RenderVolumetricCloud

Source code excerpt:


				const bool bCloudDebugViewModeEnabled = ShouldViewVisualizeVolumetricCloudConservativeDensity(ViewInfo, ViewFamily.EngineShowFlags);
				const bool bEnableAerialPerspectiveSampling = CVarVolumetricCloudEnableAerialPerspectiveSampling.GetValueOnAnyThread() > 0;
				const bool bShouldUseHighQualityAerialPerspective =
					bEnableAerialPerspectiveSampling
					&& Scene->HasSkyAtmosphere()
					&& CVarVolumetricCloudHighQualityAerialPerspective.GetValueOnAnyThread() > 0
					&& !ViewInfo.bIsReflectionCapture
					&& !bCloudDebugViewModeEnabled;