Hi
We are utilizing the Meta Human facial animation in our project.
We are currently looking to optimize our memory usage and we came acrosse an impressive amount of mem allocated to a nameless rig transform cache.
.exe!FRigReusableElementStorage<UE::Math::TTransform<double> >::Allocate - 96.13MB
.exe!`FMemory::Malloc\‘::`2\’::<lambda_1>::operator() - 82.18 MB
.exe!URigHierarchy::CopyHierarchy - 25.84 MB
I kind of assume it’s from the metahuman/DNA Rig anim system for the facial.
It would explain the nameless aspect of it.
Do we have any idea of what would cause this kind of memory usage? Is there a way to optimize metahuman faces to reduce it?
Hi, do you have a memory insights trace that you could share? Or even just a full call stack to see where that call to CopyHierarchy is coming from?
Copying the rig hierarchy can be an expensive operation - the more complex the hierarchy, the more memory is going to be required and the longer the operation is going to take. So the general way to optimize that is to reduce the complexity of the rig hierarchy. Or possibly run at a reduced mesh LOD that has fewer bones & curves, and so could use a control rig with a reduced hierarchy. But that’ll impact on fidelity which is why I’d be curious to see exactly where that call is coming from to see if there is anything else that can be done.
Hi thanks for your answer.
Once I get a bit of time I’ll send the insight/callstack.
We already are looking into reducing the hierarchy, hopefully it will reduce the memory weight to a manageable amount.
Thank you again.
Sure, I’ll keep this thread open for now in that case. It’ll auto-close in a few weeks, but you can always post again to keep it open (or open another thread).
I have some update, we are also using rig in animbp to do some procedural tweaking.
1- Rigs can be used within anim bp to do some procedural animation. from what I have gathered, nothing out of the extraordinary compare to action you can do within the animbp with componnent to local (Especially when it’s just corrective action for gameplay anim and not actual “RIGGING” for animation)
Since every rig seems to have an memory weight of 2mo or more, is it strongly suggested not to use it to do procedural animation tweaks?
2- Meta human faces requires a RIG in order to play animation from meta human associated curves, is there a way to make that rig more lightweight from a mem aspect or is there a way to compute the curves without Rig (Like a pose asset of some sort)?
Hi, control rigs can be pretty heavy in terms of memory usage. A lot of that is down to the rig hierarchy, so the more complex the hierarchy, the more memory you’re going to end up paying for.
In terms of your specific questions:
> Since every rig seems to have an memory weight of 2mo or more, is it strongly suggested not to use it to do procedural animation tweaks?
This is always going to be a balance between fidelity and performance. Control rig gives you more freedom to manipulate individual bones than you have in an anim bp but, as you’ve seen, control rigs can become expensive both in terms of memory and performance. From a performance point of view, we often recommend disabling execution of a CR when running with LODs at lower detail. But it’s more difficult with memory usage since you’ll either have the control rig loaded or not. You can improve memory usage with control rigs by making sure that the rig hierarchy only contains what you actually need - if there are extra bones, curves, controls, etc, that aren’t required in the hierarchy, you’ll be paying a cost for them in both memory and performance.
> Meta human faces requires a RIG in order to play animation from meta human associated curves, is there a way to make that rig more lightweight from a mem aspect or is there a way to compute the curves without Rig (Like a pose asset of some sort)?
Which of the control rigs were you talking about specifically here? If you aren’t using facial animation generated from MH Animator, you can actually just remove the Head Movement IK control rig from the Face_PostProcess anim bp entirely since it’s only used to apply head movement from MH animator animations. So that might be one option. Even if you do need to use that control rig, you can simplify it like I mentioned above - it contains the whole facial skeleton but, as far as I’m aware, doesn’t actually operate on any of the facial bones so those can potentially be removed.