ShowFlag.PrimitiveDistanceAccuracy

ShowFlag.PrimitiveDistanceAccuracy

#Overview

name: ShowFlag.PrimitiveDistanceAccuracy

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.PrimitiveDistanceAccuracy is to visualize the accuracy of primitive distance computed for texture streaming in Unreal Engine 5. This setting variable is primarily used for debugging and optimization purposes within the rendering system.

This setting variable is primarily used by the Engine and Renderer modules of Unreal Engine 5. It is referenced in various parts of the rendering pipeline, particularly in the base pass rendering and debug view shader mode selection.

The value of this variable is typically set through the engine’s show flags system, which allows developers to toggle various debug visualization modes. It’s not explicitly shown where the value is set in the provided code snippets, but it’s likely controlled through the engine’s user interface or debug commands.

The PrimitiveDistanceAccuracy variable interacts with other debug visualization modes such as MeshUVDensityAccuracy, MaterialTextureScaleAccuracy, and ShaderComplexity. These are often used in conjunction to debug various aspects of the rendering pipeline.

Developers should be aware that this variable is intended for use in non-shipping builds. It’s marked with SHOWFLAG_FIXED_IN_SHIPPING(0, …), which suggests it’s disabled in shipping builds.

Best practices when using this variable include:

  1. Use it in conjunction with other debug visualization modes for a comprehensive understanding of texture streaming issues.
  2. Be aware that enabling this visualization may impact performance, so it should be used judiciously during development and disabled for final builds.
  3. Use it to identify potential issues with primitive distance calculations that could affect texture streaming efficiency.

The associated variable PrimitiveDistanceAccuracy is essentially the same as ShowFlag.PrimitiveDistanceAccuracy. It’s used in the same context for visualizing primitive distance accuracy. The usage and best practices are the same as described above. This associated variable is typically used within the engine’s internal logic to determine which debug visualization mode to use, such as in the ChooseDebugViewShaderMode() function.

#References in C++ code

#Callsites

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

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

Scope: file

Source code excerpt:

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"))
/** Outputs the material texture scales. */
SHOWFLAG_FIXED_IN_SHIPPING(0, OutputMaterialTextureScales, SFG_Hidden, NSLOCTEXT("UnrealEd", "OutputMaterialTextureScales", "Output Material Texture Scales"))

#Associated Variable and Callsites

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

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

Scope (from outer to inner):

file
function     EDebugViewShaderMode FSceneViewFamily::ChooseDebugViewShaderMode

Source code excerpt:

		}
	}
	else if (EngineShowFlags.PrimitiveDistanceAccuracy)
	{
		return DVSM_PrimitiveDistanceAccuracy;
	}
	else if (EngineShowFlags.MeshUVDensityAccuracy)
	{
		return DVSM_MeshUVDensityAccuracy;

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

Scope: file

Source code excerpt:

		return VMI_ShaderComplexityWithQuadOverdraw;
	}
	else if (EngineShowFlags.PrimitiveDistanceAccuracy)
	{
		return VMI_PrimitiveDistanceAccuracy;
	}
	else if (EngineShowFlags.MeshUVDensityAccuracy)
	{
		return VMI_MeshUVDensityAccuracy;

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

Scope: file

Source code excerpt:

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"))
/** Outputs the material texture scales. */
SHOWFLAG_FIXED_IN_SHIPPING(0, OutputMaterialTextureScales, SFG_Hidden, NSLOCTEXT("UnrealEd", "OutputMaterialTextureScales", "Output Material Texture Scales"))

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

Scope (from outer to inner):

file
function     void FDeferredShadingSceneRenderer::RenderBasePass

Source code excerpt:

			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);