ShowFlag.OutputMaterialTextureScales

ShowFlag.OutputMaterialTextureScales

#Overview

name: ShowFlag.OutputMaterialTextureScales

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of ShowFlag.OutputMaterialTextureScales is to enable the output of material texture scales in the rendering system of Unreal Engine 5. This setting is primarily used for debugging and profiling material texture usage.

This setting variable is mainly utilized by the rendering subsystem of Unreal Engine 5. It is referenced in the Engine module and the MaterialUtilities module, indicating its importance in material-related rendering processes.

The value of this variable is set through the engine’s show flags system. It can be toggled on or off, typically through debug commands or editor UI.

ShowFlag.OutputMaterialTextureScales interacts closely with other material-related debug view modes, particularly MaterialTextureScaleAccuracy. It’s used in conjunction with FEngineShowFlags to control the debug view shader mode.

Developers should be aware that this variable is fixed in shipping builds, meaning it’s primarily intended for development and debugging purposes. It’s not accessible in final, released versions of games.

Best practices for using this variable include:

  1. Use it during development to analyze and optimize material texture usage.
  2. Combine it with other material debug modes for comprehensive analysis.
  3. Remember to disable it before shipping, as it’s not available in release builds.

Regarding the associated variable OutputMaterialTextureScales:

The purpose of OutputMaterialTextureScales is identical to ShowFlag.OutputMaterialTextureScales. It’s used to control the output of material texture scales in the rendering process.

This variable is used in the MaterialUtilities module and the Engine module, specifically in mesh rendering and scene view construction.

The value is typically set in conjunction with ShowFlag.OutputMaterialTextureScales, often through the same mechanisms.

OutputMaterialTextureScales interacts with the FEngineShowFlags structure and is used to determine the debug view shader mode in FSceneViewFamily.

Developers should be aware that this variable is part of the show flags system and is used to control specific debug rendering features.

Best practices include using it in tandem with ShowFlag.OutputMaterialTextureScales for consistency in debug rendering, and ensuring it’s properly managed in different build configurations.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, MaterialTextureScaleAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "MaterialTextureScaleAccuracy", "Material Texture Scales Accuracy"))
/** Outputs the material texture scales. */
SHOWFLAG_FIXED_IN_SHIPPING(0, OutputMaterialTextureScales, SFG_Hidden, NSLOCTEXT("UnrealEd", "OutputMaterialTextureScales", "Output Material Texture Scales"))
/** Compare the required texture resolution to the actual resolution. */
SHOWFLAG_FIXED_IN_SHIPPING(0, RequiredTextureResolution, SFG_Hidden, NSLOCTEXT("UnrealEd", "RequiredTextureResolution", "Required Texture Resolution"))
/** Compare the required mip level to the resident virtual texture mip level. */
SHOWFLAG_FIXED_IN_SHIPPING(0, VirtualTexturePendingMips, SFG_Hidden, NSLOCTEXT("UnrealEd", "VirtualTexturePendingMips", "Virtual Texture Pending Mips"))
/** If WidgetComponents should be rendered in the scene */
SHOWFLAG_ALWAYS_ACCESSIBLE(WidgetComponents, SFG_Normal, NSLOCTEXT("UnrealEd", "WidgetComponentsSF", "Widget Components"))

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Developer/MaterialUtilities/Private/MeshRendering.cpp:762

Scope (from outer to inner):

file
function     bool FMeshRenderer::RenderMaterialTexCoordScales

Source code excerpt:

	FEngineShowFlags ShowFlags(ESFIM_Game);
	ApplyViewMode(VMI_MaterialTextureScaleAccuracy, false, ShowFlags);
	ShowFlags.OutputMaterialTextureScales = true; // This will bind the DVSM_OutputMaterialTextureScales

	FSceneViewFamily ViewFamily(FSceneViewFamily::ConstructionValues(CanvasRenderTarget, nullptr, ShowFlags)
		.SetTime(FGameTime()));

	// The next line ensures a constant view vector of (0,0,1) for all pixels. Required because here SVPositionToTranslatedWorld is identity, making excessive view angle increase per pixel.
	// That creates bad side effects for anything that depends on the view vector, like parallax or bump offset mappings. For those, we want the tangent

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

Scope (from outer to inner):

file
function     EDebugViewShaderMode FSceneViewFamily::ChooseDebugViewShaderMode

Source code excerpt:

		return DVSM_MeshUVDensityAccuracy;
	}
	else if (EngineShowFlags.OutputMaterialTextureScales) // Test before accuracy is set since accuracy could also be set.
	{
		return DVSM_OutputMaterialTextureScales;
	}
	else if (EngineShowFlags.MaterialTextureScaleAccuracy)
	{
		return DVSM_MaterialTextureScaleAccuracy;

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

Scope: file

Source code excerpt:

SHOWFLAG_FIXED_IN_SHIPPING(0, MaterialTextureScaleAccuracy, SFG_Hidden, NSLOCTEXT("UnrealEd", "MaterialTextureScaleAccuracy", "Material Texture Scales Accuracy"))
/** Outputs the material texture scales. */
SHOWFLAG_FIXED_IN_SHIPPING(0, OutputMaterialTextureScales, SFG_Hidden, NSLOCTEXT("UnrealEd", "OutputMaterialTextureScales", "Output Material Texture Scales"))
/** Compare the required texture resolution to the actual resolution. */
SHOWFLAG_FIXED_IN_SHIPPING(0, RequiredTextureResolution, SFG_Hidden, NSLOCTEXT("UnrealEd", "RequiredTextureResolution", "Required Texture Resolution"))
/** Compare the required mip level to the resident virtual texture mip level. */
SHOWFLAG_FIXED_IN_SHIPPING(0, VirtualTexturePendingMips, SFG_Hidden, NSLOCTEXT("UnrealEd", "VirtualTexturePendingMips", "Virtual Texture Pending Mips"))
/** If WidgetComponents should be rendered in the scene */
SHOWFLAG_ALWAYS_ACCESSIBLE(WidgetComponents, SFG_Normal, NSLOCTEXT("UnrealEd", "WidgetComponentsSF", "Widget Components"))