r.ProxyLODSingleThreadSimplify

r.ProxyLODSingleThreadSimplify

#Overview

name: r.ProxyLODSingleThreadSimplify

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 r.ProxyLODSingleThreadSimplify is to control the threading behavior of the ProxyLOD (Level of Detail) simplification process in Unreal Engine 5. It allows developers to switch between multi-threaded and single-threaded code paths for the ProxyLOD simplification algorithm.

This setting variable is primarily used by the ProxyLOD plugin, which is part of the Unreal Engine’s editor tools for optimizing 3D models and creating lower-detail versions of complex geometry.

The value of this variable is set through the Unreal Engine console or configuration files. It’s defined as a TAutoConsoleVariable, which means it can be changed at runtime.

The associated variable CVarProxyLODSingleThreadSimplify directly interacts with r.ProxyLODSingleThreadSimplify. They share the same value and purpose.

Developers must be aware that:

  1. The default value is 0, which means multi-threaded processing is enabled by default.
  2. Setting this variable to 1 will force the simplifier to use a single-threaded code path, which may be slower but could be useful for debugging or on systems with limited resources.

Best practices when using this variable include:

  1. Leave it at the default value (0) for optimal performance in most cases.
  2. Use the single-threaded option (1) when debugging ProxyLOD-related issues or if experiencing stability problems with the multi-threaded version.
  3. Consider the trade-off between performance and potential stability when deciding which setting to use.

Regarding the associated variable CVarProxyLODSingleThreadSimplify:

The purpose of CVarProxyLODSingleThreadSimplify is identical to r.ProxyLODSingleThreadSimplify. It’s the actual console variable object that controls the behavior described above.

This variable is used within the ProxyLOD plugin to determine the threading behavior at runtime. It’s typically accessed using the GetValueOnAnyThread() method, as seen in the FVoxelizeMeshMerging::CaptureCVars function.

The value of CVarProxyLODSingleThreadSimplify is set when the console variable is defined, and it can be changed through the same methods as r.ProxyLODSingleThreadSimplify.

Developers should be aware that this variable is used directly in the code to control the behavior of the ProxyLOD simplification process. Changes to this variable will immediately affect the threading behavior of the simplification algorithm.

Best practices for CVarProxyLODSingleThreadSimplify are the same as for r.ProxyLODSingleThreadSimplify, as they are effectively the same variable. Developers should use the console command syntax (r.ProxyLODSingleThreadSimplify) when they want to change this setting, rather than trying to modify CVarProxyLODSingleThreadSimplify directly in code.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Plugins/Editor/ProxyLODPlugin/Source/ProxyLOD/Private/ProxyLODPlugin.cpp:95

Scope: file

Source code excerpt:

// Force the simplifier to use single threaded code path.
static TAutoConsoleVariable<int32> CVarProxyLODSingleThreadSimplify(
	TEXT("r.ProxyLODSingleThreadSimplify"),
	0,
	TEXT("Use single threaded code path. Default off.\n")
	TEXT("0: Multithreaded \n")
	TEXT("1: Single threaded."),
	ECVF_Default);

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Plugins/Editor/ProxyLODPlugin/Source/ProxyLOD/Private/ProxyLODPlugin.cpp:94

Scope: file

Source code excerpt:


// Force the simplifier to use single threaded code path.
static TAutoConsoleVariable<int32> CVarProxyLODSingleThreadSimplify(
	TEXT("r.ProxyLODSingleThreadSimplify"),
	0,
	TEXT("Use single threaded code path. Default off.\n")
	TEXT("0: Multithreaded \n")
	TEXT("1: Single threaded."),
	ECVF_Default);

#Loc: <Workspace>/Engine/Plugins/Editor/ProxyLODPlugin/Source/ProxyLOD/Private/ProxyLODPlugin.cpp:419

Scope (from outer to inner):

file
function     void FVoxelizeMeshMerging::CaptureCVars

Source code excerpt:

		bool bUseTrueTangentSpace      = (CVarProxyLODUseTangentSpace.GetValueOnGameThread() == 1);
		bool bVoxelizeAndRemeshOnly    = (CVarProxyLODRemeshOnly.GetValueOnGameThread() == 1);
		bool bSingleThreadedSimplify   = (CVarProxyLODSingleThreadSimplify.GetValueOnAnyThread() == 1);
		bool bWallCorreciton           = (CVarProxyLODCorrectCollapsedWalls.GetValueOnGameThread() == 1);

		// set values  - note, this class is a global (singleton) instance.
		this->RayHitOrder              = RayOrder;
		this->bChartColorVerts         = bAddChartColorVerts;
		this->bUseTangentSpace         = bUseTrueTangentSpace;