r.ProxyLODTransfer

r.ProxyLODTransfer

#Overview

name: r.ProxyLODTransfer

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.ProxyLODTransfer is to control the ray shooting method used in the Proxy LOD (Level of Detail) system for transferring data between simplified and source geometry. This setting is part of the ProxyLODPlugin, which is used for creating simplified versions of complex geometry in Unreal Engine 5.

This setting variable is primarily used in the ProxyLODPlugin module, specifically in the voxelization and mesh merging process for creating proxy LODs. The plugin is part of the Editor subsystem, as indicated by its location in the Engine/Plugins/Editor directory.

The value of this variable is set using a console variable (CVar) system. It’s defined with a default value of 1, which means it has a preference for forward shooting by default. The value can be changed at runtime through console commands or project settings.

The associated variable CVarProxyLODTransfer directly interacts with r.ProxyLODTransfer. They share the same value and purpose. CVarProxyLODTransfer is used in the C++ code to access the value set by r.ProxyLODTransfer.

Developers should be aware that this variable affects the accuracy and performance of the proxy LOD generation process. The setting has two options: 0: Shoot rays both ways between simplified and source geometry 1: Preference for forward shooting (default)

When using this variable, developers should consider the trade-off between accuracy and performance. The default setting (1) is generally a good balance, but for cases where more accurate transfer between simplified and source geometry is needed, setting it to 0 might be beneficial at the cost of increased computation time.

Best practices when using this variable include:

  1. Stick with the default value (1) unless specific issues are encountered with the proxy LOD quality.
  2. If more accurate geometry transfer is needed and performance is not a critical concern, try setting it to 0.
  3. Always test the results with different settings to ensure the best quality-to-performance ratio for your specific use case.
  4. Consider the complexity of your source geometry when adjusting this setting, as it may have a more significant impact on highly detailed models.

Regarding the associated variable CVarProxyLODTransfer, it serves as the C++ interface to access the r.ProxyLODTransfer setting. It’s used within the ProxyLODPlugin’s code to retrieve the current value of the setting and apply it to the voxelization and mesh merging process. Developers working directly with the plugin’s C++ code should use CVarProxyLODTransfer.GetValueOnGameThread() to access the current setting value, as demonstrated in the CaptureCVars() function of the FVoxelizeMeshMerging class.

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

Scope: file

Source code excerpt:

// simplified and source goemetry.
static TAutoConsoleVariable<int32> CVarProxyLODTransfer(
	TEXT("r.ProxyLODTransfer"),
	1,
	TEXT("0: shoot both ways\n")
	TEXT("1: preference for forward (default)"),
	ECVF_Default);

#Associated Variable and Callsites

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

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

Scope: file

Source code excerpt:

// Testing methods to choose correct hit when shooting rays between
// simplified and source goemetry.
static TAutoConsoleVariable<int32> CVarProxyLODTransfer(
	TEXT("r.ProxyLODTransfer"),
	1,
	TEXT("0: shoot both ways\n")
	TEXT("1: preference for forward (default)"),
	ECVF_Default);

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

Scope (from outer to inner):

file
function     void FVoxelizeMeshMerging::CaptureCVars

Source code excerpt:

	// Allow CVars to be used.
	{
		int32 RayOrder                 = CVarProxyLODTransfer.GetValueOnGameThread();
		int32 DilationSteps            = CVarProxyLODMaxDilationSteps.GetValueOnGameThread();
		bool bAddChartColorVerts       = (CVarProxyLODChartColorVerts.GetValueOnGameThread() == 1);
		bool bUseTrueTangentSpace      = (CVarProxyLODUseTangentSpace.GetValueOnGameThread() == 1);
		bool bVoxelizeAndRemeshOnly    = (CVarProxyLODRemeshOnly.GetValueOnGameThread() == 1);
		bool bSingleThreadedSimplify   = (CVarProxyLODSingleThreadSimplify.GetValueOnAnyThread() == 1);
		bool bWallCorreciton           = (CVarProxyLODCorrectCollapsedWalls.GetValueOnGameThread() == 1);