RigLogic causes spikes when switching LODs (Metahuman face)

Hello,

Metahumans are cool and all, but when switching face LODs (and under other circumstances) it causes huge spikes in the RigLogic (~60ms on my machine). It usually only affects few faces within a frame, and in editor it is noticeable that it appears when the LODs switch (via distance or r.SkeletalMeshLodBias, doesn’t matter).

I also tried to force the LOD to some value, which “fixed” the issue completely in a simple test environment, but I see the same spikes when playing our game, maybe due to switching from invisible to visible state due to occlusion, I don’t know. It’s much better, but still not “perfect”, and I want to know what’s going on and ideally find a solution.

Using the profiler and some thought, I traced the issue down to the RigLogic node in the PostProcess-AnimBP (default from Quixel bridge), which is visible in the profiler (Unreal Frontend) as:

  • FParallelAnimationEvaluationTask
    • SkeletalMeshComponent…
      • PerformAnimEvaluation_WorkerThread
        • SkeletalComponentAnimEvaluate_WorkerThread
          • EvaluateAnimInstance_WorkerThread
            • EvaluateAnimGraph_WorkerThread
              • AnimNode_RigLogic_Evaluate_AnyThread
                • BlendPosesInGraph_WorkerThread
                  • ControlRig_UpdateInput (which takes more than 60ms on my machine)

The spike can also be seen using stat UnitGraph or Unreal Insights (but there it’s only the SkeletalMeshComponent itself).

Now comes the time for questions:

  1. Did anyone else encounter this? (How) did you work around that issue?

Baking animations, not using LODs, …?

  1. I know it is possible to bake control rig animation to the skeleton directly and thus get rid of the RigLogic node completely. However, this only works for a single LOD (the one we baked the animation for, or a weird selection, read below), some other LODs look broken. Do you have some idea?

If we would bake the animation to a single LOD that would mean that we are stuck with that LOD (see below), which is not great for performance and for scalability. For example, the animation only works for LOD2, but a machine will scale it to LOD4, and the animation wouldn’t work anymore.

Funnily enough, while baking, we noticed that:

  • LODs 4, 5, 6 and 7 are easy. Baked animations for LOD4 work for 5, 6 and 7, too.
  • An animation baked for LOD0 works on LODs 1, 4, 5, 6 and 7, but not on LODs 2 and 3.

LODs 2 and 3 look quite funny when previewing an animation with the bones visualized.

  1. How do you think are Metahumans meant to be used for games?

Are we supposed to only use LOD4 onward with baked animation? Are we supposed to use RigLogic for runtime? Sure, it would work for a single-character game where the player visits a fully abandoned world with no other characters. But we’re building a game with a few people in one place.

What are your thoughts?

For reference, I tested in UE 5.2 and 5.3. The PostProcessAnimBP is untouched and there’s no need for an animation asset or animation blueprint. The spikes also don’t appear when there’s no animation “running”, i. e. you have to PIE or simulate to cause them.

Thank you all,

sirjofri

1 Like

Update (in case someone encounters the same issues):

It seems that the culprit is not the RigLogic directly, but the ControlRig node labeled “Head Movement IK” in the PostProcess Animation Blueprint.

This node seems to move the head using IK towards some head control joint. We never use this (we use copy pose and do head rotation/aiming in the body blueprint). Removing this single control rig node seems to completely fix the heavy spikes.

With this change, the performance is “as expected” and stable.

It’s still a question what exactly causes these spikes. Is there some bug? Is the node there by accident? Does RigLogic somehow try to access curves that don’t exist? Who knows…

Hope this helps.

10 Likes

This also solved the issue for me. Thank you!

For anyone else looking, the ‘Head Movement IK’ node is in Face_PostProcess_AnimBP, and you can just remove it and connect the nodes either side of it directly to one another.

This eliminated my 60ms spikes from ControlRig_UpdateInput that could be seen on ‘stat anim’ when spinning the camera around near a metahuman.

1 Like