Is there a way to bake deformer graph animations in level sequencer into an animation sequence

I have a squash and stretch deformer graph on a control rig I am testing. Everything works in the control rig editor and the level sequence, but when I bake to an animation sequence none of the deformer graph animations are baked. I am lost on how to setup the backwards solve so that the bones get animated by the deformer graph values. Are deformer graphs able to bake to animation sequences to be used for games or am I misunderstanding the feature.
Anyone else try this with any luck?

Any help is appreciated.

I also wanted to ask the same. Thank you for asking.

1 Like

Sigh, someone asked the very question I’ve been hunting for an answer to, and lo and behold…nothing. I appreciate you asking @jakesjordan of course but I’m guessing we won’t be holding our collective breaths! :smiley:

Cheers guys

To be clear, baking is not ‘my’ intended end-goal, that would largely defeat the purpose of runtime deformers, but rather how to use a Deformer Graph during gameplay, and have it with triggered either by say an Anim Notify or fired off in Control Rig.

A modest nudge in the right direction would be invaluable!

Thank you so much for the question! Sorry for the delayed response!

At the moment, AnimSequence / Animation runtime systems only serialize and processes bone transforms and curve values and they do not know the existence of deformers, therefore you will need to manually setup your rig/deformer graph to be driven by bones transforms & curves for it to play nicely with the animation system. We are actively looking for ways to simplify the process but for now it still requires a bit of manual work.

There are three ways you can push Gameplay/Animation data into a deformer graph.

  1. (New in 5.5, most flexible setup) If you have a control rig anim node in your AnimBP (usually the PostProcessAnimBP), you should be able to add a deformer to your character via the “Add Deformer” control rig node in your forward solve event. Once you assign a Deformer Graph asset to the node, you can right click its node title and select “Refresh variables” to populate the “Add Deformer” node with Deformer Graph variables. From there you should be able to drive any deformer graph variables using things control rig offers. (Check out Deformer Rigs in the content folder of “Animator Kit” plugin, they serve as simple examples for how this node can be used.) In particular, you can wire bone transforms/curve values to the variable pins of the “Add Deformer” node such that bone transforms coming from an AnimSequence can be used to drive custom deformation.
    Note: with this setup, you will likely need two rigs for your character, one is your typical animation rig that uses colorful controls to drive bone transforms, and the other is this “runtime rig” that uses bone transforms to drive deformer graph variables. The animation rig is typically used on-demand in sequencer, while the runtime rig is usually active and running all the time on the character.
  2. You can also use Animation Attribute related nodes in control rig and deformer graph to pass data from control rig to deformer graph. Typically, you likely want to use the SetAnimAttribute node in control rig and the Animation Attribute data interface node in Deformer Graph.
  3. You can access the mesh deformer you assigned to your skeletal mesh component from BP via the GetMeshDeformerInstance API. The MeshDeformerInstance object you received this way has to then be casted to a OptimusDeformerInstance object for you to be able to access SetVariable APIs

Hope this helps and happy to go into more details if needed!

Thank you for giving Deformer Graph a try!

Jack

It’s been a while since I looked at this, but I tried to figure things out based on what you wrote. I already have the deformer graph in my control rig and am able to squash and stretch my model fine and after messing around today I was able to set the values for my squash and stretch in my blueprint and it worked. That is cool, but it was not what I was looking for in this project. I was wanting to artistically hand author animations using these deformer graphs and then use those animations in my game.

In particular, you can wire bone transforms/curve values to the variable pins of the “Add Deformer” node such that bone transforms coming from an AnimSequence can be used to drive custom deformation.

this makes me think it still may be possible, but I do not know how to do this. I feel like that was kinda my question. The deformer graphs you pointed me too didn’t seem to be doing this either.

I’m not sure if I just don’t understand some of what you are saying or if I was miss-understood, but I hope I was more clear here.

I appreciate you reaching out.

Happy to dive into more details!

For the setup I was describing, you will need two rigs, an animation rig and a post process rig.
The animation rig would be a rig that uses controls to drive bone transforms and you only use the rig to create animation sequences. Once you bake things down to an animation sequence, the animation rig is no longer needed so you don’t want to put deformers in this rig.


The post process rig would be a rig that lives in the PostProcessAnimBp (so it always runs on the character) and uses the bone transforms to drive deformer variables.

One implication of this setup is that you might need to add additional unweighted bones to your character to be used to drive deformers.

Hope this helps!

/Jack

Hey Jack, thank you for the follow up!
I think I better understand this setup now. I’m going to mess around with this tonight and tomorrow and respond with how it goes and any questions. Thanks again for helping me out :+1:

1 Like

So I’ve been trying to figure this out and I think I’m still missing some pieces. I have added a squashstretch bone and have a setup similar to what you showed me. It makes sense I think conceptually, but I am unable to see any deformation happening when moving that bone. If I just change the value of the squash factor it works but connecting my bone transform to the deformer then controlling that bone with an animation rig doesn’t work for me. I have setup my ABP to be a post process animation blueprint and I have that post process control rig connected to my that animation blueprint. I was hoping not to have to respond empty handed, but I think I’m running in circles now.

Here’s a few screenshots of my stuff. If you can help point me in the right direction that would be great.

Thanks again for helping me out.





In your postprocess AnimBP, could you try adding a “InputPose” node and connect it to the control rig node?

Oh man that was it. that’s awesome! I have deformations working on my animation rig now and can then author animations by hand and baking them to an animation sequence successfully keeps the deformations. I get that you are all still working on this, but to have it working is still really awesome. I was just starting to feel like it wasn’t going to work out and then it did. That’s a pretty awesome parallel to some personal stuff in my life that I am going through.

