r.CloudDefaultTexturesNoFastClear

r.CloudDefaultTexturesNoFastClear

#Overview

name: r.CloudDefaultTexturesNoFastClear

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.CloudDefaultTexturesNoFastClear is to control the fast clear behavior for default cloud textures in Unreal Engine’s volumetric cloud rendering system.

This setting variable is primarily used in the rendering system, specifically for volumetric cloud rendering. It is part of Unreal Engine’s renderer module, as evidenced by its location in the VolumetricCloudRendering.cpp file.

The Unreal Engine subsystem that relies on this setting variable is the Renderer, particularly the volumetric cloud rendering component. This can be seen from the file name and the context in which the variable is used.

The value of this variable is set through a console variable (CVar) system. It is initialized with a default value of 1, meaning that by default, fast clear is removed on default cloud textures.

The associated variable CVarCloudDefaultTexturesNoFastClear interacts directly with r.CloudDefaultTexturesNoFastClear. They share the same value and purpose.

Developers must be aware that this variable affects the rendering performance and visual quality of volumetric clouds. When set to 1 (default), it removes fast clear on default cloud textures, which may impact rendering speed but could potentially improve visual quality or solve certain rendering artifacts.

Best practices when using this variable include:

  1. Understanding the performance implications of enabling or disabling fast clear for cloud textures.
  2. Testing the visual impact of changing this setting in different scenarios.
  3. Considering the target hardware capabilities when deciding whether to use fast clear or not.

Regarding the associated variable CVarCloudDefaultTexturesNoFastClear:

The purpose of CVarCloudDefaultTexturesNoFastClear is identical to r.CloudDefaultTexturesNoFastClear. It’s the actual console variable implementation that controls the behavior.

This variable is used directly in the CreateDefaultTexturesIfNeeded function of the FCloudRenderContext class. It determines whether to apply the TexCreate_NoFastClear flag when creating default cloud textures.

The value of this variable is retrieved using the GetValueOnAnyThread() method, indicating that it can be accessed from multiple threads safely.

Developers should be aware that changing this variable at runtime will affect newly created cloud textures, but may not immediately impact existing ones.

Best practices for using CVarCloudDefaultTexturesNoFastClear include:

  1. Adjusting it through the console or configuration files for testing purposes.
  2. Monitoring performance and visual quality when changing this setting.
  3. Considering making it configurable in user settings if cloud rendering quality is a key aspect of your game or application.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarCloudDefaultTexturesNoFastClear(
	TEXT("r.CloudDefaultTexturesNoFastClear"),
	1,
	TEXT("Remove fast clear on default cloud textures"),
	ECVF_RenderThreadSafe);

void FCloudRenderContext::CreateDefaultTexturesIfNeeded(FRDGBuilder& GraphBuilder)
{

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

}

static TAutoConsoleVariable<int32> CVarCloudDefaultTexturesNoFastClear(
	TEXT("r.CloudDefaultTexturesNoFastClear"),
	1,
	TEXT("Remove fast clear on default cloud textures"),
	ECVF_RenderThreadSafe);

void FCloudRenderContext::CreateDefaultTexturesIfNeeded(FRDGBuilder& GraphBuilder)

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

Scope (from outer to inner):

file
function     void FCloudRenderContext::CreateDefaultTexturesIfNeeded

Source code excerpt:

	if (DefaultCloudColorCubeTexture == nullptr)
	{
		const ETextureCreateFlags NoFastClearFlags = (CVarCloudDefaultTexturesNoFastClear.GetValueOnAnyThread() != 0) ? TexCreate_NoFastClear : TexCreate_None;

		DefaultCloudColorCubeTexture = GraphBuilder.CreateTexture(
			FRDGTextureDesc::CreateCube(1, PF_FloatRGBA, FClearValueBinding::Black, TexCreate_ShaderResource | TexCreate_RenderTargetable | TexCreate_UAV | NoFastClearFlags),
			TEXT("Cloud.ColorCubeDummy"));

		DefaultCloudColor02DTexture = GraphBuilder.CreateTexture(