r.VolumetricCloud.EnableAtmosphericLightsSampling

r.VolumetricCloud.EnableAtmosphericLightsSampling

#Overview

name: r.VolumetricCloud.EnableAtmosphericLightsSampling

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.EnableAtmosphericLightsSampling is to control the contribution of atmospheric lights 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 part of the advanced rendering features that handle the realistic rendering of clouds in the game environment.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1, meaning it is enabled by default. Developers can change this value at runtime using console commands or through code.

The associated variable CVarVolumetricCloudEnableAtmosphericLightsSampling interacts directly with r.VolumetricCloud.EnableAtmosphericLightsSampling. They share the same value and purpose.

Developers must be aware that this variable affects the visual quality and performance of cloud rendering. Enabling atmospheric lights sampling on clouds can significantly enhance the realism of the scene but may also impact performance, especially on lower-end hardware.

Best practices when using this variable include:

  1. Testing the visual impact and performance with this feature enabled and disabled.
  2. Considering disabling it for performance-critical scenarios or on lower-end platforms.
  3. Using it in conjunction with other volumetric cloud settings for optimal results.

Regarding the associated variable CVarVolumetricCloudEnableAtmosphericLightsSampling:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarVolumetricCloudEnableAtmosphericLightsSampling(
	TEXT("r.VolumetricCloud.EnableAtmosphericLightsSampling"), 1,
	TEXT("Enable/disable atmospheric lights contribution on clouds."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarVolumetricCloudEnableLocalLightsSampling(
	TEXT("r.VolumetricCloud.EnableLocalLightsSampling"), 0,
	TEXT("[EXPERIMENTAL] Enable/disable local lights contribution on clouds. Expenssive! Use for cinematics if needed."),

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarVolumetricCloudEnableAtmosphericLightsSampling(
	TEXT("r.VolumetricCloud.EnableAtmosphericLightsSampling"), 1,
	TEXT("Enable/disable atmospheric lights contribution on clouds."),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarVolumetricCloudEnableLocalLightsSampling(
	TEXT("r.VolumetricCloud.EnableLocalLightsSampling"), 0,

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

Scope (from outer to inner):

file
function     static TRDGUniformBufferRef<FRenderVolumetricCloudGlobalParameters> CreateCloudPassUniformBuffer

Source code excerpt:

	VolumetricCloudParams.EnableHeightFog = VolumetricCloudParams.EnableHeightFog && !CloudRC.bSkipHeightFog ? 1 : 0;
	VolumetricCloudParams.EnableDistantSkyLightSampling = CVarVolumetricCloudEnableDistantSkyLightSampling.GetValueOnAnyThread() > 0 ? 1 : 0;
	VolumetricCloudParams.EnableAtmosphericLightsSampling = CVarVolumetricCloudEnableAtmosphericLightsSampling.GetValueOnAnyThread() > 0 ? 1 : 0;

	VolumetricCloudParams.AerialPerspectiveRayOnlyStartDistanceKm = CloudInfo.GetVolumetricCloudSceneProxy().AerialPespectiveRayleighScatteringStartDistance;
	VolumetricCloudParams.AerialPerspectiveRayOnlyFadeDistanceKmInv = 1.0f / FMath::Max(CloudInfo.GetVolumetricCloudSceneProxy().AerialPespectiveRayleighScatteringFadeDistance, 0.00001f);// One centimeter minimum
	VolumetricCloudParams.AerialPerspectiveMieOnlyStartDistanceKm = CloudInfo.GetVolumetricCloudSceneProxy().AerialPespectiveMieScatteringStartDistance;
	VolumetricCloudParams.AerialPerspectiveMieOnlyFadeDistanceKmInv = 1.0f / FMath::Max(CloudInfo.GetVolumetricCloudSceneProxy().AerialPespectiveMieScatteringFadeDistance, 0.00001f);// One centimeter minimum