a.VisualizeLODs

a.VisualizeLODs

#Overview

name: a.VisualizeLODs

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 a.VisualizeLODs is to enable visualization of skeletal mesh LODs (Levels of Detail) in Unreal Engine 5. This setting is primarily used for debugging and development purposes within the animation and rendering systems.

This setting variable is relied upon by the Engine module, specifically within the skinned mesh component subsystem. It’s used to control the visualization of LODs for skeletal meshes, which is crucial for performance optimization and visual quality management in games and other real-time 3D applications.

The value of this variable is set through a console command. It’s defined as a TAutoConsoleVariable with an initial value of 0, meaning the LOD visualization is disabled by default.

The associated variable CVarAnimVisualizeLODs interacts directly with a.VisualizeLODs. They share the same value and purpose, with CVarAnimVisualizeLODs being the C++ variable that’s used to access the console variable’s value in the code.

Developers must be aware that this variable is primarily for debugging purposes. Enabling it in a shipping build could potentially impact performance or reveal development-only visualizations to end-users. It’s important to ensure this setting is properly managed between development and release builds.

Best practices when using this variable include:

  1. Use it during development to verify LOD transitions and ensure proper LOD setup for skeletal meshes.
  2. Disable it for shipping builds to avoid any potential performance impact or unintended visualizations.
  3. Use in conjunction with other debugging tools to get a comprehensive view of skeletal mesh performance and rendering.

Regarding the associated variable CVarAnimVisualizeLODs:

The purpose of CVarAnimVisualizeLODs is to provide a C++ interface to the a.VisualizeLODs console variable within the engine’s code.

This variable is used within the Engine module, specifically in the SkinnedMeshComponent class, to control the visualization of skeletal mesh LODs.

The value of this variable is set indirectly through the a.VisualizeLODs console command, and it’s accessed in the code using the GetValueOnAnyThread() method.

CVarAnimVisualizeLODs interacts directly with the a.VisualizeLODs console variable, essentially serving as its in-code representation.

Developers should be aware that this variable is used in non-shipping and non-test builds only, as indicated by the preprocessor condition #if !(UE_BUILD_SHIPPING || UE_BUILD_TEST).

Best practices for using CVarAnimVisualizeLODs include:

  1. Use it for debugging and development purposes only.
  2. Ensure it’s not accidentally left enabled in shipping builds.
  3. Be aware of its impact on performance when enabled, especially in complex scenes with many skeletal meshes.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkinnedMeshComponent.cpp:66

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarAnimVisualizeLODs(
	TEXT("a.VisualizeLODs"),
	0,
	TEXT("Visualize SkelMesh LODs"));

float GUpdateBoundsNotifyStreamingRadiusChangeRatio = 0.1f;
FAutoConsoleVariableRef CVarUpdateBoundsNotifyStreamingRadiusChangeRatio(
	TEXT("r.SkinnedMesh.UpdateBoundsNotifyStreamingRadiusChangeRatio"),

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkinnedMeshComponent.cpp:65

Scope: file

Source code excerpt:

static TAutoConsoleVariable<int32> CVarEnableMorphTargets(TEXT("r.EnableMorphTargets"), 1, TEXT("Enable Morph Targets"));

static TAutoConsoleVariable<int32> CVarAnimVisualizeLODs(
	TEXT("a.VisualizeLODs"),
	0,
	TEXT("Visualize SkelMesh LODs"));

float GUpdateBoundsNotifyStreamingRadiusChangeRatio = 0.1f;
FAutoConsoleVariableRef CVarUpdateBoundsNotifyStreamingRadiusChangeRatio(

#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkinnedMeshComponent.cpp:4060

Scope (from outer to inner):

file
function     bool USkinnedMeshComponent::UpdateLODStatus_Internal

Source code excerpt:


#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
		if (CVarAnimVisualizeLODs.GetValueOnAnyThread() != 0)
		{
			// Reduce to visible animated, non SyncAttachParentLOD to reduce clutter.
			if (GetSkinnedAsset() && MeshObject && bRecentlyRendered)
			{
				const bool bHasValidSyncAttachParent = bSyncAttachParentLOD && GetAttachParent() && GetAttachParent()->IsA(USkinnedMeshComponent::StaticClass());
				if (!bHasValidSyncAttachParent)