a.URO.ForceInterpolation
a.URO.ForceInterpolation
#Overview
name: a.URO.ForceInterpolation
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Set to 1 to force interpolation
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of a.URO.ForceInterpolation is to control the interpolation behavior in the Animation Update Rate Optimization (URO) system within Unreal Engine’s animation subsystem. This setting variable is used to force interpolation between animation frames, which can affect the smoothness and performance of character animations.
This setting variable is primarily used by the Engine’s animation system, specifically within the SkinnedMeshComponent and the AnimUpdateRateManager. These are core components of Unreal Engine’s animation pipeline.
The value of this variable is set through a console variable (CVar) system, which allows for runtime configuration. It’s defined as a TAutoConsoleVariable with an initial value of 0, meaning interpolation is not forced by default.
The associated variable CVarForceInterpolation directly interacts with a.URO.ForceInterpolation. They share the same value and purpose, with CVarForceInterpolation being the C++ representation of the console variable.
Developers must be aware that setting this variable to 1 will force interpolation for all skinned mesh components, potentially affecting performance and animation quality across the entire game. It’s a global setting that overrides individual component settings.
Best practices when using this variable include:
- Use it primarily for debugging or testing purposes.
- Be cautious about enabling it in a shipping build, as it may have performance implications.
- Consider the trade-off between animation smoothness and performance when enabling forced interpolation.
Regarding the associated variable CVarForceInterpolation:
The purpose of CVarForceInterpolation is to provide a C++ interface to the a.URO.ForceInterpolation console variable. It allows the engine code to read and react to changes in the interpolation forcing setting.
This variable is used within the FAnimUpdateRateParameters::SetTrailMode function, which is part of the animation update rate optimization system. It’s checked alongside other conditions to determine whether frame interpolation should occur.
The value of CVarForceInterpolation is set through the console variable system and can be accessed in C++ code using the GetValueOnAnyThread() method.
CVarForceInterpolation interacts closely with CVarURODisableInterpolation, another console variable that can disable interpolation. The logic considers both variables when determining the final interpolation behavior.
Developers should be aware that this variable is read on potentially any thread, as indicated by the use of GetValueOnAnyThread(). This means changes to the variable can affect multiple systems concurrently.
Best practices for using CVarForceInterpolation include:
- Use it in conjunction with other animation update rate optimization settings for fine-tuned control.
- Be mindful of its performance impact, especially when forcing interpolation in performance-critical scenarios.
- Consider using it as part of a larger animation debugging or profiling strategy.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkinnedMeshComponent.cpp:207
Scope (from outer to inner):
file
namespace FAnimUpdateRateManager
Source code excerpt:
static TAutoConsoleVariable<int32> CVarForceInterpolation(
TEXT("a.URO.ForceInterpolation"),
0,
TEXT("Set to 1 to force interpolation"));
static TAutoConsoleVariable<int32> CVarURODisableInterpolation(
TEXT("a.URO.DisableInterpolation"),
0,
#Associated Variable and Callsites
This variable is associated with another variable named CVarForceInterpolation
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkinnedMeshComponent.cpp:206
Scope (from outer to inner):
file
namespace FAnimUpdateRateManager
Source code excerpt:
TEXT("Non-zero to force anim rate. 10 = eval anim every ten frames for those meshes that can do it. In some cases a frame is considered to be 30fps."));
static TAutoConsoleVariable<int32> CVarForceInterpolation(
TEXT("a.URO.ForceInterpolation"),
0,
TEXT("Set to 1 to force interpolation"));
static TAutoConsoleVariable<int32> CVarURODisableInterpolation(
TEXT("a.URO.DisableInterpolation"),
#Loc: <Workspace>/Engine/Source/Runtime/Engine/Private/Components/SkinnedMeshComponent.cpp:5090
Scope (from outer to inner):
file
function void FAnimUpdateRateParameters::SetTrailMode
Source code excerpt:
EvaluationRate = FMath::Max((NewEvaluationRate / UpdateRate) * UpdateRate, 1);
bInterpolateSkippedFrames = (FAnimUpdateRateManager::CVarURODisableInterpolation.GetValueOnAnyThread() == 0) &&
((bNewInterpSkippedFrames && (EvaluationRate < MaxEvalRateForInterpolation)) || (FAnimUpdateRateManager::CVarForceInterpolation.GetValueOnAnyThread() == 1));
// Make sure we don't overflow. we don't need very large numbers.
const uint32 Counter = (GFrameCounter + UpdateRateShift) % MAX_uint32;
bSkipUpdate = ((Counter % UpdateRate) > 0);
bSkipEvaluation = ((Counter % EvaluationRate) > 0);