ShowFlag.TestImage

ShowFlag.TestImage

#Overview

name: ShowFlag.TestImage

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.TestImage is to display a test image that allows developers to tweak monitor colors, borders, and assess image and temporal aliasing in Unreal Engine 5’s rendering system.

This setting variable is primarily used by the rendering system, specifically in the post-processing stage. Based on the callsites, it’s part of the Engine module and is utilized in the Renderer module.

The value of this variable is set through the SHOWFLAG_FIXED_IN_SHIPPING macro in the ShowFlagsValues.inl file. It’s initialized to 0 and is categorized as a developer-level show flag (SFG_Developer).

The TestImage variable interacts with EngineShowFlags, which is likely a struct containing various show flags for the engine. In the provided code, EngineShowFlags.TestImage is checked to determine whether to add a test image pass in the post-processing pipeline.

Developers should be aware that this variable is intended for development and debugging purposes. It’s fixed in shipping builds, meaning it won’t be available in final, released versions of the game.

Best practices for using this variable include:

  1. Use it during development to calibrate monitor settings and assess image quality.
  2. Be cautious about performance impact when enabled, as it adds an additional pass to the rendering pipeline.
  3. Ensure it’s disabled in final builds to avoid unintended visual artifacts or performance issues.

Regarding the associated variable TestImage:

The purpose of TestImage is the same as ShowFlag.TestImage, as they share the same value and definition.

It’s used in the same context within the Engine and Renderer modules.

The value is set in the same manner through the SHOWFLAG_FIXED_IN_SHIPPING macro.

TestImage is directly referenced in the post-processing pipeline to determine whether to add the test image pass.

Developers should treat TestImage with the same considerations as ShowFlag.TestImage, using it for development and debugging purposes only.

Best practices for TestImage align with those of ShowFlag.TestImage, emphasizing its use during development and ensuring it’s disabled in 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:99

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, OpaqueCompositeEditorPrimitives, SFG_Developer, NSLOCTEXT("UnrealEd", "OpaqueCompositeEditorPrimitives", "Make Composite Editor Primitives Opaque"))
/** Shows a test image that allows to tweak the monitor colors, borders and allows to judge image and temporal aliasing  */
SHOWFLAG_FIXED_IN_SHIPPING(0, TestImage, SFG_Developer, NSLOCTEXT("UnrealEd", "TestImageSF", "Test Image"))
/** Helper to tweak depth of field */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeDOF, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeDOFSF", "Depth of Field Layers"))
/** Show Vertex Colors */
SHOWFLAG_FIXED_IN_SHIPPING(0, VertexColors, SFG_Advanced, NSLOCTEXT("UnrealEd", "VertexColorsSF", "Vertex Colors"))
/** Show Physical Material Masks */
SHOWFLAG_FIXED_IN_SHIPPING(0, PhysicalMaterialMasks, SFG_Advanced, NSLOCTEXT("UnrealEd", "PhysicalMaterialMasksSF", "Physical Material Masks"))

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, OpaqueCompositeEditorPrimitives, SFG_Developer, NSLOCTEXT("UnrealEd", "OpaqueCompositeEditorPrimitives", "Make Composite Editor Primitives Opaque"))
/** Shows a test image that allows to tweak the monitor colors, borders and allows to judge image and temporal aliasing  */
SHOWFLAG_FIXED_IN_SHIPPING(0, TestImage, SFG_Developer, NSLOCTEXT("UnrealEd", "TestImageSF", "Test Image"))
/** Helper to tweak depth of field */
SHOWFLAG_FIXED_IN_SHIPPING(0, VisualizeDOF, SFG_Visualize, NSLOCTEXT("UnrealEd", "VisualizeDOFSF", "Depth of Field Layers"))
/** Show Vertex Colors */
SHOWFLAG_FIXED_IN_SHIPPING(0, VertexColors, SFG_Advanced, NSLOCTEXT("UnrealEd", "VertexColorsSF", "Vertex Colors"))
/** Show Physical Material Masks */
SHOWFLAG_FIXED_IN_SHIPPING(0, PhysicalMaterialMasks, SFG_Advanced, NSLOCTEXT("UnrealEd", "PhysicalMaterialMasksSF", "Physical Material Masks"))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/PostProcess/PostProcessing.cpp:1748

Scope (from outer to inner):

file
function     void AddPostProcessingPasses

Source code excerpt:

		// Draw debug stuff directly onto the back buffer

		if (EngineShowFlags.TestImage)
		{
			AddTestImagePass(GraphBuilder, View, SceneColor);
		}

		if (EngineShowFlags.VisualizeNanite && NaniteRasterResults != nullptr)
		{