ShowFlag.ShaderComplexityWithQuadOverdraw

ShowFlag.ShaderComplexityWithQuadOverdraw

#Overview

name: ShowFlag.ShaderComplexityWithQuadOverdraw

This variable is created as a Console Variable (cvar).

It is referenced in 5 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.ShaderComplexityWithQuadOverdraw is to visualize the overhead of material quads in relation to shader complexity. This setting is primarily used for debugging and performance optimization in the rendering system of Unreal Engine 5.

This setting variable is primarily relied upon by the Unreal Engine’s rendering subsystem. It’s used in the Engine module and also referenced in the Niagara plugin, specifically for particle mesh rendering.

The value of this variable is set through the engine’s show flags system, which allows developers to toggle various visualization modes. It’s defined in the ShowFlagsValues.inl file and is marked as fixed in shipping builds, meaning it’s primarily intended for development and debugging purposes.

The ShaderComplexityWithQuadOverdraw variable interacts closely with other shader complexity and visualization modes. It’s often checked alongside other show flags like Wireframe and ShaderComplexity to determine the appropriate debug view shader mode.

Developers should be aware that this variable is part of a set of advanced visualization tools. It’s not intended for use in shipping games but rather as a development aid for optimizing rendering performance. When enabled, it will change the way the scene is rendered to provide visual feedback on shader complexity and quad overdraw.

Best practices when using this variable include:

  1. Use it in conjunction with other shader complexity visualization modes to get a comprehensive understanding of rendering performance.
  2. Be aware that enabling this mode will impact rendering performance, so it should be used selectively during development.
  3. Use this visualization in areas of your game where you suspect there might be issues with overdraw or complex shaders.

The associated variable ShaderComplexityWithQuadOverdraw is essentially the same as ShowFlag.ShaderComplexityWithQuadOverdraw. It’s used in the same context and serves the same purpose. The difference is in how it’s accessed - one through the show flags system (ShowFlag.ShaderComplexityWithQuadOverdraw) and the other directly (ShaderComplexityWithQuadOverdraw).

This associated variable is used in similar ways:

The same best practices and considerations apply to both variables. They are tools for advanced graphics debugging and optimization, and should be used thoughtfully during the development process.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:363

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, QuadOverdraw, SFG_Hidden, NSLOCTEXT("UnrealEd", "QuadOverdrawSF", "Quad Overdraw"))
/** Visualize the overhead of material quads */
SHOWFLAG_FIXED_IN_SHIPPING(0, ShaderComplexityWithQuadOverdraw, SFG_Hidden, NSLOCTEXT("UnrealEd", "ShaderComplexityWithQuadOverdraw", "Shader Complexity With Quad Overdraw"))
/** Visualize the accuracy of the primitive distance computed for texture streaming */
SHOWFLAG_FIXED_IN_SHIPPING(0, PrimitiveDistanceAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "PrimitiveDistanceAccuracy", "Primitive Distance Accuracy"))
/** Visualize the accuracy of the mesh UV density computed for texture streaming */
SHOWFLAG_FIXED_IN_SHIPPING(0, MeshUVDensityAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "MeshUVDensityAccuracy", "Mesh UV Densities Accuracy"))
/** Visualize the accuracy of CPU material texture scales when compared to the GPU values */
SHOWFLAG_FIXED_IN_SHIPPING(0, MaterialTextureScaleAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "MaterialTextureScaleAccuracy", "Material Texture Scales Accuracy"))

#Associated Variable and Callsites

This variable is associated with another variable named ShaderComplexityWithQuadOverdraw. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/FX/Niagara/Source/Niagara/Private/NiagaraRendererMeshes.cpp:343

Scope (from outer to inner):

file
function     void FNiagaraRendererMeshes::PrepareParticleMeshRenderData

Source code excerpt:

	//       For main pass scene captures we exclude the batches if they are translucent
	const bool bIsExcludedViewMode = AllowDebugViewmodes() &&
		(ViewFamily.EngineShowFlags.Wireframe || ViewFamily.EngineShowFlags.ShaderComplexity || ViewFamily.EngineShowFlags.ShaderComplexityWithQuadOverdraw);
	ParticleMeshRenderData.bIsGpuLowLatencyTranslucency =
		bGpuLowLatencyTranslucency &&
		GpuReadyTickStage >= CurrentParticleData->GetGPUDataReadyStage() &&
		!bIsExcludedViewMode &&
		!SceneProxy->CastsVolumetricTranslucentShadow() &&
		ParticleMeshRenderData.DynamicDataMesh->Materials.Num() > 0 &&

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/SceneView.cpp:3062

Scope (from outer to inner):

file
function     EDebugViewShaderMode FSceneViewFamily::ChooseDebugViewShaderMode

Source code excerpt:

			return DVSM_QuadComplexity;
		}
		else if (EngineShowFlags.ShaderComplexityWithQuadOverdraw)
		{
			return DVSM_ShaderComplexityContainedQuadOverhead;
		}
		else
		{
			return DVSM_ShaderComplexity;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/ShowFlags.cpp:732

Scope: file

Source code excerpt:

		return VMI_QuadOverdraw;
	}
	else if (EngineShowFlags.ShaderComplexityWithQuadOverdraw)
	{
		return VMI_ShaderComplexityWithQuadOverdraw;
	}
	else if (EngineShowFlags.PrimitiveDistanceAccuracy)
	{
		return VMI_PrimitiveDistanceAccuracy;

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Public/ShowFlagsValues.inl:363

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, QuadOverdraw, SFG_Hidden, NSLOCTEXT("UnrealEd", "QuadOverdrawSF", "Quad Overdraw"))
/** Visualize the overhead of material quads */
SHOWFLAG_FIXED_IN_SHIPPING(0, ShaderComplexityWithQuadOverdraw, SFG_Hidden, NSLOCTEXT("UnrealEd", "ShaderComplexityWithQuadOverdraw", "Shader Complexity With Quad Overdraw"))
/** Visualize the accuracy of the primitive distance computed for texture streaming */
SHOWFLAG_FIXED_IN_SHIPPING(0, PrimitiveDistanceAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "PrimitiveDistanceAccuracy", "Primitive Distance Accuracy"))
/** Visualize the accuracy of the mesh UV density computed for texture streaming */
SHOWFLAG_FIXED_IN_SHIPPING(0, MeshUVDensityAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "MeshUVDensityAccuracy", "Mesh UV Densities Accuracy"))
/** Visualize the accuracy of CPU material texture scales when compared to the GPU values */
SHOWFLAG_FIXED_IN_SHIPPING(0, MaterialTextureScaleAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "MaterialTextureScaleAccuracy", "Material Texture Scales Accuracy"))