"Bake Action" breaks on FBX export

So i made an eye using rigify’s “rigify.stretchy_chain” , everything seemed good and i made a test blink animation (as seen in the first gif).
I use a similar pipeline that CGDive uses (“control_rig” is the armature with the riggify controls , “game_rig” is the armature copying it using copy constraints) so i make the animation on the control rig , then bake it onto the game rig.
Blink_blend_file

Now here’s where the issue starts i think, i start the FBX export (with the settings in the screenshot)

and then when import it back (either in unity or blender itself) it makes the bones rotate and scale (also as seen in the gif).
Blink_fbx_file

I’m at a loss as to how to solve this, i scoured most forums hinting at a solution and so far nothing worked , i can share the .blend file too if someone is kind enough to take a deeper look , thanks !

Blend file download link

Welcome!

After exporting and reimporting this rig, I see some of the bones look visibly stretched. This makes me think there is a scaling problem, not a rotation problem. I am not certain, but it looks like the bones are getting scaled unevenly by the constraints and the animation baking process either can’t fully capture this or is mapping those scalings wrong. I have no idea how this could be fixed though, except for rigging this differently. Couldn’t the blink be done with shape keys?

2 Likes

Thanks for the response!

Seems like a scaling problem to me too , as if each bone scales its child bone too while ignoring how it’s actually animated in the baking result, i even tried to set “inherit scale” to “None” but still nothing, and exporting to gltf gives the same issue so it’s unlikely that it’s an export issue as well, something seems to happen when baked action are processed for export.

I might try to fix it differently and flatten the bone hierarchy, but that kinda sucks since i was hoping to do it in a way that works with “rigify” since “rigify.stretchy_chain” requires the bones to be a sequence of child bones.

I settled for shape keys for now, but was hoping to get it working with bone animation since that way still gives me full control over the bones in engine and allows me to do some procedural animation for the eyelids (to add a wink on top of the blink animation for example)

1 Like

By the way, this isn’t related to the problem, but I noticed in your file that the character’s body and eyebrows have their geometry duplicated and superposed many times onto itself.

If you haven’t noticed this already, you might want to give those objects a merge by distance to clean that. I am assuming this isn’t intended?

1 Like

Oh yeah definitely not intended, the geometry issue is fixed already (in my current file) , the .blend file i attached is before the fixes were done

1 Like

I ended up flattening the hierarchy of the eye lid bones and that solved it , it still had some slight artifacts compared to the result in blender but it will do for now.

Solution:
if you have bones that get squished and stretched and you absolutely need to have them , make sure each squished bone :

  • is a leaf bone
  • has 0 scaled parents (meaning all the parents until you reach the root bone are non-stretching bones)

Explanation:

  • Bones in blender get manipulated using (head-tail-roll-etc…) , once they get exported, bones have to be reduced to a “common representation” that is understood by other applications which is “matrices”.
  • When blender deals with bones, it does the corrective measures like keeping (uniform offset , keeping child bone’s size when parent bone length changes) to make sure working with bones “correct”
  • the moment the action gets baked to FBX , all that context is lost and everything turns back to matrices , even if your scale is always (1,1,1) , bone length changes become bone scale changes
  • And since matrices use parent-child scaling (where child final scale = local child scale * global parent scale) , each squished bone will cause a cascade of child bones getting scaled by their parent.
1 Like