ControlRig double initialization when transitionning between subsequences in Sequencer

Hello Epic Support,

We are currently investigating ways to reduce the overhead associated with Sequencer faceboard ControlRig tracks bound to MetaHuman actors.

While regular ControlRig evaluation performs well, shot transitions consistently exceed our frame budget and introduce noticeable hitches that negatively impact the perceived continuity of our cinematics. After profiling several transitions, ControlRig initialization appeared to be the primary contributor, so we performed a deeper analysis to understand the initialization cost and identify potential optimization opportunities.

Our tests are made using both the ControlRig EvalTemplate and MovieSceneEntitySystem. We use a vanilla UE_5.6.1 but looking at the code from UE_5.7.4 and UE_5.8.0-preview-1, it is very likely that our conclusion apply to these versions as well.

For a single faceboard ControlRig on a single MetaHuman in a Development (non-Editor) build, we measured the following costs during initialization:

  • `ControlRig->Initialize()` - ~1.5–2.0 ms
  • `ControlRig->RequestInit()` - negligible
  • `ControlRig->SetBoneInitialTransformsFromSkeletalMeshComponent(SkeletalMeshComponent, true)` - ~1.0 ms
  • `ControlRig->Evaluate_AnyThread()` - ~2.5 ms (primarily due to the Construction Event)
  • Control selection restoration - negligible

This results in a total initialization cost of approximately 5 ms per ControlRig. However, during our investigation, we noticed that this initialization sequence appears to be executed twice:

  1. Before `SavePreAnimatedState()` in `FControlRigParameterExecutionToken::Execute()` / `UMovieSceneControlRigParameterEvaluatorSystem::InitializeBaseRigComponent()`
  2. During `FControlRigBindingHelper::BindToSequencerInstance()`, when creating the `ControlRigLayerInstance` and adding the ControlRig as a new track.

As a result, when transitioning between shots containing several characters with faceboard ControlRig tracks, we observe a 20/30ms of work solely dedicated to ControlRig initialization. This makes shot transitions highly noticeable and can significantly affect the continuity of the sequence.

From our analysis, aside from saving PreAnimatedState data and registering the ControlRig onto the `ControlRigLayerInstance`, there does not appear to be any substantial processing performed on the initialized rig between these two initialization passes.

Our questions are:

  1. Is this double initialization expected and required for correctness, are we overlooking an important dependency?
  2. If it is not strictly required, would it be safe to modify or patch the Sequencer template/system implementation to avoid the second initialization?

Any guidance would be greatly appreciated.

Thank you.

Thomas VALLENTIN

[Attachment Removed]

Steps to Reproduce
How to reproduce :

  • Open the repro project
  • Load the Level : `/Game/ThirdPerson/Lvl_ThirdPerson`
  • Open the LevelSequence : `/Game/LS_Master`
  • Start a trace with “Stat Named Events” enabled
  • Hit play in Sequencer
  • Stop & open the recorded trace
  • Search for “STAT_ControlRig_Initialize” in the trace timers
  • We can see that despite each shot of the sequence contains only a single ControlRig track, the ControlRig is initialized and executed twice
    [Attachment Removed]

Hey there,

Just a heads up. I’m conferring with the team on this one. One thing that stands out is how high your initialization time is. How much of the hierarchy are you driving in the control rig? One way to optimize your control rig initialization times is to strip the bones from the hierarchy you aren’t operating on directly. You can do this by deleting the bones in the hierarchy panel in the control rig editor. Also, just so it’s state, we don’t typically recommend running a full control rig during runtime in sequencer. We recommend baking it down to the bones and only running control rig on procedurals.

Dustin

[Attachment Removed]

Hello Dustin,

We are mainly using ControlRigs to tweak some facial animations shot by shot using the Metahuman faceboard and to apply some similar fine tuning on our body animation using our body rig ControlRig.

Our facial animation workflow already relies on baking ControlRig sections into AnimSequences (similarily to what’s done in 5.8). I’ll try to see if we can apply a similar workflow on our body animation and if we can strip some bones from our ControlRigs.

However, I’m still interested in knowing more about that double initialization which could divide by two the initialization time, regardless on how heavy each ControlRig is.

Thank you for your time,

Thomas

[Attachment Removed]