Thanks for reaching out and helping me figure this out. I really appreciate it!

Nice! Glad to help!

1 Like

Hey so trying something similar to what you are doing
i made the exact same deformer graph as you did for a sphere
followed this tutorial for making a deformer graph

Now the thing is that I can’t see any preview changes in my mesh while changing any variable values in the deformer graph thought this was a bug or something so tried the deformer in a control rig too
and still couldn’t see any changes made to the mesh
again i tried using constants over variable knew that wouldn’t make a difference but still tried

the skeletal mesh i have is similar to what you have - A root bone in the center and a squashNstretch bone above the rootbone at the edge of the sphere

this is the deformer graph

just what i am missing ?

@EXPEL03 There are a few things we can try to get an idea of what is going on here.

  1. with this deformer graph, if you move the bones, does regular bone skinning work?
  2. if it doesn’t work, exclude the squash node from the graph, and wire LBS directly to compute normals and see if that works.
  3. Is your editor running dx11 or dx12, assuming you are on windows? You can check this by hovering your mouse over the project title to the left of the minimize button in your main window.

Hope this can help isolate the issue.

Jack

Hey Jack thanks for the reply

1 - tested this so in the ctrl rig without adding the add deformer node the regular skinning works
It doesn’t work when adding it to the rig
2 - did as you said and then testing from control rig
the regular skinning doesn’t work
3 - it is running on dx12

also some context if it helps
for the skeletal mesh I duplicated the engine’s default sphere itself
generated a staticmesh from that and added the bones from the editor itself

here is the control rig

Hey @EXPEL03. I’m not super sure what’s causing yours not to work. I do wonder if the deformer graph needs to be at the end of the forwards solve and not at the beginning.

Anyway I decided to just run through it to where you are and take some notes in hopes that it helps.

NOTES ON DEFORMER GRAPH SETUP:
I just made a ball in the modeling tools and then create a skeletal mesh asset from that to add bones

here is my setup

here my body bone can rotate the mesh in place and the root bone still can control the entire balls position and rotation from the base of the mesh
the squashandstretch bone doesn’t have any weights


my deformer graph looks to be the same as yours

so then I made ctrl rig from my skeletal mesh and set it up like this

no squash and stretch yet. Just make sure that the rig works. I can rotate the ball from the body in place and still move and rotate the root from it’s origin.


at this point if I put the add deformer to the end of my forward solve I am able to see changes in the viewport when I update the variables.



My ball has a radius 50 so the length to deform is set to 100 so that I get it to stretch from the center of the mesh.

I think making sure this works is probably a good start.

To sum it up
Make the mesh add the bones and weights and make sure they work as you expect in the skeletal view.
Make the control rig and set it up making sure that your controls now act as expected to control the mesh

make the deformer graph

add it to the end of the forward solve and at this point the values on the deformer graph node should start making changes.

Yeah the first thing I noticed is that the length to deform variable pin on the add deformer node is set to 0, which basically turns off the squash deformer since there is nothing to deform, something like 100 might make sense and from there you can then tweak the factor pin.

Another thing you can try is double click the node title of squashstretch deformer node and it should open up a deformer graph asset called dg_function_squashstretch, and if you use your sphere mesh as the preview mesh in the preview scene settings, does it show deformation in the viewport? Also if you go to the update graph in the same asset, there should be an example graph setup.

And thanks @jakesjordan for the detailed steps! Pretty much exactly how it is expected be setup. The add deformer node simply first collects variable values during rig forward solve and separately at render time(unrelated to rig solve) use those variable values to drive deformation.

Hey @jakesjordan thanks for the reply really appreciate it
so now i replicated what you did from scratch
made the sphere → added the bones → made sure control rig does work on the skeleton mesh and then added my deformer in the end
now changing the variables still doesn’t do anything also after add adding the deformer
my control rig now doesn’t do anything to the sphere too

Now I tried setting the preview mesh in the plugin asset DG_function_SquashStretch as
@Jack.Cai pointed out and i could see the deformation on the mesh
so i tried something out
i duplicated the plugin asset
and in the update graph instead of using constants which was the case in the asset’s update graph i tried using variables and removed the constants

manipulating the variables doesn’t deform the sphere

if i try the same asset with constants
i do get the deformation

now weirdly enough when i try using constants with the deformation graph that i made in the first place changing the weightmap value makes the sphere really small i can see it scaling down when i slide the weight map constant towards zero

after this i really don’t understand why doing it with variables is not affecting the graph in either cases

Either it is a bug or i am just doing something wrong which i can’t seem to understand

also out of curiosity what weight did you assign to the body bone if it affects the deformation graph
(i don’t know just trying to find a relation here with the problem )

also do let me know if i can send some more information through my side
thanks

The fact that the duplicated asset with constants works for you is a good sign.

Forget about the control rig for now, if you just add a single variable to the deformer graph like this, do you see similar deformation? Note that currently every time you change the variable value in the deformer graph editor you will need to hit compile again as live update hasn’t been implemented for variables.

Hey @EXPEL03 I think trying what @Jack.Cai mentioned is the best way to go. I just wanted to chime in and let you know how I weighted my bones. Just incase it helps.

so I flood filled the entire mesh with the body bone selected and clicked replace with it set to 1 so my body bone is fully weighted to the mesh and all other bones are not. (Root 0, Body 1)


after copying the DG_Function_SquashStretch, previewing my mesh in it and then creating a float variable (StretchFactor) and connecting it to the stretch factor constant. I am able to see deformations on my mesh when I change the variable and hit compile.

I hope this is helpful.