ShowFlag.OcclusionMeshes
ShowFlag.OcclusionMeshes
#Overview
name: ShowFlag.OcclusionMeshes
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.OcclusionMeshes is to visualize occlusion query bounding meshes in the Unreal Engine rendering system. This setting variable is primarily used for debugging and optimization purposes in the rendering pipeline.
This setting variable is relied upon by the Unreal Engine’s rendering subsystem, particularly in the Renderer module. It’s used to control the visibility of occlusion query bounding meshes, which are used for hardware occlusion culling.
The value of this variable is set through the engine’s show flags system, which allows developers to toggle various visualization and debugging features. It’s defined in the ShowFlagsValues.inl file, which suggests it can be controlled through the engine’s configuration or debugging tools.
The associated variable OcclusionMeshes interacts directly with ShowFlag.OcclusionMeshes, as they share the same value and purpose. This is evident from their identical definitions in the ShowFlagsValues.inl file.
Developers must be aware that this variable is intended for development and debugging purposes, not for use in shipping builds. This is clear from the SHOWFLAG_FIXED_IN_SHIPPING macro used in its definition, which sets its default value to 0 for shipping builds.
Best practices when using this variable include:
- Use it only during development and debugging phases, not in production builds.
- Be aware that enabling this visualization may impact performance, as it adds additional rendering overhead.
- Use it in conjunction with other occlusion-related tools and variables (like DisableOcclusionQueries) for comprehensive occlusion debugging.
Regarding the associated variable OcclusionMeshes:
- It serves the same purpose as ShowFlag.OcclusionMeshes, visualizing occlusion query bounding meshes.
- It’s used in the Renderer module, specifically in the SceneOcclusion.cpp file, to control the rendering of occlusion meshes.
- Its value is checked in the BeginOcclusionTests function to determine whether to set up the pixel shader for rendering occlusion meshes.
- Developers should be aware that enabling this flag will cause additional rendering passes, which may impact performance.
- Best practices include using this variable judiciously during development and ensuring it’s disabled for performance-critical scenarios and shipping builds.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:387
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VREditing, SFG_Hidden, NSLOCTEXT("UnrealEd", "VREditSF", "VR Editing"))
/** Visualize Occlusion Query bounding meshes */
SHOWFLAG_FIXED_IN_SHIPPING(0, OcclusionMeshes, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeOcclusionQueries", "Visualize Occlusion Queries"))
/** Visualize Occlusion Query bounding meshes */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeInstanceOcclusionQueries, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeInstanceOcclusionQueriesSF", "Visualize Instance Culling Occlusion Queries"))
/** Disable hardware occlusion queries, similar to setting r.AllowOcclusionQueries=0, but just for this scene. */
SHOWFLAG_FIXED_IN_SHIPPING(0, DisableOcclusionQueries, SFG_Developer, NSLOCTEXT("UnrealEd", "DisableOcclusionQueries", "Disable Hardware Occlusion Queries"))
// RHI_RAYTRACING begin
#Associated Variable and Callsites
This variable is associated with another variable named OcclusionMeshes
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:387
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VREditing, SFG_Hidden, NSLOCTEXT("UnrealEd", "VREditSF", "VR Editing"))
/** Visualize Occlusion Query bounding meshes */
SHOWFLAG_FIXED_IN_SHIPPING(0, OcclusionMeshes, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeOcclusionQueries", "Visualize Occlusion Queries"))
/** Visualize Occlusion Query bounding meshes */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeInstanceOcclusionQueries, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeInstanceOcclusionQueriesSF", "Visualize Instance Culling Occlusion Queries"))
/** Disable hardware occlusion queries, similar to setting r.AllowOcclusionQueries=0, but just for this scene. */
SHOWFLAG_FIXED_IN_SHIPPING(0, DisableOcclusionQueries, SFG_Developer, NSLOCTEXT("UnrealEd", "DisableOcclusionQueries", "Disable Hardware Occlusion Queries"))
// RHI_RAYTRACING begin
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneOcclusion.cpp:1259
Scope (from outer to inner):
file
function static void BeginOcclusionTests
Source code excerpt:
GraphicsPSOInit.BoundShaderState.VertexShaderRHI = VertexShader.GetVertexShader();
if (View.Family->EngineShowFlags.OcclusionMeshes)
{
TShaderMapRef<FOcclusionQueryPS> PixelShader(View.ShaderMap);
GraphicsPSOInit.BoundShaderState.PixelShaderRHI = PixelShader.GetPixelShader();
GraphicsPSOInit.BlendState = TStaticBlendState<CW_RGBA>::GetRHI();
}