r.SkylightUpdateEveryFrame
r.SkylightUpdateEveryFrame
#Overview
name: r.SkylightUpdateEveryFrame
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to update all skylights every frame. Useful for debugging.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SkylightUpdateEveryFrame is to control whether all skylights in the scene are updated every frame. This setting is primarily used for debugging purposes in the rendering system, specifically for skylight components.
This setting variable is relied upon by the Engine module, particularly within the SkyLightComponent system. It’s part of Unreal Engine’s rendering subsystem, affecting how skylights are processed and updated.
The value of this variable is set through the console variable system. It’s initialized to 0 by default, meaning skylights are not updated every frame unless explicitly enabled.
The r.SkylightUpdateEveryFrame console variable directly interacts with the GUpdateSkylightsEveryFrame global variable. They share the same value, with the console variable providing an interface for runtime modification.
Developers must be aware that enabling this setting (setting it to 1) will cause all skylights to update every frame, which can have performance implications. This should primarily be used for debugging purposes and not in production builds.
Best practices when using this variable include:
- Keep it disabled (0) for normal gameplay and production builds to maintain optimal performance.
- Enable it temporarily when debugging skylight-related issues or when rapid updates to skylight are necessary for testing.
- Be mindful of the performance impact when enabled, especially in scenes with multiple skylights.
Regarding the associated variable GUpdateSkylightsEveryFrame:
The purpose of GUpdateSkylightsEveryFrame is to serve as the internal representation of the r.SkylightUpdateEveryFrame setting. It’s used directly in the engine code to determine whether skylights should be updated every frame.
This variable is used within the Engine module, specifically in the SkyLightComponent system. It’s checked in the UpdateSkyCaptureContents function to determine whether to force updates on all skylight components.
The value of GUpdateSkylightsEveryFrame is set by the r.SkylightUpdateEveryFrame console variable. They are directly linked, with changes to the console variable immediately affecting the global variable.
There are no other variables that directly interact with GUpdateSkylightsEveryFrame beyond its connection to r.SkylightUpdateEveryFrame.
Developers should be aware that this is an internal variable and should not be modified directly in code. Instead, they should use the r.SkylightUpdateEveryFrame console variable to control this behavior.
Best practices for GUpdateSkylightsEveryFrame include:
- Treat it as a read-only variable in code.
- Use the corresponding console variable (r.SkylightUpdateEveryFrame) to modify its value.
- Be aware of its state when debugging skylight-related issues, as it significantly affects skylight update behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkyLightComponent.cpp:71
Scope: file
Source code excerpt:
int32 GUpdateSkylightsEveryFrame = 0;
FAutoConsoleVariableRef CVarUpdateSkylightsEveryFrame(
TEXT("r.SkylightUpdateEveryFrame"),
GUpdateSkylightsEveryFrame,
TEXT("Whether to update all skylights every frame. Useful for debugging."),
ECVF_Default
);
float GSkylightIntensityMultiplier = 1.0f;
#Associated Variable and Callsites
This variable is associated with another variable named GUpdateSkylightsEveryFrame
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkyLightComponent.cpp:69
Scope: file
Source code excerpt:
);
int32 GUpdateSkylightsEveryFrame = 0;
FAutoConsoleVariableRef CVarUpdateSkylightsEveryFrame(
TEXT("r.SkylightUpdateEveryFrame"),
GUpdateSkylightsEveryFrame,
TEXT("Whether to update all skylights every frame. Useful for debugging."),
ECVF_Default
);
float GSkylightIntensityMultiplier = 1.0f;
FAutoConsoleVariableRef CVarSkylightIntensityMultiplier(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkyLightComponent.cpp:893
Scope (from outer to inner):
file
function void USkyLightComponent::UpdateSkyCaptureContents
Source code excerpt:
QUICK_SCOPE_CYCLE_COUNTER(STAT_SkylightCaptures);
if (GUpdateSkylightsEveryFrame)
{
for (TObjectIterator<USkyLightComponent> It; It; ++It)
{
USkyLightComponent* SkylightComponent = *It;
if (WorldToUpdate->ContainsActor(SkylightComponent->GetOwner()) && IsValid(SkylightComponent))
{