r.ReflectionCaptureUpdateEveryFrame
r.ReflectionCaptureUpdateEveryFrame
#Overview
name: r.ReflectionCaptureUpdateEveryFrame
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
When set, reflection captures will constantly be scheduled for update.\n
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ReflectionCaptureUpdateEveryFrame is to control whether reflection captures in Unreal Engine 5 should be constantly scheduled for updates every frame.
This setting variable is primarily used by the rendering system, specifically for managing reflection captures. It is part of the Engine module and is utilized by the ReflectionCaptureComponent.
The value of this variable is set through the console variable system in Unreal Engine. It is defined as a TAutoConsoleVariable with an initial value of 0, meaning it’s disabled by default.
The associated variable CVarReflectionCaptureUpdateEveryFrame directly interacts with r.ReflectionCaptureUpdateEveryFrame. They share the same value and purpose.
Developers must be aware that enabling this variable (setting it to a non-zero value) will cause reflection captures to be updated every frame, which can have significant performance implications. This should only be used for debugging or in specific scenarios where constant updates are necessary.
Best practices when using this variable include:
- Keep it disabled (set to 0) for normal gameplay and production builds.
- Use it sparingly and only when necessary for debugging reflection capture issues.
- Be mindful of the performance impact when enabled.
- Consider using it in conjunction with other reflection capture debugging tools.
Regarding the associated variable CVarReflectionCaptureUpdateEveryFrame:
The purpose of CVarReflectionCaptureUpdateEveryFrame is the same as r.ReflectionCaptureUpdateEveryFrame - to control whether reflection captures should be updated every frame.
This variable is used within the Engine module, specifically in the ReflectionCaptureComponent implementation. It’s used to determine if all reflection captures in the world should be updated every frame, regardless of their individual update settings.
The value of CVarReflectionCaptureUpdateEveryFrame is set when the console variable r.ReflectionCaptureUpdateEveryFrame is modified.
This variable interacts directly with the game world and all reflection capture components within it. When enabled, it forces an update on all reflection captures in the world every frame.
Developers should be aware that accessing this variable should be done through the GetValueOnGameThread() method to ensure thread-safe access.
Best practices for using CVarReflectionCaptureUpdateEveryFrame include:
- Use it for debugging purposes only.
- Be cautious of the performance impact when enabled.
- Remember to disable it after debugging to prevent unnecessary performance overhead.
- Consider using it in conjunction with profiling tools to understand its impact on frame times.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/ReflectionCaptureComponent.cpp:55
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarReflectionCaptureUpdateEveryFrame(
TEXT("r.ReflectionCaptureUpdateEveryFrame"),
0,
TEXT("When set, reflection captures will constantly be scheduled for update.\n")
);
static int32 SanitizeReflectionCaptureSize(int32 ReflectionCaptureSize)
{
#Associated Variable and Callsites
This variable is associated with another variable named CVarReflectionCaptureUpdateEveryFrame
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/ReflectionCaptureComponent.cpp:54
Scope: file
Source code excerpt:
);
TAutoConsoleVariable<int32> CVarReflectionCaptureUpdateEveryFrame(
TEXT("r.ReflectionCaptureUpdateEveryFrame"),
0,
TEXT("When set, reflection captures will constantly be scheduled for update.\n")
);
static int32 SanitizeReflectionCaptureSize(int32 ReflectionCaptureSize)
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/ReflectionCaptureComponent.cpp:1084
Scope (from outer to inner):
file
function void UReflectionCaptureComponent::UpdateReflectionCaptureContents
Source code excerpt:
const bool bHasCapturesToUpdate = ReflectionCapturesToUpdate.Num() > 0;
const bool bHasCapturesToLoad = ReflectionCapturesToUpdateForLoad.Num() > 0;
const bool bAlwaysUpdatesCaptures = CVarReflectionCaptureUpdateEveryFrame.GetValueOnGameThread() != 0;
const bool bNeedsAnyUpdate = bHasCapturesToUpdate || bHasCapturesToLoad || bAlwaysUpdatesCaptures;
if (!bNeedsAnyUpdate)
{
return;
}
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/ReflectionCaptureComponent.cpp:1095
Scope (from outer to inner):
file
function void UReflectionCaptureComponent::UpdateReflectionCaptureContents
Source code excerpt:
WorldToUpdate->SendAllEndOfFrameUpdates();
if (CVarReflectionCaptureUpdateEveryFrame.GetValueOnGameThread())
{
for (FActorIterator It(WorldToUpdate); It; ++It)
{
TInlineComponentArray<UReflectionCaptureComponent*> Components;
(*It)->GetComponents(Components);
for (int32 ComponentIndex = 0; ComponentIndex < Components.Num(); ComponentIndex++)