r.VolumetricCloud.SkyAO.MaxResolution

r.VolumetricCloud.SkyAO.MaxResolution

#Overview

name: r.VolumetricCloud.SkyAO.MaxResolution

This variable is created as a Console Variable (cvar).

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.VolumetricCloud.SkyAO.MaxResolution is to set the maximum resolution for the texture that stores ambient occlusion information for environment lighting coming from the sky light in the context of volumetric cloud rendering.

This setting variable is primarily used in the Unreal Engine’s rendering system, specifically in the volumetric cloud rendering module. It’s part of the engine’s graphics and lighting subsystem.

The value of this variable is set through a console variable (CVar) in the engine’s configuration. It can be modified at runtime or set in configuration files.

This variable interacts closely with the CloudAmbientOcclusionMapResolutionScale property of the SkyLightComponent. While the CloudAmbientOcclusionMapResolutionScale property allows scaling the resolution, r.VolumetricCloud.SkyAO.MaxResolution sets an upper limit to this scaling.

Developers should be aware that this variable directly impacts the quality and performance of volumetric cloud rendering. Higher resolutions can provide more detailed ambient occlusion but at the cost of increased memory usage and potentially lower performance.

Best practices when using this variable include:

  1. Balancing quality and performance based on target hardware.
  2. Considering the scale of your scene and the importance of cloud details.
  3. Using it in conjunction with CloudAmbientOcclusionMapResolutionScale for fine-tuning.

Regarding the associated variable CVarVolumetricCloudSkyAOMaxResolution:

This is the actual console variable that controls the r.VolumetricCloud.SkyAO.MaxResolution setting. It’s initialized with a default value of 2048 and is used to enforce the maximum resolution limit in the GetVolumetricCloudSkyAOResolution function.

The purpose of CVarVolumetricCloudSkyAOMaxResolution is to provide a way to access and modify the r.VolumetricCloud.SkyAO.MaxResolution setting programmatically and through the console.

This variable is used in the rendering subsystem, specifically in the VolumetricCloudRendering module.

The value is set when the CVar is initialized, but can be changed at runtime through console commands or programmatically.

It interacts directly with the CloudAmbientOcclusionMapResolutionScale property of the SkyLightComponent, as seen in the GetVolumetricCloudSkyAOResolution function.

Developers should be aware that changes to this variable will immediately affect the maximum possible resolution of the sky ambient occlusion map for volumetric clouds.

Best practices include:

  1. Using this variable for performance optimization and quality settings.
  2. Considering its impact on memory usage and rendering performance.
  3. Testing different values to find the best balance between quality and performance for your specific use case.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarVolumetricCloudSkyAOMaxResolution(
	TEXT("r.VolumetricCloud.SkyAO.MaxResolution"), 2048,
	TEXT("The maximum resolution of the texture storing ambient occlusion information for the environment lighting coming from sky light. The active resolution is controlled by the CloudAmbientOcclusionMapResolutionScale property on the Skylight component."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarVolumetricCloudSkyAOTraceSampleCount(
	TEXT("r.VolumetricCloud.SkyAO.TraceSampleCount"), 10,
	TEXT("The number of samples taken to evaluate ground lighting occlusion."),

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Classes/Components/SkyLightComponent.h:189

Scope (from outer to inner):

file
class        class USkyLightComponent : public ULightComponentBase

Source code excerpt:

	float CloudAmbientOcclusionExtent;
	/**
	 * Scale the cloud ambient occlusion map resolution, base resolution is 512. The resolution is still clamped to 'r.VolumetricCloud.SkyAO.MaxResolution'.
	 */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = AtmosphereAndCloud, meta = (UIMin = "0.25", UIMax = "8", ClampMin = "0.25", SliderExponent = 1.0))
	float CloudAmbientOcclusionMapResolutionScale;
	/**
	 * Controls the cone aperture angle over which the sky occlusion due to volumetric clouds is evaluated. A value of 1 means `take into account the entire hemisphere` resulting in blurry occlusion, while a value of 0 means `take into account a single up occlusion direction up` resulting in sharp occlusion.
	 */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = AtmosphereAndCloud, meta = (UIMin = "0.0", UIMax = "0.1", ClampMin = "0.0", ClampMax = "1.0", SliderExponent = 2.0))
	float CloudAmbientOcclusionApertureScale;

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarVolumetricCloudSkyAOMaxResolution(
	TEXT("r.VolumetricCloud.SkyAO.MaxResolution"), 2048,
	TEXT("The maximum resolution of the texture storing ambient occlusion information for the environment lighting coming from sky light. The active resolution is controlled by the CloudAmbientOcclusionMapResolutionScale property on the Skylight component."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarVolumetricCloudSkyAOTraceSampleCount(
	TEXT("r.VolumetricCloud.SkyAO.TraceSampleCount"), 10,

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

Scope (from outer to inner):

file
function     static int32 GetVolumetricCloudSkyAOResolution

Source code excerpt:

	if (SkyLight)
	{
		return FMath::Min(int32(512.0f * float(SkyLight->CloudAmbientOcclusionMapResolutionScale)), CVarVolumetricCloudSkyAOMaxResolution.GetValueOnAnyThread());
	}
	return 32;
}

static float GetVolumetricCloudSkyAOExtentKm(const FSkyLightSceneProxy* SkyLight)
{