r.chaos.ReflectionCaptureStaticSceneOnly
r.chaos.ReflectionCaptureStaticSceneOnly
#Overview
name: r.chaos.ReflectionCaptureStaticSceneOnly
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0 is off, 1 is on (default)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.chaos.ReflectionCaptureStaticSceneOnly is to control whether reflection captures should only include static scene elements or not. This setting is specifically related to the Chaos physics system in Unreal Engine 5.
This setting variable is primarily used in the rendering system, specifically in the reflection environment capture subsystem. It is part of the Renderer module in Unreal Engine 5.
The value of this variable is set using a console variable (CVar) named CVarReflectionCaptureStaticSceneOnly. It is initialized with a default value of 1, meaning it is enabled by default.
The associated variable CVarReflectionCaptureStaticSceneOnly interacts directly with r.chaos.ReflectionCaptureStaticSceneOnly. They share the same value and purpose.
Developers must be aware that this variable is marked as ECVF_ReadOnly, which means its value cannot be changed at runtime. It’s intended to be set before the engine starts or through configuration files.
Best practices when using this variable include:
- Consider the performance implications of including non-static elements in reflection captures.
- If static lighting is disabled in the project, this setting may need to be adjusted to capture movable lights for reflection captures to work effectively.
- Be mindful that changing this setting may affect the visual fidelity and performance of reflection captures in the game.
Regarding the associated variable CVarReflectionCaptureStaticSceneOnly:
- It is defined as a TAutoConsoleVariable
, which allows it to be accessed and potentially modified through console commands. - It is used in the FScene::CaptureOrUploadReflectionCapture function to determine whether to capture only static scene elements.
- The actual usage combines this variable with a check for whether static lighting is allowed in the project.
Developers should note that while the variable is defined as read-only, its value is retrieved using GetValueOnGameThread(), which suggests that its value could potentially change during runtime, despite being marked as read-only. This inconsistency should be carefully considered when relying on this setting in game code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ReflectionEnvironmentCapture.cpp:91
Scope: file
Source code excerpt:
// Chaos addition
static TAutoConsoleVariable<int32> CVarReflectionCaptureStaticSceneOnly(
TEXT("r.chaos.ReflectionCaptureStaticSceneOnly"),
1,
TEXT("")
TEXT(" 0 is off, 1 is on (default)"),
ECVF_ReadOnly);
/**
#Associated Variable and Callsites
This variable is associated with another variable named CVarReflectionCaptureStaticSceneOnly
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ReflectionEnvironmentCapture.cpp:90
Scope: file
Source code excerpt:
// Chaos addition
static TAutoConsoleVariable<int32> CVarReflectionCaptureStaticSceneOnly(
TEXT("r.chaos.ReflectionCaptureStaticSceneOnly"),
1,
TEXT("")
TEXT(" 0 is off, 1 is on (default)"),
ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ReflectionEnvironmentCapture.cpp:1476
Scope (from outer to inner):
file
function void FScene::CaptureOrUploadReflectionCapture
Source code excerpt:
// Reflection Captures are a form of static lighting, so only capture scene elements that are static
// However if the project has static lighting disabled, Reflection Captures can still be made to work by capturing Movable lights
bool const bCaptureStaticSceneOnly = CVarReflectionCaptureStaticSceneOnly.GetValueOnGameThread() != 0 && bAllowStaticLighting;
CaptureSceneIntoScratchCubemap(this, *ReflectionCubemapTexture, CaptureComponent->GetComponentLocation() + CaptureComponent->CaptureOffset, ReflectionCaptureSize, false, bCaptureStaticSceneOnly, 0, false, false, FLinearColor(), bCapturingForMobile, bInsideTick);
}
else if (CaptureComponent->ReflectionSourceType == EReflectionSourceType::SpecifiedCubemap)
{
UTextureCube* SourceCubemap = CaptureComponent->Cubemap;
float SourceCubemapRotation = CaptureComponent->SourceCubemapAngle * (PI / 180.f);