r.ReflectionCapture.EnableDeferredReflectionsAndSkyLighting
r.ReflectionCapture.EnableDeferredReflectionsAndSkyLighting
#Overview
name: r.ReflectionCapture.EnableDeferredReflectionsAndSkyLighting
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to evaluate deferred reflections and sky contribution when rendering reflection captures.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ReflectionCapture.EnableDeferredReflectionsAndSkyLighting is to control whether deferred reflections and sky contribution are evaluated when rendering reflection captures in Unreal Engine 5.
This setting variable is primarily used by the rendering system, specifically in the context of reflection captures and indirect lighting.
Based on the callsites, this variable is utilized within the Renderer module of Unreal Engine, particularly in the IndirectLightRendering.cpp file.
The value of this variable is set through a console variable (CVarReflectionCaptureEnableDeferredReflectionsAndSkyLighting) with a default value of 1, meaning it’s enabled by default. Developers can change this value at runtime using console commands or through project settings.
This variable interacts directly with the associated variable CVarReflectionCaptureEnableDeferredReflectionsAndSkyLighting, which is the actual TAutoConsoleVariable that stores and manages the setting’s value.
Developers should be aware that disabling this feature (setting it to 0) will prevent the evaluation of deferred reflections and sky contribution when rendering reflection captures. This can affect the visual quality of reflections in the scene but might improve performance.
Best practices when using this variable include:
- Only disable it if you’re experiencing performance issues related to reflection captures.
- Test thoroughly after changing this setting, as it can significantly impact the visual quality of your scenes.
- Consider exposing this setting in your game’s graphics options if reflection quality is a concern for performance on lower-end hardware.
Regarding the associated variable CVarReflectionCaptureEnableDeferredReflectionsAndSkyLighting:
This is the actual console variable that stores and manages the value of r.ReflectionCapture.EnableDeferredReflectionsAndSkyLighting. It’s defined as a TAutoConsoleVariable
The variable is used in the function IsDeferredReflectionsAndSkyLightingDisabledForReflectionCapture(), which checks if the feature is disabled by comparing the variable’s value to 0.
Developers should use this variable when they need to programmatically check or modify the setting’s value in C++ code. They can use GetValueOnRenderThread() to retrieve the current value safely in render thread operations.
When working with this variable, it’s important to respect thread safety, as indicated by the ECVF_RenderThreadSafe flag used in its declaration. Any modifications or reads should be done in the appropriate thread context to avoid race conditions or undefined behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:79
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarReflectionCaptureEnableDeferredReflectionsAndSkyLighting(
TEXT("r.ReflectionCapture.EnableDeferredReflectionsAndSkyLighting"),
1,
TEXT("Whether to evaluate deferred reflections and sky contribution when rendering reflection captures."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarProbeSamplePerPixel(
TEXT("r.Lumen.ProbeHierarchy.SamplePerPixel"), 8,
#Associated Variable and Callsites
This variable is associated with another variable named CVarReflectionCaptureEnableDeferredReflectionsAndSkyLighting
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:78
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarReflectionCaptureEnableDeferredReflectionsAndSkyLighting(
TEXT("r.ReflectionCapture.EnableDeferredReflectionsAndSkyLighting"),
1,
TEXT("Whether to evaluate deferred reflections and sky contribution when rendering reflection captures."),
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarProbeSamplePerPixel(
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/IndirectLightRendering.cpp:110
Scope (from outer to inner):
file
function bool IsDeferredReflectionsAndSkyLightingDisabledForReflectionCapture
Source code excerpt:
bool IsDeferredReflectionsAndSkyLightingDisabledForReflectionCapture()
{
return CVarReflectionCaptureEnableDeferredReflectionsAndSkyLighting.GetValueOnRenderThread() == 0;
}
class FDiffuseIndirectCompositePS : public FGlobalShader
{
DECLARE_GLOBAL_SHADER(FDiffuseIndirectCompositePS)
SHADER_USE_PARAMETER_STRUCT(FDiffuseIndirectCompositePS, FGlobalShader)