FX.Trail.MaxTangentTessellation
FX.Trail.MaxTangentTessellation
#Overview
name: FX.Trail.MaxTangentTessellation
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Maximum tessellation steps allowed for tangent based tessellation.
It is referenced in 5
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of FX.Trail.MaxTangentTessellation is to control the maximum number of tessellation steps allowed for tangent-based tessellation in particle trail effects. This setting is part of the Unreal Engine’s particle system, specifically for trail effects.
This setting variable is primarily used in the Engine module, particularly in the particle system’s trail emitter implementations. It’s referenced in the ParticleTrail2EmitterInstance.cpp file, which suggests it’s crucial for particle trail rendering.
The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through the console. This allows for easy tweaking and debugging of trail effects.
FX.Trail.MaxTangentTessellation interacts closely with another variable, MaxTangentTessellation. They share the same value and are used interchangeably in the code. There’s also a related variable, FX.Trail.MaxDistanceTessellation, which controls tessellation based on distance.
Developers should be aware that this variable directly impacts the level of detail and performance of particle trail effects. Setting it too high might lead to performance issues, while setting it too low could result in visual artifacts or less smooth trails.
Best practices when using this variable include:
- Balancing visual quality with performance by finding the optimal tessellation value.
- Testing the effects with various values to ensure they look good across different scenarios.
- Considering the target hardware when setting this value, as lower-end devices might require lower tessellation limits.
Regarding the associated variable MaxTangentTessellation:
The purpose of MaxTangentTessellation is the same as FX.Trail.MaxTangentTessellation. It’s an internal representation of the console variable within the engine’s code.
This variable is used directly in the particle emitter instance calculations, specifically in the DetermineVertexAndTriangleCount functions for both ribbon and animated trail emitters. It’s used to clamp the number of tessellation steps based on tangent differences, ensuring that the tessellation doesn’t exceed a certain threshold.
The value of MaxTangentTessellation is set by the FX.Trail.MaxTangentTessellation console variable.
Developers should be aware that this variable is used in performance-critical sections of the particle system. Modifying it directly in code (rather than through the console variable) could lead to inconsistencies in behavior.
Best practices for MaxTangentTessellation include:
- Avoiding direct modification of this variable in code; instead, use the console variable for adjustments.
- When optimizing particle systems, consider this variable’s impact on both visual quality and performance.
- When debugging trail rendering issues, check both this variable and the console variable to ensure they’re set correctly.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleTrail2EmitterInstance.cpp:69
Scope (from outer to inner):
file
namespace FXConsoleVariables
Source code excerpt:
FAutoConsoleVariableRef CVarMaxTangentTessellation(
TEXT("FX.Trail.MaxTangentTessellation"),
MaxTangentTessellation,
TEXT("Maximum tessellation steps allowed for tangent based tessellation."),
ECVF_Default
);
}
#Associated Variable and Callsites
This variable is associated with another variable named MaxTangentTessellation
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleTrail2EmitterInstance.cpp:59
Scope (from outer to inner):
file
namespace FXConsoleVariables
Source code excerpt:
{
int32 MaxDistanceTessellation = MAX_TRAIL_INDICES;
int32 MaxTangentTessellation = MAX_TRAIL_INDICES;
FAutoConsoleVariableRef CVarMaxDistanceTessellation(
TEXT("FX.Trail.MaxDistanceTessellation"),
MaxDistanceTessellation,
TEXT("Maximum tessellation steps allowed for distance based tessellation."),
ECVF_Default
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleTrail2EmitterInstance.cpp:70
Scope (from outer to inner):
file
namespace FXConsoleVariables
Source code excerpt:
FAutoConsoleVariableRef CVarMaxTangentTessellation(
TEXT("FX.Trail.MaxTangentTessellation"),
MaxTangentTessellation,
TEXT("Maximum tessellation steps allowed for tangent based tessellation."),
ECVF_Default
);
}
/*-----------------------------------------------------------------------------
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleTrail2EmitterInstance.cpp:2544
Scope (from outer to inner):
file
function void FParticleRibbonEmitterInstance::DetermineVertexAndTriangleCount
Source code excerpt:
//@todo. Need to adjust the tangent diff count when the distance is REALLY small...
float TangDiff = CheckTangent * TrailTypeData->TangentTessellationScalar;
int32 InterpCount = FMath::Min(FMath::TruncToInt(DistDiff), FXConsoleVariables::MaxDistanceTessellation) + FMath::Min(FMath::TruncToInt(TangDiff), FXConsoleVariables::MaxTangentTessellation);
// There always is at least 1 point (the source particle itself)
InterpCount = (InterpCount > 0) ? InterpCount : 1;
// Store off the rendering interp count for this particle
CurrTrailData->RenderingInterpCount = InterpCount;
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Particles/ParticleTrail2EmitterInstance.cpp:3855
Scope (from outer to inner):
file
function void FParticleAnimTrailEmitterInstance::DetermineVertexAndTriangleCount
Source code excerpt:
}
float TangDiff = CheckTangent / TangentTessellationStepSize;
InterpCount += FMath::Min(FMath::TruncToInt(TangDiff), FXConsoleVariables::MaxTangentTessellation);
}
if( bApplyWidthTessellation )
{
//Alter the tessellation based on the change in the trail width.
float CheckWidth = FMath::Abs(CurrTrailData->Length - PrevTrailData->Length);