r.Shadow.MaxNumPointShadowCacheUpdatesPerFrame
r.Shadow.MaxNumPointShadowCacheUpdatesPerFrame
#Overview
name: r.Shadow.MaxNumPointShadowCacheUpdatesPerFrame
The value of this variable can be defined or overridden in .ini config files. 1
.ini config file referencing this setting variable.
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Maximum number of point light shadow cache updates allowed per frame.Only affect updates caused by resolution change. -1 means no limit.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Shadow.MaxNumPointShadowCacheUpdatesPerFrame is to control the maximum number of point light shadow cache updates allowed per frame in Unreal Engine’s rendering system. This setting specifically targets updates caused by resolution changes.
This setting variable is primarily used by the Unreal Engine’s rendering system, particularly in the shadow rendering subsystem. It’s referenced in the Renderer module, as evident from the file path “Engine/Source/Runtime/Renderer/Private/ShadowSetup.cpp”.
The value of this variable is set through the Unreal Engine’s console variable system. It’s declared as an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files.
The associated variable GMaxNumPointShadowCacheUpdatesPerFrame directly interacts with r.Shadow.MaxNumPointShadowCacheUpdatesPerFrame. They share the same value, with GMaxNumPointShadowCacheUpdatesPerFrame being the actual integer variable used in the code.
Developers must be aware that this variable only affects updates caused by resolution changes, not all shadow updates. A value of -1 means there’s no limit to the number of updates per frame.
Best practices when using this variable include:
- Setting it to a reasonable positive value to limit performance impact on lower-end systems.
- Using -1 for high-end systems where shadow quality is prioritized over performance.
- Adjusting it based on the specific needs of your game and target hardware.
Regarding the associated variable GMaxNumPointShadowCacheUpdatesPerFrame:
The purpose of GMaxNumPointShadowCacheUpdatesPerFrame is to store the actual value used in the code for limiting point light shadow cache updates per frame.
This variable is used directly in the rendering system’s shadow setup logic, specifically in the ComputeWholeSceneShadowCacheModes function.
Its value is set by the console variable system through r.Shadow.MaxNumPointShadowCacheUpdatesPerFrame.
It interacts with InOutNumPointShadowCachesUpdatedThisFrame in the shadow cache computation logic.
Developers should be aware that this variable is used to determine if more shadow cache updates are allowed in a given frame.
Best practices include ensuring that any modifications to r.Shadow.MaxNumPointShadowCacheUpdatesPerFrame are reflected in GMaxNumPointShadowCacheUpdatesPerFrame, and vice versa, to maintain consistency in the shadow rendering system.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/BaseDeviceProfiles.ini:901, section: [Android_Vulkan_SM5 DeviceProfile]
- INI Section:
Android_Vulkan_SM5 DeviceProfile
- 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/Renderer/Private/ShadowSetup.cpp:70
Scope: file
Source code excerpt:
int32 GMaxNumPointShadowCacheUpdatesPerFrame = -1;
FAutoConsoleVariableRef CVarMaxNumPointShadowCacheUpdatePerFrame(
TEXT("r.Shadow.MaxNumPointShadowCacheUpdatesPerFrame"),
GMaxNumPointShadowCacheUpdatesPerFrame,
TEXT("Maximum number of point light shadow cache updates allowed per frame."
"Only affect updates caused by resolution change. -1 means no limit."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Associated Variable and Callsites
This variable is associated with another variable named GMaxNumPointShadowCacheUpdatesPerFrame
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowSetup.cpp:68
Scope: file
Source code excerpt:
);
int32 GMaxNumPointShadowCacheUpdatesPerFrame = -1;
FAutoConsoleVariableRef CVarMaxNumPointShadowCacheUpdatePerFrame(
TEXT("r.Shadow.MaxNumPointShadowCacheUpdatesPerFrame"),
GMaxNumPointShadowCacheUpdatesPerFrame,
TEXT("Maximum number of point light shadow cache updates allowed per frame."
"Only affect updates caused by resolution change. -1 means no limit."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
int32 GMaxNumSpotShadowCacheUpdatesPerFrame = -1;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/ShadowSetup.cpp:3649
Scope (from outer to inner):
file
function void ComputeWholeSceneShadowCacheModes
Source code excerpt:
case LightType_Rect:
NumCachesUpdatedThisFrame = &InOutNumPointShadowCachesUpdatedThisFrame;
MaxCacheUpdatesAllowed = static_cast<uint32>(GMaxNumPointShadowCacheUpdatesPerFrame);
break;
case LightType_Spot:
NumCachesUpdatedThisFrame = &InOutNumSpotShadowCachesUpdatedThisFrame;
MaxCacheUpdatesAllowed = static_cast<uint32>(GMaxNumSpotShadowCacheUpdatesPerFrame);
break;
default: