ShowFlag.PrecomputedVisibility
ShowFlag.PrecomputedVisibility
#Overview
name: ShowFlag.PrecomputedVisibility
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Allows to override a specific showflag (works in editor and game, \
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.PrecomputedVisibility is to control the visibility of precomputed visibility data in the rendering system of Unreal Engine 5. This setting variable is primarily used for optimizing rendering performance by allowing or disabling the use of precomputed visibility information.
The Unreal Engine subsystem that relies on this setting variable is the rendering system, specifically the scene occlusion and visibility components. This can be seen in the SceneOcclusion.cpp
file where the variable is used.
The value of this variable is set using the SHOWFLAG_FIXED_IN_SHIPPING
macro in the ShowFlagsValues.inl
file. It is set to 1 by default, which means precomputed visibility is enabled in shipping builds.
There are other variables that interact with ShowFlag.PrecomputedVisibility:
GAllowPrecomputedVisibility
: A global variable that must also be true for precomputed visibility to be used.PrecomputedVisibilityCells
: Another show flag used for visualizing precomputed visibility cells.
Developers must be aware that:
- This flag affects rendering performance and visual quality.
- It’s enabled by default in shipping builds but can be toggled in development.
- It works in conjunction with the
GAllowPrecomputedVisibility
global variable.
Best practices when using this variable include:
- Keep it enabled for shipping builds to maintain optimal performance.
- Use it in conjunction with the visualization tools (like
PrecomputedVisibilityCells
) during development to understand its impact. - Consider disabling it temporarily if debugging rendering issues to isolate the impact of precomputed visibility.
Regarding the associated variable PrecomputedVisibility
:
The purpose of PrecomputedVisibility is identical to ShowFlag.PrecomputedVisibility. It’s used interchangeably in the code to refer to the same setting.
This variable is also set in the ShowFlagsValues.inl
file using the same SHOWFLAG_FIXED_IN_SHIPPING
macro.
The same considerations and best practices apply to PrecomputedVisibility as they do to ShowFlag.PrecomputedVisibility. Developers should treat these as the same setting, used in different contexts within the engine code.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:319
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeLightCulling, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeLightCullingSF", "Light Culling"))
/** To disable precomputed visibility */
SHOWFLAG_FIXED_IN_SHIPPING(1, PrecomputedVisibility, SFG_Advanced, NSLOCTEXT("UnrealEd", "PrecomputedVisibilitySF", "Precomputed Visibility"))
/** Contribution from sky light, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(SkyLighting, SFG_LightTypes, NSLOCTEXT("UnrealEd", "SkyLightingSF", "Sky Lighting"))
/** Visualize preview shadow indicator */
SHOWFLAG_FIXED_IN_SHIPPING(0, PreviewShadowsIndicator, SFG_Visualize, NSLOCTEXT("UnrealEd", "PreviewShadowIndicatorSF", "Preview Shadows Indicator"))
/** Visualize precomputed visibility cells */
SHOWFLAG_FIXED_IN_SHIPPING(0, PrecomputedVisibilityCells, SFG_Visualize, NSLOCTEXT("UnrealEd", "PrecomputedVisibilityCellsSF", "Precomputed Visibility Cells"))
#Associated Variable and Callsites
This variable is associated with another variable named PrecomputedVisibility
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:319
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeLightCulling, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeLightCullingSF", "Light Culling"))
/** To disable precomputed visibility */
SHOWFLAG_FIXED_IN_SHIPPING(1, PrecomputedVisibility, SFG_Advanced, NSLOCTEXT("UnrealEd", "PrecomputedVisibilitySF", "Precomputed Visibility"))
/** Contribution from sky light, for now SHOWFLAG_ALWAYS_ACCESSIBLE because it's exposed in SceneCapture */
SHOWFLAG_ALWAYS_ACCESSIBLE(SkyLighting, SFG_LightTypes, NSLOCTEXT("UnrealEd", "SkyLightingSF", "Sky Lighting"))
/** Visualize preview shadow indicator */
SHOWFLAG_FIXED_IN_SHIPPING(0, PreviewShadowsIndicator, SFG_Visualize, NSLOCTEXT("UnrealEd", "PreviewShadowIndicatorSF", "Preview Shadows Indicator"))
/** Visualize precomputed visibility cells */
SHOWFLAG_FIXED_IN_SHIPPING(0, PrecomputedVisibilityCells, SFG_Visualize, NSLOCTEXT("UnrealEd", "PrecomputedVisibilityCellsSF", "Precomputed Visibility Cells"))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneOcclusion.cpp:153
Scope (from outer to inner):
file
function const uint8* FSceneViewState::GetPrecomputedVisibilityData
Source code excerpt:
{
const uint8* PrecomputedVisibilityData = NULL;
if (InScene->PrecomputedVisibilityHandler && GAllowPrecomputedVisibility && View.Family->EngineShowFlags.PrecomputedVisibility)
{
const FPrecomputedVisibilityHandler& Handler = *InScene->PrecomputedVisibilityHandler;
FViewElementPDI VisibilityCellsPDI(&View, nullptr, nullptr);
// Draw visibility cell bounds for debugging if enabled
if ((GShowPrecomputedVisibilityCells || View.Family->EngineShowFlags.PrecomputedVisibilityCells) && !GShowRelevantPrecomputedVisibilityCells)