Blender to UE4: Squash and Stretch Bone Heirarchy Scaling

Hello,

I have been having an issue with getting a squash and stretch rig to behave correctly in UE4 (version 4.10 and 4.12) after exporting from Blender v2.76. Particularly the issue is that the child bones for a character skeleton inherit the scale of the squash and stretch bones. As you can see here:

The setup is two stretchy bones in the leg then two non-stretchy bones in the foot, then there are some extra bones to form a pelvis and root bone. What is odd is that the foot bone appears to be inheriting the scale of the stretching shin bone.

Originally I created a simpler squash and stretch rig with one stretchy bone weighted to the cube and one non-stretchy child bone weighted to the sphere, shown below:

In this case however the child does not inherit the scale, so I am not sure why the leg behaves the way it does.

I have a feeling this is an issue to do with the IK setup on the leg. From other threads I have browsed it seems this seems to be an issue on the Blender export side of things. But perhaps there is a way to stop bones inheriting the scale values of parent bones inside Unreal?

If anyone has some advice on how to solve this I would be very grateful. Thank you.

[NOTE] I have posted this issue to Unreal Forums and since then have talked to my lecturers at Uni who think this is definitely an export issue and that the foot bones are storing some transform information that is not being displayed in Blender but when in Unreal the engine accounts for that. In which case I will run some tests and import these files into some other 3D packages and see what I get.

To be honest, I’m not even sure if that property of detached scaling is even a part of the fbx specification, and if not, well it could very easily be a baking oversight in Blender upon export.

There are two ways I know to take care of this. The first way is to design the rig so that all the deform bones have a full inheritance parent-child relationship. Then animate using non-deforming control bones and use copy scale constraints and stuff to modify the deform bones appropriately. When it comes time to export, create a second copy of the blend file and bake all actions and delete the control bones. The baking will automatically set the scaling correct with respect to the scaled parent.

The second way would be to generate a UI tool in Unreal (I’m a Unity guy, so don’t ask me how to do this) that on import allows bones to be specified as not inheriting scale. Then every frame, divide the scale of the child by the scale of the parent for each bone specified from that UI tool, and recalculate other relationships accordingly.

The first way would be the correct way in general but the second way could be a project saver at the cost of performance for the extra calculations (which may or may not be negligible).

Best of luck!

Exactly : not inheriting scale is a Blender thing. Try disconnecting the foot from the leg hierarchy, use constraints instead, that should work better.

@Dreaming381 Ill have to look more into how to bake animations in Blender. Most of my attempts thus far have yielded strange results. I have made another rig which has one armature dedicated to deformation and a separate armature for controlling the IK and Stretch constraints.

I then used copy transform constraints to get the deformation rig to behave they way I thought it would, although this result was the same. My control rig operated the way Hadriscus suggested:

I will look into how the deform bones should inherit the transforms of the control rig, because I’m not sure of the best way to do this.

As far as the game rig goes I cannot disconnect the foot from the leg because the engine requires that the bones be parented in a chain for other aspects to work. I did try disconnecting the foot bone and this worked perfectly but as I mentioned it is not ideal for Unreal.

I will try again with the control rig setup, if you have any suggestions for baking the animations down to the deform rig, or point me in the direction of some documentation I would be would really appreciate that.

Once a solution is found I am going to make some kind of document or tutorial on how to achieve this effect.

Thanks for the replies :smiley:

Hi Battz, I’ve been having this same issue. Did you find a way to get it working? Thanks.

I thank God for showing me the solution! All you have to do is add a “false foot” bone that is NOT a deform bone to each leg. I named this bone FootParent.

Connect this bone to the Lower_Leg bone (which has an IK constraint). Set FootParent’s Inherit Rotation and Inherit Scale to off, and add a Copy Rotation constraint which copies your Foot_IK bone (X + Y invert, Target: Local With Parent, Owner: Local).

