ShowFlag.VisualizeShadingModels
ShowFlag.VisualizeShadingModels
#Overview
name: ShowFlag.VisualizeShadingModels
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 8
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of ShowFlag.VisualizeShadingModels is to enable visualization of shading models in the renderer’s post-processing pipeline.
This setting variable is primarily used in the rendering system, specifically in the post-processing stage. It’s part of the engine’s debug visualization tools, allowing developers to visually inspect the shading models applied to different surfaces in the scene.
The Unreal Engine’s renderer subsystem relies on this variable to determine whether to execute the shading model visualization pass. This pass is added to the post-processing sequence when the corresponding engine show flag (EngineShowFlags.VisualizeShadingModels) is set.
The value of this variable is typically set through the engine’s show flags system, which allows toggling various debug visualization modes. It can be controlled via the engine’s UI or programmatically.
This variable interacts closely with the View.PrimaryScreenPercentageMethod. There’s a check to ensure that Temporal Anti-Aliasing Upscaling (TAAU) is disabled when visualizing shading models, as these two features may not be compatible.
Developers should be aware that enabling this visualization mode may have performance implications, as it adds an additional pass to the rendering pipeline. It should primarily be used for debugging and development purposes, not in final builds or performance-critical scenarios.
When using this variable, best practices include:
- Only enabling it when necessary for debugging or inspection.
- Ensuring TAAU is disabled when this visualization is active.
- Being aware of the potential performance impact.
The associated variable VisualizeShadingModels is used in the same context and serves the same purpose. It’s likely an internal representation of the show flag used within the rendering code.
The VisualizeShadingModels variable is used to control the execution of the AddVisualizeShadingModelPass function, which adds the actual visualization pass to the render graph. This pass takes the current scene color and scene textures as input and produces a new scene color output with the shading models visualized.
Developers working with custom shading models or debugging rendering issues related to material shading should find this visualization tool particularly useful. It provides a direct visual representation of how different parts of the scene are being shaded, which can be invaluable for identifying and resolving rendering artifacts or unexpected shading behavior.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:353
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeSSR, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeSSR", "Screen Space Reflections"))
/** Visualize the Shading Models, mostly or debugging and profiling */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeShadingModels, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeShadingModels", "Shading Models"))
/** Visualize the senses configuration of AIs' PawnSensingComponent */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeSenses, SFG_Advanced, NSLOCTEXT("UnrealEd", "VisualizeSenses", "Senses"))
/** Visualize LOD Coloration */
SHOWFLAG_FIXED_IN_SHIPPING(0, LODColoration, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeLODColoration", "Visualize LOD Coloration"))
/** Visualize HLOD Coloration */
SHOWFLAG_FIXED_IN_SHIPPING(0, HLODColoration, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeHLODColoration", "Visualize HLOD Coloration"))
#Associated Variable and Callsites
This variable is associated with another variable named VisualizeShadingModels
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Media/MediaIOFramework/Source/MediaIOCore/Private/MediaCaptureSceneViewExtension.h:50
Scope (from outer to inner):
file
class class FMediaCaptureSceneViewExtension : public FSceneViewExtensionBase
function virtual void SetupView
Source code excerpt:
InView.Family->EngineShowFlags.PostProcessing &&
!InView.Family->EngineShowFlags.VisualizeDistanceFieldAO &&
!InView.Family->EngineShowFlags.VisualizeShadingModels &&
!InView.Family->EngineShowFlags.VisualizeVolumetricCloudConservativeDensity &&
!InView.Family->EngineShowFlags.VisualizeVolumetricCloudEmptySpaceSkipping &&
!InView.Family->EngineShowFlags.ShaderComplexity;
}
else
{
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:353
Scope: file
Source code excerpt:
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeSSR, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeSSR", "Screen Space Reflections"))
/** Visualize the Shading Models, mostly or debugging and profiling */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeShadingModels, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeShadingModels", "Shading Models"))
/** Visualize the senses configuration of AIs' PawnSensingComponent */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeSenses, SFG_Advanced, NSLOCTEXT("UnrealEd", "VisualizeSenses", "Senses"))
/** Visualize LOD Coloration */
SHOWFLAG_FIXED_IN_SHIPPING(0, LODColoration, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeLODColoration", "Visualize LOD Coloration"))
/** Visualize HLOD Coloration */
SHOWFLAG_FIXED_IN_SHIPPING(0, HLODColoration, SFG_Hidden, NSLOCTEXT("UnrealEd", "VisualizeHLODColoration", "Visualize HLOD Coloration"))
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessMaterial.cpp:912
Scope (from outer to inner):
file
function static bool IsPostProcessMaterialsEnabledForView
Source code excerpt:
if (!View.Family->EngineShowFlags.PostProcessing ||
!View.Family->EngineShowFlags.PostProcessMaterial ||
View.Family->EngineShowFlags.VisualizeShadingModels ||
CVarPostProcessingDisableMaterials.GetValueOnRenderThread() != 0)
{
return false;
}
return true;
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:183
Scope (from outer to inner):
file
function bool IsPostProcessingEnabled
Source code excerpt:
View.Family->EngineShowFlags.PostProcessing &&
!View.Family->EngineShowFlags.VisualizeDistanceFieldAO &&
!View.Family->EngineShowFlags.VisualizeShadingModels &&
!View.Family->EngineShowFlags.VisualizeVolumetricCloudConservativeDensity &&
!View.Family->EngineShowFlags.VisualizeVolumetricCloudEmptySpaceSkipping &&
!View.Family->EngineShowFlags.ShaderComplexity;
}
else
{
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:379
Scope (from outer to inner):
file
function void AddPostProcessingPasses
Source code excerpt:
SelectionOutline,
EditorPrimitive,
VisualizeShadingModels,
VisualizeGBufferHints,
VisualizeSubsurface,
VisualizeGBufferOverview,
VisualizeLumenSceneOverview,
VisualizeHDR,
VisualizeLocalExposure,
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:483
Scope (from outer to inner):
file
function void AddPostProcessingPasses
Source code excerpt:
PassSequence.SetEnabled(EPass::EditorPrimitive, false);
#endif
PassSequence.SetEnabled(EPass::VisualizeShadingModels, EngineShowFlags.VisualizeShadingModels);
PassSequence.SetEnabled(EPass::VisualizeGBufferHints, EngineShowFlags.GBufferHints);
PassSequence.SetEnabled(EPass::VisualizeSubsurface, EngineShowFlags.VisualizeSSS);
PassSequence.SetEnabled(EPass::VisualizeGBufferOverview, bVisualizeGBufferOverview || bVisualizeGBufferDumpToFile || bVisualizeGBufferDumpToPIpe);
PassSequence.SetEnabled(EPass::VisualizeLumenSceneOverview, (LumenVisualizeMode == VISUALIZE_MODE_OVERVIEW || LumenVisualizeMode == VISUALIZE_MODE_PERFORMANCE_OVERVIEW) && bPostProcessingEnabled);
PassSequence.SetEnabled(EPass::VisualizeHDR, EngineShowFlags.VisualizeHDR);
PassSequence.SetEnabled(EPass::VisualizeMotionVectors, EngineShowFlags.VisualizeMotionVectors || EngineShowFlags.VisualizeReprojection);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:1509
Scope (from outer to inner):
file
function void AddPostProcessingPasses
Source code excerpt:
#endif
if (PassSequence.IsEnabled(EPass::VisualizeShadingModels))
{
ensureMsgf(View.PrimaryScreenPercentageMethod != EPrimaryScreenPercentageMethod::TemporalUpscale, TEXT("TAAU should be disabled when visualizing shading models."));
FVisualizeShadingModelInputs PassInputs;
PassSequence.AcceptOverrideIfLastPass(EPass::VisualizeShadingModels, PassInputs.OverrideOutput);
PassInputs.SceneColor = SceneColor;
PassInputs.SceneTextures = Inputs.SceneTextures;
SceneColor = AddVisualizeShadingModelPass(GraphBuilder, View, PassInputs);
}