r.ProxyLODMaterialInParallel

r.ProxyLODMaterialInParallel

#Overview

name: r.ProxyLODMaterialInParallel

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.ProxyLODMaterialInParallel is to control whether material work is done in parallel with mesh simplification in the Proxy LOD (Level of Detail) system. This setting is part of the ProxyLODPlugin, which is used for generating simplified versions of complex 3D models to improve rendering performance.

The ProxyLODPlugin, which is an editor plugin in Unreal Engine, relies on this setting variable. It’s specifically used in the mesh merging and simplification process.

The value of this variable is set as a console variable using TAutoConsoleVariable. It’s initialized with a default value of 1, meaning parallel material work is enabled by default.

This variable interacts with its associated variable CVarProxyLODMaterialInParallel. They share the same value and are used interchangeably in the code.

Developers must be aware that this variable affects the performance and potentially the quality of the Proxy LOD generation process. Enabling parallel material work (value 1) can speed up the process, while disabling it (value 0) might be useful for debugging or in cases where parallel processing causes issues.

Best practices when using this variable include:

  1. Leave it enabled (default value 1) for optimal performance in most cases.
  2. If experiencing issues with Proxy LOD generation, try disabling it (set to 0) to see if it resolves the problem.
  3. Consider the trade-offs between processing speed and potential synchronization issues when deciding whether to enable or disable this feature.

Regarding the associated variable CVarProxyLODMaterialInParallel:

The purpose of CVarProxyLODMaterialInParallel is the same as r.ProxyLODMaterialInParallel. It’s the actual console variable that controls the parallel material processing in the Proxy LOD system.

This variable is used directly in the ProxyLODPlugin module, specifically in the FVoxelizeMeshMerging class to determine if parallel material baking is supported.

The value of this variable is set when it’s declared using TAutoConsoleVariable. It can be changed at runtime through console commands.

CVarProxyLODMaterialInParallel interacts directly with the r.ProxyLODMaterialInParallel console command. They represent the same setting.

Developers should be aware that this variable is used in conditional compilation (#if PROXYLOD_USE_TEST_CVARS), which means its behavior might change depending on how the plugin is compiled.

Best practices for using CVarProxyLODMaterialInParallel include:

  1. Use it for fine-tuning Proxy LOD generation performance.
  2. Be cautious when changing its value in a production environment, as it might affect the stability of the LOD generation process.
  3. Consider exposing this setting in a user interface for advanced users or developers to adjust as needed.

#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:104

Scope: file

Source code excerpt:

// Disable the parallel flattening of the source textures.
static TAutoConsoleVariable<int32> CVarProxyLODMaterialInParallel(
	TEXT("r.ProxyLODMaterialInParallel"),
	1,
	TEXT("0: disable doing material work in parallel with mesh simplification\n")
	TEXT("1: enable - default"),
	ECVF_Default);

// Limit the number of dilation steps used in gap filling.

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:


// Disable the parallel flattening of the source textures.
static TAutoConsoleVariable<int32> CVarProxyLODMaterialInParallel(
	TEXT("r.ProxyLODMaterialInParallel"),
	1,
	TEXT("0: disable doing material work in parallel with mesh simplification\n")
	TEXT("1: enable - default"),
	ECVF_Default);

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

Scope (from outer to inner):

file
function     bool FVoxelizeMeshMerging::bSupportsParallelMaterialBake

Source code excerpt:

{
#if PROXYLOD_USE_TEST_CVARS	
	bool bDoParallel = (CVarProxyLODMaterialInParallel.GetValueOnAnyThread() == 1);
#else
	bool bDoParallel = true;
#endif 
	return bDoParallel;
}