r.SupportCloudShadowOnForwardLitTranslucent

r.SupportCloudShadowOnForwardLitTranslucent

#Overview

name: r.SupportCloudShadowOnForwardLitTranslucent

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.SupportCloudShadowOnForwardLitTranslucent is to enable cloud shadow effects on forward-lit translucent objects in the rendering system. This setting allows cloud shadows to affect translucent surfaces that are not relying on the translucent lighting volume.

This setting variable is primarily used by the rendering subsystem in Unreal Engine 5. It affects the way cloud shadows are applied to forward-lit translucent objects, which is particularly relevant for the forward shading path.

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

This variable interacts with other rendering-related variables, particularly those involving forward shading, translucency, and cloud rendering. It’s closely related to other cloud shadow and translucency settings.

Developers should be aware that enabling this feature may have performance implications, especially on lower-end hardware. It adds additional complexity to the rendering of translucent objects, which can be computationally expensive.

Best practices when using this variable include:

  1. Only enable it when cloud shadows on translucent objects are necessary for visual quality.
  2. Consider the performance impact on your target platforms.
  3. Test thoroughly on a variety of hardware to ensure acceptable performance.
  4. Use in conjunction with other cloud and translucency settings for optimal visual results.

This setting is particularly useful for improving the visual quality of scenes with significant translucent elements that interact with dynamic cloud shadows, such as water bodies or certain atmospheric effects.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

// The project setting for the cloud shadow to affect all translucenct surface not relying on the translucent lighting volume (enable/disable runtime and shader code).  This is not implemented on mobile as VolumetricClouds are not available on these platforms.
static TAutoConsoleVariable<int32> CVarSupportCloudShadowOnForwardLitTranslucent(
	TEXT("r.SupportCloudShadowOnForwardLitTranslucent"),
	0,
	TEXT("Enables cloud shadow to affect all translucenct surface not relying on the translucent lighting volume."),
	ECVF_ReadOnly | ECVF_RenderThreadSafe);

////////////////////////////////////////////////////////////////////////// Cloud SKY AO

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderCompiler.cpp:8462

Scope (from outer to inner):

file
function     void GlobalBeginCompileShader

Source code excerpt:


	{
		static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SupportCloudShadowOnForwardLitTranslucent"));
		const bool bSupportCloudShadowOnForwardLitTranslucent = CVar && CVar->GetInt() > 0;
		SET_SHADER_DEFINE(Input.Environment, SUPPORT_CLOUD_SHADOW_ON_FORWARD_LIT_TRANSLUCENT, bSupportCloudShadowOnForwardLitTranslucent ? 1 : 0);
	}

	{
		static IConsoleVariable *CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Water.SingleLayerWater.SupportCloudShadow"));

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShaderCompiler/ShaderGenerationUtil.cpp:407

Scope (from outer to inner):

file
function     static FShaderGlobalDefines FetchShaderGlobalDefines

Source code excerpt:


	{
		static IConsoleVariable* CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.SupportCloudShadowOnForwardLitTranslucent"));
		const bool bSupportCloudShadowOnForwardLitTranslucent = CVar && CVar->GetInt() > 0;
		Ret.SUPPORT_CLOUD_SHADOW_ON_FORWARD_LIT_TRANSLUCENT = bSupportCloudShadowOnForwardLitTranslucent ? 1 : 0;
	}

	{
		static IConsoleVariable *CVar = IConsoleManager::Get().FindConsoleVariable(TEXT("r.Water.SingleLayerWater.SupportCloudShadow"));

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/Shader.cpp:2004

Scope (from outer to inner):

file
function     void ShaderMapAppendKeyString

Source code excerpt:


	{
		static const auto CVar = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.SupportCloudShadowOnForwardLitTranslucent"));
		if (CVar && CVar->GetValueOnAnyThread() > 0)
		{
			KeyString += TEXT("_CLDTRANS");
		}
	}