Rigify horse rig to Unity problem

Hi, I’m working on a horse model for which I’ve rigged using Rigify horse rig and done some animations. On Blender everything is fine and animations play correctly, but when I carry them to Unity I get horrible spine deformations. I’ve discovered that those deformations are actually caused by tail animation that affects the rest of the spine, even hips rotation affects it. So it looks like it has something to do on how Blender bakes current animation of helper and IK bones to deform bones, but I don’t know how to solve it.

2018-10-21_19-18-55

It can be a skinning issue, in blender a vertex can belong to all vertex groups, while in Unity or FBX export , you are limited to only a few vertex groups per vertex. Maybe at export time some VG have been removed …

All that said, I don’t know well unity …

I’ve checked and does not seem to be that. When exported, looks like bone hierarchy separates in two groups being connected by hips, but all the spine from tail to neck does not stay in place as it should.

This is only a test, but how does it look when you import the FBX back into Blender?

Arf, sorry :confused:
Do you try to import back the fbx into blender to see if the issue is more on fbx or unity side ?

Tried that, it also looks horrible, even worse than in Unity:

wow…

let me tell you what I think is happening - which may be wrong.

Rigify creates multiple versions of a rig ontop of each other on different armature layers - there’s the one that actually deforms the mesh, then there’s all the handles that you actually see when you animate, then there’s another that comes between these. Somehow, whet you’re getting when you export with more rig elements than is good for an FBX.

The solution - probably best to look at baking an action to a rig, and then deleting the layers you don’t need - but there may be a better way of doing this…

Yeah, although I’ve marked to only export deform bones this rig looks to be too complex and seems to be exporting a complete spine and some other duplicated or supporting bones. So maybe the best way should be to use another basic rig (the initial metarig) and copy transforms from Rigify rig to this one?

Yeah… or you could re-import into Blender and delete all the wrong bones - see if that works.

Tested but it loses some weight that would have to be reapplied to other bones.

This script does its job and I get a full ORG bone hierarchy instead of DEFs, but the mesh does not deform as it is not weighted with those bones.

So I’ve tested opening the exported fbx and applying a copy transforms constrain to each DEF-spine againts its ORG equivalent and it works perfectly. The problem is that those constrains cannot be exported and baked animation does not respect this. So I think the best way could be to transfer weight data from DEF-spine to ORG-spine bones and remove the former ones. How could I do this?

Hum, it’s just basic skin issue. Because you export all the chains with model and skin, and so FBX " bugged". What you have is some skin assigned to mechanicals bones instead of deformation bones chains. Because FBX tries to “copy skin” by proximity and as all the bones are at the same place in worldSpace, some influences are copied to mechanicals joints.

You need export only the deformation joints and the model with the skin. Then do another export with only the same skeleton with animation baked. Two operations, one for the skeleton export and skin and another to get the baked animation.

If you have model+skin+deformation chain you should be fine in any 3D package.
To be perfectly fine you could even create a complete new chain and constraint it the original deformation chain, then copy the skin from old chain to the new chain. The export this only chain and model with skin.

Cheers!