r.VolumetricCloud.SkyAO.TraceSampleCount

r.VolumetricCloud.SkyAO.TraceSampleCount

#Overview

name: r.VolumetricCloud.SkyAO.TraceSampleCount

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.TraceSampleCount is to control the number of samples taken to evaluate ground lighting occlusion in the volumetric cloud rendering system of Unreal Engine 5.

This setting variable is primarily used by the rendering system, specifically the volumetric cloud rendering subsystem. Based on the details in the Callsites section, it is part of the Renderer module of Unreal Engine.

The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It is initialized with a default value of 10 and can be modified during runtime or through configuration files.

The associated variable CVarVolumetricCloudSkyAOTraceSampleCount directly interacts with r.VolumetricCloud.SkyAO.TraceSampleCount. They share the same value and purpose.

Developers should be aware that this variable affects the quality and performance of volumetric cloud rendering, particularly in how ground lighting occlusion is calculated. A higher value will result in more accurate occlusion but may impact performance.

Best practices when using this variable include:

  1. Adjusting it based on the specific needs of the scene and target hardware capabilities.
  2. Testing different values to find the optimal balance between visual quality and performance.
  3. Considering dynamic adjustment based on the camera’s distance from the clouds or other relevant factors.

Regarding the associated variable CVarVolumetricCloudSkyAOTraceSampleCount:

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


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

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

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

	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."),
	ECVF_RenderThreadSafe | ECVF_Scalability);

static TAutoConsoleVariable<int32> CVarVolumetricCloudSkyAOFiltering(
	TEXT("r.VolumetricCloud.SkyAO.Filtering"), 1,

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

Scope (from outer to inner):

file
function     void FSceneRenderer::InitVolumetricCloudsForViews

Source code excerpt:


				// More samples when the sun is at the horizon: a lot more distance to travel and less pixel covered so trying to keep the same cost and quality.
				CloudGlobalShaderParams.CloudSkyAOSampleCount = CVarVolumetricCloudSkyAOTraceSampleCount.GetValueOnAnyThread();
			}

			FVolumetricCloudCommonGlobalShaderParameters CloudGlobalShaderParamsUB;
			CloudGlobalShaderParamsUB.VolumetricCloudCommonParams = CloudGlobalShaderParams;
			CloudInfo.GetVolumetricCloudCommonShaderParametersUB() = TUniformBufferRef<FVolumetricCloudCommonGlobalShaderParameters>::CreateUniformBufferImmediate(CloudGlobalShaderParamsUB, UniformBuffer_SingleFrame);
		}