r.MeshCardRepresentation.NormalTreshold
r.MeshCardRepresentation.NormalTreshold
#Overview
name: r.MeshCardRepresentation.NormalTreshold
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Normal treshold when surface elements should be clustered together.
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.MeshCardRepresentation.NormalTreshold is to set a threshold value for normal vectors when clustering surface elements together in mesh card representation. This setting is primarily used in the rendering system of Unreal Engine 5.
This setting variable is relied upon by the Engine module, specifically within the MeshCardRepresentation functionality. It’s defined and used in the MeshCardRepresentation.cpp file, which suggests it’s part of the mesh simplification or optimization process for rendering.
The value of this variable is set as a console variable with a default value of 0.25f. It can be modified at runtime through the console or configuration files.
The associated variable CVarCardRepresentation.NormalTreshold interacts directly with r.MeshCardRepresentation.NormalTreshold. It’s used to retrieve the value of the setting in the GetNormalTreshold() function.
Developers must be aware that this variable is marked as ECVF_ReadOnly, meaning it’s intended to be read-only during runtime. Changes to this value may not take effect immediately and might require a restart or recompilation.
Best practices when using this variable include:
- Only modify it if you understand its impact on mesh card representation and rendering performance.
- Use values between 0.0 and 1.0, as the GetNormalTreshold() function clamps the value to this range.
- Consider the performance implications of changing this value, as it affects how surface elements are clustered.
Regarding the associated variable CVarCardRepresentationNormalTreshold:
The purpose of CVarCardRepresentationNormalTreshold is to provide a programmatic interface to access and manage the r.MeshCardRepresentation.NormalTreshold setting.
This variable is part of the Engine module and is used within the MeshCardRepresentation system.
The value of this variable is set when the r.MeshCardRepresentation.NormalTreshold console variable is initialized.
It interacts directly with the r.MeshCardRepresentation.NormalTreshold setting and is used to retrieve its value in the GetNormalTreshold() function.
Developers should be aware that this variable is of type TAutoConsoleVariable
Best practices for using this variable include:
- Use the GetValueOnAnyThread() method to retrieve the current value safely from any thread.
- Don’t attempt to modify this variable directly; instead, change the r.MeshCardRepresentation.NormalTreshold console variable if needed.
- Be cautious when using this in performance-critical code, as accessing console variables can have some overhead.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/MeshCardRepresentation.cpp:55
Scope: file
Source code excerpt:
static TAutoConsoleVariable<float> CVarCardRepresentationNormalTreshold(
TEXT("r.MeshCardRepresentation.NormalTreshold"),
0.25f,
TEXT("Normal treshold when surface elements should be clustered together."),
ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarCardRepresentationDebug(
TEXT("r.MeshCardRepresentation.Debug"),
#Associated Variable and Callsites
This variable is associated with another variable named CVarCardRepresentationNormalTreshold
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/MeshCardRepresentation.cpp:54
Scope: file
Source code excerpt:
ECVF_ReadOnly);
static TAutoConsoleVariable<float> CVarCardRepresentationNormalTreshold(
TEXT("r.MeshCardRepresentation.NormalTreshold"),
0.25f,
TEXT("Normal treshold when surface elements should be clustered together."),
ECVF_ReadOnly);
static TAutoConsoleVariable<int32> CVarCardRepresentationDebug(
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/MeshCardRepresentation.cpp:79
Scope (from outer to inner):
file
function float MeshCardRepresentation::GetNormalTreshold
Source code excerpt:
float MeshCardRepresentation::GetNormalTreshold()
{
return FMath::Clamp(CVarCardRepresentationNormalTreshold.GetValueOnAnyThread(), 0.0f, 1.0f);
}
bool MeshCardRepresentation::IsDebugMode()
{
#if UE_BUILD_DEBUG || UE_BUILD_DEVELOPMENT
return CVarCardRepresentationDebug.GetValueOnAnyThread() != 0;