r.SkyLight.RealTimeReflectionCapture.ShadowFromOpaque

r.SkyLight.RealTimeReflectionCapture.ShadowFromOpaque

#Overview

name: r.SkyLight.RealTimeReflectionCapture.ShadowFromOpaque

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.SkyLight.RealTimeReflectionCapture.ShadowFromOpaque is to control whether opaque meshes cast shadows from directional lights onto the sky and clouds in real-time reflection captures.

This setting variable is primarily used in the rendering system of Unreal Engine 5, specifically in the reflection environment and real-time capture subsystem.

The value of this variable is set through a console variable (CVarRealTimeReflectionCaptureShadowFromOpaque) in the Renderer module. It is initialized with a default value of 0, meaning the feature is disabled by default.

The associated variable CVarRealTimeReflectionCaptureShadowFromOpaque directly interacts with r.SkyLight.RealTimeReflectionCapture.ShadowFromOpaque. They share the same value and purpose.

Developers must be aware that enabling this feature (by setting the value to 1 or higher) may have performance implications, as it requires additional rendering passes to calculate shadows from opaque objects onto the sky and clouds.

Best practices when using this variable include:

  1. Only enable it when necessary for visual quality, as it can impact performance.
  2. Test thoroughly in various lighting conditions to ensure the desired visual effect is achieved.
  3. Consider the performance cost in relation to the visual benefit, especially for performance-critical applications or lower-end hardware targets.

Regarding the associated variable CVarRealTimeReflectionCaptureShadowFromOpaque:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ReflectionEnvironmentRealTimeCapture.cpp:41

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRealTimeReflectionCaptureShadowFromOpaque(
	TEXT("r.SkyLight.RealTimeReflectionCapture.ShadowFromOpaque"), 0,
	TEXT("Opaque meshes cast shadow from directional lights onto sky and clouds when enabled.\n"),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarRealTimeReflectionCaptureDepthBuffer(
	TEXT("r.SkyLight.RealTimeReflectionCapture.DepthBuffer"), 1,
	TEXT("When enabled, the real-time sky light capture will have a depth buffer, this is for multiple meshes to be cover each other correctly. The height fog will also be applied according to the depth buffer."),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ReflectionEnvironmentRealTimeCapture.cpp:40

Scope: file

Source code excerpt:

	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarRealTimeReflectionCaptureShadowFromOpaque(
	TEXT("r.SkyLight.RealTimeReflectionCapture.ShadowFromOpaque"), 0,
	TEXT("Opaque meshes cast shadow from directional lights onto sky and clouds when enabled.\n"),
	ECVF_RenderThreadSafe);

static TAutoConsoleVariable<int32> CVarRealTimeReflectionCaptureDepthBuffer(
	TEXT("r.SkyLight.RealTimeReflectionCapture.DepthBuffer"), 1,

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ReflectionEnvironmentRealTimeCapture.cpp:402

Scope (from outer to inner):

file
lambda-function

Source code excerpt:

			FRDGTextureRef BlackDummy2dTex = GraphBuilder.RegisterExternalTexture(GSystemTextures.BlackDummy);
			FRDGTextureRef BlackDummy3dTex = GraphBuilder.RegisterExternalTexture(GSystemTextures.VolumetricBlackDummy);
			const bool CaptureShadowFromOpaque = CVarRealTimeReflectionCaptureShadowFromOpaque.GetValueOnRenderThread() > 0;

			FSkyAtmosphereRenderContext SkyRC;
			const FAtmosphereSetup* AtmosphereSetup = nullptr;
			if (bShouldRenderSkyAtmosphere)
			{
				FSkyAtmosphereRenderSceneInfo& SkyInfo = *GetSkyAtmosphereSceneInfo();