Download

|SOLVED| 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 made a post in the UE4 Answerhub and since then have talked to some of my lecturers at Uni who reckon it must be some information in the foot bone of the rig that is being stored in Blender but not being displayed. Then once it gets to Unreal it uses that information. In which case I will be importing these files into Maya, maybe some other 3D packages and run some more tests.

Your lecturers might be on to something there.
I had a similar issue on a squash/stretch rig in maya. Due to a rigging limitation I had to turn off segment scale compensation on some relevant bones. The rig hierarchy was disconnected and the boens werend children of the scaling bone, but connected via constraints. Once importing into the engine tho I obviously have to make the hierarchy into a single root. I forgot to turn on segment scale compensating tho after I did that and the respective bones flipped out in ue4 similarly to your leg there.

I had to make sure all bones in the export rig had their .segmentScaleCompensate attribute on and the input plug (.inverseScale) properly connected to the parent scale. Im not entirely sure how UE4 works with this particular aspect of skeletons, but I suggest to look in blender for a similar thing.

So after working on this on and off for many months now I have some some promising results. I have tried to emulate the default Unreal Engine Mannequin Skeleton to keep some consistency across the assets I am making. I created a deform skeleton and a control rig inside Blender, containing one squash and stretch bone in the torso. This was the result I was getting:

After reading more threads I saw Lina Halper mention a preserve local transform option in the import dialogue. I gave that a go and my result was this:

Notice the arms aren’t being broken by transforms inherited up the bone chain. I was over the moon when I imported this anim. But it was short lived as I found more issues, particularly when if I rotate the bone that sits above the squash and stretch bone. Results pictured here:

(If you have seen the new IT movie it starts to look like the spooky Woman with the Flute.)

This was a bummer. Unfortunately the skeleton also starts to experience problems if you have a squash and stretch chain, on an arm for example. I tested this with the Rigify Rig by stretching the arms. The hands began inheriting unwanted transforms again.

In any case I am still determined to get this to work. I have been messaging one of the Tech Animators at Epic to see if there is anything they can figure. I have thought to contact Lina too because she is the source of all animation knowledge haha, but I figure the folks at Epic are busy people so I will keep chipping away. Hopefully someone will be able to give me a hand either here, or if anyone wants to contact me my twitter handle is @SamBattz](https://twitter.com/SamBattz).

I have posted this update on other forums, thinking of starting a new thread with more clarity in the title.

Thanks for reading :slight_smile:

-|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](https://twitter.com/cyaoeu) 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!!