Now duplicate this FootParent bone (or add a new one in the exact same location and orientation) and name it Foot. This will be your deform bone, and is NOT connected to anything.

Finally add 3 constraints to your Foot bone: Copy Location of the FootParent bone (Target: Local With Parent, Owner: Local); Copy Rotation of your Foot_IK bone (X + Y invert, Target: Local With Parent, Owner: Local), and optionally Copy Scale of your Foot_IK bone (Target: Local, Owner: Local). Now all your animations will export to FBX the way you created them in Blender!

Hi Copperplate, I was coming back to this problem after a few months break from it and updating my other forum posts on the subject.

From what I gather your solution is to disconnect the bones at the end of the squash and stretch chain, is that correct?

That way the bones no longer inherit anything from the stretchy bones because they are no longer children of those bones. As I mentioned in a previous post I have disconnected the foot bones from the leg hierarchy to force them to no longer inherit transforms. I am starting to think this may be the only solution at the moment, however it is not ideal for a game skeleton, but hey if it creates the desired effect it might be worth a shot.

My main concern with disconnecting the bones like that is how it will affect Physics Assets, but perhaps it can be solved with constraints in the physics asset tool.

Thanks for your reply :slight_smile:

Hi Battz, you’re welcome, and thanks for updating your posts; I saw your UE4 Answerhub post too, I did not know about the “Preserve Local Transform” option. It’s been a while since I last made that squash and stretch rig, so admittedly, my post above looks a bit like another language… :slight_smile: However, I wrote it out exactly as I made it, so it should work. The main thing is the Foot bones are separated and have no parents, but use 3 constraints to inherit motion. The Foot Parent bones ARE connected, however. I have not tried this setup with an IK foot snapping setup in UE4, so I don’t know how that would work. You’d likely have to apply it to the Foot Parent bones, and then add some kind of Copy Transform ability to the Foot bones inside the Animation BP. I just checked Show Collision in game on the auto-generated Physics Asset and the foot capsules follow the feet perfectly, I didn’t have to do any special setup at all.

I hope this helps!

-Adam

Although, if you’re doing a ragdoll rig, then yes, you will definitely have to use constraints as the feet will fall off… :slight_smile:

Thanks for replying so quickly.

I have a few more tests I want to run, because I an using a deform rig and a control rig setup I thought perhaps if on the Non-stretchy bones I use copy rotate and copy location constraints as opposed to my current copy transform constraints I might be able to export the bones without any scale information and leave the scale only on my stretchy bones. I am going to test that today and see where that gets me.

I was wondering though if you might be willing to upload your Squash and Stretch setup so that I might learn from it? If you don’t mind/are able to share the file I would really appreciate some further insight.

Thanks

-Battz

p.s. I cant upload the gifs but if anyone is here wondering what the issue is currently I cannot have a skeletal mesh scale non uniformly and rotate, as the results look like this:


You can find more examples on this in threads I have made with the same name on the Unreal Forums and Unreal Answerhub.

Hi Battz, I will send you the simple rig in a PM. It doesn’t feature any arms, but you’ll be able to see the general setup.

-|SOLVED|-

We have found a solution! The solution discovered is to use constraints inside the 4.17 Animation Graph to copy the ideal scale from one bone to the offending bones.

For example say you have a stretchy spine_01 bone and you want the spine_02 bone to maintain its one to one scale. Apply a constraint to your spine_02 bone and copy the scale of a bone that holds a scale of one.

In an ideal scenario you would export an extra control bone that holds the correct transforms of your spine_02 bone and use that as your constraint.

Here is the result of the Squash and Stretch Rig!

And here is the constraint setup in the animation graph.

In this example I have a constraint node for the spine_02 bone and the head, I have set these nodes to constrain their scale values to the root since the root will always have a scale of one.

Big thank you to Lina Halper for implementing the constraints to make this work, and thank you to @Cyaeou for helping me figure out how they work.

I’m so excited to have this working and I cant wait to get animating with it!!