geometry.DynamicMesh.TextBasedDupeTriThreshold
geometry.DynamicMesh.TextBasedDupeTriThreshold
#Overview
name: geometry.DynamicMesh.TextBasedDupeTriThreshold
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Triangle count threshold for text-based UDynamicMesh duplication using Base64. Large values are quite slow.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of geometry.DynamicMesh.TextBasedDupeTriThreshold is to set a threshold for the number of triangles in a UDynamicMesh that determines whether text-based duplication using Base64 encoding should be used during the mesh export process.
This setting variable is primarily used in the Geometry Framework module of Unreal Engine 5, specifically within the UDynamicMesh class implementation.
The value of this variable is set through a console variable (CVar) system, with a default value of 1000 triangles. It can be modified at runtime or through configuration files.
The associated variable CVarDynamicMeshTextBasedDupeTriangleCountThreshold directly interacts with geometry.DynamicMesh.TextBasedDupeTriThreshold. They share the same value and purpose.
Developers must be aware that:
- This threshold affects the performance of mesh duplication and serialization.
- Larger threshold values can significantly slow down the duplication process for complex meshes.
- The variable is used in the ExportCustomProperties function of UDynamicMesh to determine the serialization method.
Best practices when using this variable include:
- Keep the threshold reasonably low (default 1000) for optimal performance.
- Adjust the value only when necessary, considering the trade-off between text-based representation and performance.
- Monitor performance when working with large meshes and adjust the threshold accordingly.
Regarding the associated variable CVarDynamicMeshTextBasedDupeTriangleCountThreshold:
- It is an internal representation of the geometry.DynamicMesh.TextBasedDupeTriThreshold console variable.
- It is used directly in the C++ code to access the current threshold value.
- Developers should use this variable when they need to programmatically check or use the threshold value within the engine’s C++ code.
- Best practices include using GetValueOnGameThread() when accessing the value to ensure thread-safety in game thread contexts.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/GeometryFramework/Private/UDynamicMesh.cpp:20
Scope: file
Source code excerpt:
// these cvars are used to support T3D encoding of the internal FDynamicMesh3, see ::ExportCustomProperties() and ::ImportCustomProperties()
static TAutoConsoleVariable<int32> CVarDynamicMeshTextBasedDupeTriangleCountThreshold(
TEXT("geometry.DynamicMesh.TextBasedDupeTriThreshold"),
1000,
TEXT("Triangle count threshold for text-based UDynamicMesh duplication using Base64. Large values are quite slow."));
static TAutoConsoleVariable<int32> CVarDynamicMeshDupeHelperTimeout(
TEXT("geometry.DynamicMesh.DupeStashTimeout"),
5*60,
TEXT("Timeout in seconds for references held by internal UDynamicMesh duplication helper system. See FDynamicMeshCopyHelper."));
#Loc: <Workspace>/Engine/Source/Runtime/GeometryFramework/Private/UDynamicMesh.cpp:434
Scope (from outer to inner):
file
function void UDynamicMesh::ExportCustomProperties
Source code excerpt:
//
// Obviously this does not work between Editor sessions. So we also optionally do a Base64 binary encoding if
// the mesh triangle count is below a CVar threshold (geometry.DynamicMesh.TextBasedDupeTriThreshold)
// defaulting to 1000. Larger meshes can be supported by increasing the CVar value if need be.
//
// If the mesh is not found in the FDynamicMeshCopyHelper, and is too large to text-copy, then instead
// of leaving an empty mesh, we emit a cube, as empty meshes can be problematic. A warning is also
// printed to the Output Log, pointing the user to the CVars.
//
#Associated Variable and Callsites
This variable is associated with another variable named CVarDynamicMeshTextBasedDupeTriangleCountThreshold
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/GeometryFramework/Private/UDynamicMesh.cpp:19
Scope: file
Source code excerpt:
// these cvars are used to support T3D encoding of the internal FDynamicMesh3, see ::ExportCustomProperties() and ::ImportCustomProperties()
static TAutoConsoleVariable<int32> CVarDynamicMeshTextBasedDupeTriangleCountThreshold(
TEXT("geometry.DynamicMesh.TextBasedDupeTriThreshold"),
1000,
TEXT("Triangle count threshold for text-based UDynamicMesh duplication using Base64. Large values are quite slow."));
static TAutoConsoleVariable<int32> CVarDynamicMeshDupeHelperTimeout(
TEXT("geometry.DynamicMesh.DupeStashTimeout"),
5*60,
#Loc: <Workspace>/Engine/Source/Runtime/GeometryFramework/Private/UDynamicMesh.cpp:452
Scope (from outer to inner):
file
function void UDynamicMesh::ExportCustomProperties
Source code excerpt:
Out.Logf(TEXT("MESHKEY=%d "), StashedKey);
if (Mesh->TriangleCount() < CVarDynamicMeshTextBasedDupeTriangleCountThreshold.GetValueOnGameThread())
{
// serialize our mesh
TArray<uint8> MeshWriteBuffer;
FMemoryWriter MemWriter(MeshWriteBuffer);
Mesh->Serialize(MemWriter);