r.SkyLight.RealTimeReflectionCapture
r.SkyLight.RealTimeReflectionCapture
#Overview
name: r.SkyLight.RealTimeReflectionCapture
The value of this variable can be defined or overridden in .ini config files. 5
.ini config files referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Make sure the sky light real time capture is not run on platform where it is considered out of budget. Cannot be changed at runtime.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SkyLight.RealTimeReflectionCapture is to control whether real-time reflection capture for sky lights is enabled or disabled in Unreal Engine 5. This setting is part of the rendering system, specifically related to dynamic lighting and reflection.
This setting variable is primarily used by the Engine module, particularly within the SkyLightComponent. It’s part of the rendering subsystem that handles environmental lighting and reflections.
The value of this variable is set through the console variable system. It’s initialized with a default value of 1 (enabled) but can be changed via console commands or through the project’s scalability settings.
GSkylightRealTimeReflectionCapture is the associated variable that directly interacts with r.SkyLight.RealTimeReflectionCapture. They share the same value, and GSkylightRealTimeReflectionCapture is used in the actual code logic.
Developers should be aware of several important aspects when using this variable:
- It cannot be changed at runtime, as indicated by the comment in the code.
- It’s marked with ECVF_Scalability, meaning it’s intended to be adjusted based on performance requirements of different platforms or hardware configurations.
- Changing this value triggers a callback (OnChangeSkylightRealTimeReflectionCapture) that updates all existing SkyLightComponents in the scene.
Best practices for using this variable include:
- Consider performance implications when enabling real-time reflection capture, especially on lower-end platforms.
- Use it in conjunction with the scalability settings system to provide appropriate quality levels for different hardware capabilities.
- Be aware that disabling this feature may require scheduling a recapture of static skylight reflections to maintain visual quality.
Regarding the associated variable GSkylightRealTimeReflectionCapture:
The purpose of GSkylightRealTimeReflectionCapture is to serve as the actual int32 variable that stores the state of real-time reflection capture for skylights.
It’s used directly in the Engine module, specifically within the SkyLightComponent class to determine if real-time capture is enabled.
The value is set through the console variable system, mirroring r.SkyLight.RealTimeReflectionCapture.
It interacts directly with the SkyLightComponent logic, particularly in the IsRealTimeCaptureEnabled function.
Developers should be aware that this variable is used as a boolean check (> 0) in the code, so any non-zero value will enable the feature.
Best practices include using this variable for conditional logic related to real-time skylight captures, and ensuring it’s properly synchronized with the console variable if modified programmatically.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseScalability.ini:261, section: [GlobalIlluminationQuality@0]
- INI Section:
GlobalIlluminationQuality@0
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:268, section: [GlobalIlluminationQuality@1]
- INI Section:
GlobalIlluminationQuality@1
- Raw value:
0
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:291, section: [GlobalIlluminationQuality@2]
- INI Section:
GlobalIlluminationQuality@2
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:315, section: [GlobalIlluminationQuality@3]
- INI Section:
GlobalIlluminationQuality@3
- Raw value:
1
- Is Array:
False
Location: <Workspace>/Engine/Config/BaseScalability.ini:339, section: [GlobalIlluminationQuality@Cine]
- INI Section:
GlobalIlluminationQuality@Cine
- Raw value:
1
- Is Array:
False
#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:101
Scope: file
Source code excerpt:
int32 GSkylightRealTimeReflectionCapture = 1;
FAutoConsoleVariableRef CVarSkylightRealTimeReflectionCapture(
TEXT("r.SkyLight.RealTimeReflectionCapture"),
GSkylightRealTimeReflectionCapture,
TEXT("Make sure the sky light real time capture is not run on platform where it is considered out of budget. Cannot be changed at runtime."),
FConsoleVariableDelegate::CreateStatic(&OnChangeSkylightRealTimeReflectionCapture),
ECVF_Scalability
);
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkyLightComponent.cpp:87
Scope (from outer to inner):
file
function void OnChangeSkylightRealTimeReflectionCapture
Source code excerpt:
void OnChangeSkylightRealTimeReflectionCapture(IConsoleVariable* Var)
{
// r.SkyLight.RealTimeReflectionCapture is set based on the "Effect" quality level (to be supported, or not, on some different platofrms).
// When that quality level changes, real-time sky capture can become disabled. In this case, sky light recapture should be scheduled to match the current quality level.
for (TObjectIterator<USkyLightComponent> It; It; ++It)
{
USkyLightComponent* SkylightComponent = *It;
if (IsValid(SkylightComponent))
{
#Associated Variable and Callsites
This variable is associated with another variable named GSkylightRealTimeReflectionCapture
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkyLightComponent.cpp:99
Scope: file
Source code excerpt:
}
int32 GSkylightRealTimeReflectionCapture = 1;
FAutoConsoleVariableRef CVarSkylightRealTimeReflectionCapture(
TEXT("r.SkyLight.RealTimeReflectionCapture"),
GSkylightRealTimeReflectionCapture,
TEXT("Make sure the sky light real time capture is not run on platform where it is considered out of budget. Cannot be changed at runtime."),
FConsoleVariableDelegate::CreateStatic(&OnChangeSkylightRealTimeReflectionCapture),
ECVF_Scalability
);
int32 GSkylightCubemapMaxResolution = -1;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkyLightComponent.cpp:1122
Scope (from outer to inner):
file
function bool USkyLightComponent::IsRealTimeCaptureEnabled
Source code excerpt:
// Don't call in PostLoad and SetCaptureIsDirty, because the LocalScene could be null and sky wouldn't be updated on mobile.
const bool bIsMobile = LocalScene && LocalScene->GetFeatureLevel() <= ERHIFeatureLevel::ES3_1;
return bRealTimeCapture && (Mobility == EComponentMobility::Movable || Mobility == EComponentMobility::Stationary) && GSkylightRealTimeReflectionCapture >0 && !bIsMobile;
}
void USkyLightComponent::SetRealTimeCaptureEnabled(bool bNewRealTimeCaptureEnabled)
{
bRealTimeCapture = bNewRealTimeCaptureEnabled;
MarkRenderStateDirty();