ShowFlag.MeshUVDensityAccuracy

ShowFlag.MeshUVDensityAccuracy

#Overview

name: ShowFlag.MeshUVDensityAccuracy

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.MeshUVDensityAccuracy is to visualize the accuracy of the mesh UV density computed for texture streaming in Unreal Engine 5. This setting is primarily used for debugging and optimization purposes in the rendering system.

This setting variable is mainly utilized by the Engine and Renderer modules of Unreal Engine 5. It’s particularly relevant for the texture streaming system and material rendering pipeline.

The value of this variable is set through the engine’s show flags system, which allows developers to toggle various debug visualizations. It’s defined in the ShowFlagsValues.inl file and is marked as hidden in shipping builds, indicating it’s intended for development use only.

ShowFlag.MeshUVDensityAccuracy interacts closely with other debug visualization flags, such as PrimitiveDistanceAccuracy, MaterialTextureScaleAccuracy, and OutputMaterialTextureScales. It’s used in conjunction with these flags to provide different types of debug information related to textures and materials.

Developers should be aware that this flag is primarily for development and debugging purposes. It’s not intended to be used in shipping builds, as indicated by the SHOWFLAG_FIXED_IN_SHIPPING macro.

Best practices when using this variable include:

  1. Use it in conjunction with other texture and material-related debug flags for a comprehensive understanding of texture streaming issues.
  2. Remember to disable it in shipping builds to avoid unnecessary performance overhead.
  3. Use it when optimizing texture usage and UV layouts in your meshes.

Regarding the associated variable MeshUVDensityAccuracy, it appears to be the same flag used in different contexts within the engine. It’s used in the SceneView.cpp file to set the debug view shader mode to DVSM_MeshUVDensityAccuracy when the flag is enabled. In ShowFlags.cpp, it’s used to set the view mode to VMI_MeshUVDensityAccuracy. These usages indicate that enabling this flag triggers specific debug visualization modes in the engine’s rendering pipeline.

The purpose of MeshUVDensityAccuracy is identical to ShowFlag.MeshUVDensityAccuracy – it’s used to visualize the accuracy of mesh UV density for texture streaming. The same considerations and best practices apply to this associated variable.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

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"))
/** 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"))

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
function     EDebugViewShaderMode FSceneViewFamily::ChooseDebugViewShaderMode

Source code excerpt:

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

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

Scope: file

Source code excerpt:

		return VMI_PrimitiveDistanceAccuracy;
	}
	else if (EngineShowFlags.MeshUVDensityAccuracy)
	{
		return VMI_MeshUVDensityAccuracy;
	}
	else if (EngineShowFlags.MaterialTextureScaleAccuracy)
	{
		return VMI_MaterialTextureScaleAccuracy;

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

Scope: file

Source code excerpt:

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"))
/** 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"))

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/BasePassRendering.cpp:1043

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderBasePass

Source code excerpt:

			ViewFamily.EngineShowFlags.VirtualTexturePendingMips ||
			ViewFamily.EngineShowFlags.MaterialTextureScaleAccuracy ||
			ViewFamily.EngineShowFlags.MeshUVDensityAccuracy ||
			ViewFamily.EngineShowFlags.PrimitiveDistanceAccuracy ||
			ViewFamily.EngineShowFlags.ShaderComplexity ||
			ViewFamily.EngineShowFlags.LODColoration ||
			ViewFamily.EngineShowFlags.HLODColoration);

	const bool bForwardShadingEnabled = IsForwardShadingEnabled(SceneTextures.Config.ShaderPlatform);