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?
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!
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.
(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.
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.
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!
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.
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.
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
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.
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!