r.ProxyLODUseTangentSpace
r.ProxyLODUseTangentSpace
#Overview
name: r.ProxyLODUseTangentSpace
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Shall the ProxyLOD system generate a true tangent space at each vertex0: world space at each vertex\n1: tangent space at each vertex (default)
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.ProxyLODUseTangentSpace is to control the generation of tangent space for vertices in the ProxyLOD system, which is part of Unreal Engine’s Level of Detail (LOD) optimization for 3D models.
This setting variable is primarily used by the ProxyLOD plugin, which is part of Unreal Engine’s editor tools for optimizing 3D models. The plugin is located in the Engine/Plugins/Editor/ProxyLODPlugin directory.
The value of this variable is set using a console variable (CVar) system. It’s initialized with a default value of 1, meaning tangent space generation at each vertex is enabled by default.
The associated variable CVarProxyLODUseTangentSpace directly interacts with r.ProxyLODUseTangentSpace. They share the same value and purpose.
Developers must be aware that this variable affects the way normal maps are encoded in the ProxyLOD system. When set to 0, it uses world space alignment at each vertex instead of true tangent space.
Best practices when using this variable include:
- Keep it at the default value (1) unless there’s a specific need for world space alignment.
- If changing this value, ensure that any normal maps or shaders relying on tangent space are adjusted accordingly.
- Test the visual impact of changing this setting, especially on models with complex surface details.
Regarding the associated variable CVarProxyLODUseTangentSpace:
Its purpose is identical to r.ProxyLODUseTangentSpace, serving as the actual console variable that controls the tangent space generation setting.
It’s used within the ProxyLOD plugin, specifically in the FVoxelizeMeshMerging class, which is likely responsible for the mesh simplification process.
The value is set at initialization and can be changed at runtime through console commands.
It interacts directly with r.ProxyLODUseTangentSpace and is used to retrieve the current setting value in the CaptureCVars() function.
Developers should be aware that this variable’s value is accessed on the game thread, which could have performance implications if queried frequently.
Best practices include:
- Cache the value if it’s needed frequently, rather than querying it each frame.
- Consider the threading implications when accessing this value, especially in performance-critical code paths.
- Use this variable in conjunction with other ProxyLOD settings for optimal results in mesh simplification tasks.
#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:85
Scope: file
Source code excerpt:
// a default wold-space aligned tangent space.
static TAutoConsoleVariable<int32> CVarProxyLODUseTangentSpace(
TEXT("r.ProxyLODUseTangentSpace"),
1,
TEXT("Shall the ProxyLOD system generate a true tangent space at each vertex")
TEXT("0: world space at each vertex\n")
TEXT("1: tangent space at each vertex (default)"),
ECVF_Default);
#Associated Variable and Callsites
This variable is associated with another variable named CVarProxyLODUseTangentSpace
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/Editor/ProxyLODPlugin/Source/ProxyLOD/Private/ProxyLODPlugin.cpp:84
Scope: file
Source code excerpt:
// Testing tangent space encoding of normal maps by optionally using
// a default wold-space aligned tangent space.
static TAutoConsoleVariable<int32> CVarProxyLODUseTangentSpace(
TEXT("r.ProxyLODUseTangentSpace"),
1,
TEXT("Shall the ProxyLOD system generate a true tangent space at each vertex")
TEXT("0: world space at each vertex\n")
TEXT("1: tangent space at each vertex (default)"),
ECVF_Default);
#Loc: <Workspace>/Engine/Plugins/Editor/ProxyLODPlugin/Source/ProxyLOD/Private/ProxyLODPlugin.cpp:417
Scope (from outer to inner):
file
function void FVoxelizeMeshMerging::CaptureCVars
Source code excerpt:
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);
// set values - note, this class is a global (singleton) instance.
this->RayHitOrder = RayOrder;