r.SceneCulling.ExplicitCellBounds
r.SceneCulling.ExplicitCellBounds
#Overview
name: r.SceneCulling.ExplicitCellBounds
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:
Enable to to construct explicit cell bounds by processing the instance bounds as the scene is updated. Adds some GPU cost to the update but this is typically more than paid for by improved culling.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.SceneCulling.ExplicitCellBounds is to enable or disable the construction of explicit cell bounds for scene culling in Unreal Engine’s rendering system. This setting is part of the scene culling optimization process, which aims to improve rendering performance by determining which objects should be rendered based on their visibility.
This setting variable is primarily used by the Renderer module, specifically within the scene culling subsystem. It’s referenced in the SceneCulling.cpp file, which is part of the core rendering pipeline.
The value of this variable is set through a console variable (CVar) system, allowing it to be adjusted at runtime. It’s initialized with a default value of 1, meaning it’s enabled by default.
The associated variable CVarSceneCullingUseExplicitCellBounds directly interacts with r.SceneCulling.ExplicitCellBounds. They share the same value and purpose.
Developers should be aware that enabling this feature (which is the default) can add some GPU cost during scene updates. However, this additional cost is typically outweighed by the improved culling efficiency it provides.
Best practices when using this variable include:
- Keep it enabled (default value of 1) unless you have specific performance issues related to scene updates.
- If you’re experiencing unexpectedly high GPU usage during scene updates, you might consider disabling this feature to see if it improves performance.
- Always profile your game’s performance with and without this feature enabled to ensure it’s providing a net benefit in your specific use case.
Regarding the associated variable CVarSceneCullingUseExplicitCellBounds:
This is the actual console variable that controls the r.SceneCulling.ExplicitCellBounds setting. It’s used within the FSceneCulling::BeginUpdate function to determine whether explicit bounds should be used for scene culling.
The purpose and usage considerations for CVarSceneCullingUseExplicitCellBounds are identical to those of r.SceneCulling.ExplicitCellBounds. It’s a render thread-safe variable, meaning it can be safely accessed and modified from the render thread without causing threading issues.
Developers should use this variable when they need to programmatically control the explicit cell bounds feature in their C++ code. For example, they might adjust this setting based on specific game states or performance metrics.
Best practices for using CVarSceneCullingUseExplicitCellBounds include:
- Access its value using GetValueOnRenderThread() when in render thread code.
- Consider exposing this setting in your game’s graphics options if you want to give users control over this performance/quality trade-off.
- Be cautious when frequently toggling this setting, as it affects the scene update process and could lead to noticeable performance fluctuations if changed too often.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/Mac/BaseMacEngine.ini:40, section: [ConsoleVariables]
- INI Section:
ConsoleVariables
- 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/SceneCulling/SceneCulling.cpp:169
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarSceneCullingUseExplicitCellBounds(
TEXT("r.SceneCulling.ExplicitCellBounds"),
1,
TEXT("Enable to to construct explicit cell bounds by processing the instance bounds as the scene is updated. Adds some GPU cost to the update but this is typically more than paid for by improved culling."),
ECVF_RenderThreadSafe);
#if !UE_BUILD_SHIPPING
#Associated Variable and Callsites
This variable is associated with another variable named CVarSceneCullingUseExplicitCellBounds
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneCulling/SceneCulling.cpp:168
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe);
static TAutoConsoleVariable<int32> CVarSceneCullingUseExplicitCellBounds(
TEXT("r.SceneCulling.ExplicitCellBounds"),
1,
TEXT("Enable to to construct explicit cell bounds by processing the instance bounds as the scene is updated. Adds some GPU cost to the update but this is typically more than paid for by improved culling."),
ECVF_RenderThreadSafe);
#if !UE_BUILD_SHIPPING
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneCulling/SceneCulling.cpp:2669
Scope (from outer to inner):
file
function FSceneCulling::FUpdater &FSceneCulling::BeginUpdate
Source code excerpt:
bIsEnabled = UseSceneCulling(Scene.GetShaderPlatform());
bUseExplictBounds = CVarSceneCullingUseExplicitCellBounds.GetValueOnRenderThread() != 0;
SmallFootprintCellSideThreshold = CVarSmallFootprintSideThreshold.GetValueOnRenderThread();
bUseAsyncUpdate = CVarSceneCullingAsyncUpdate.GetValueOnRenderThread() != 0;
bUseAsyncQuery = CVarSceneCullingAsyncQuery.GetValueOnRenderThread() != 0;
if (bIsEnabled)