Page MenuHome

rigify: rigs don't export well to game engines
Confirmed, NormalPublicDESIGN

Description

Characters generated with rigify 0.5 won't work well when they are imported in external game engines, (Unity, Unreal etc.)

The reason is that rigify splits the deformation bones (layer 29) into separate chains for each module.

Once non deformation bones have been deleted, baked animations are likely break, and limbs won't follow the body.

We'll investigate how we can rework the hierarchy, in the meantime a conversion tool is being tested

Event Timeline

The attached addon converts rigify human (other rigs need testing) to a hierarchy that will work in Unity

The panel Rigify Games will appear in the Armature properties when a rigify rig is in edit mode

Be mindful of T54159, T52063.

Specifically, animations for rigs that use non-uniform scaling on parented bone chains (i.e. all common stretchy rig setups with Stretch To) cannot be correctly baked, and thus often cannot be correctly exported. The only workarounds are to either not use non-uniform scaling (no fancy stretchy rigs), or unparent all bones.

Brecht Van Lommel (brecht) lowered the priority of this task from 90 to Normal.Nov 1 2018, 12:12 PM

Could you Please refresh this script for 2.81? I am stuck: when I exporting rigify there is damn distortion only in fbx, in original scene all just fine. I tried many ways but no luck((( And fbx only deform doesnt work with rigify - a lot of ORG bones in fbx file.

Your call for help was heard, brave blenderhead. I tried a quickfix and it worked on my characters.

Please check the attachment and update the addon. Hit "Make Game Friendly" in edit mode (Armature properties)

It will change the deformation hierarchy and hopefully fix your exports

regards,
Paolo

@Paolo Acampora (pkrime) Hello! Thank you for your attention, but may be I am too slow or too tired but: I deleted old version of script and install new one but no sign of life in the list of addons. Blender just said that he is copied script in my config folder(( I am sorry that I still bringing not successful news.

Hi, that's correct: it won't display in the addons. Not sure why, probably I am missing some description required by 2.8. I cannot check that today, but please select your rig and look in your Armature properties

On my system the button is present once the addon has been installed, even if it does not show up in the list. If you have no such button, please load the .py file in the text editor and execute (Alt+P).

P.S. I have tried to export an fbx and load it into Unity. Now the animation is usable, but there is still the skew problem from the other ticket (expect big head around frame 99). I have to study the problem before I can fix this: this might be due to the stretch constraints used on the spline bones. Temp fix: add Limit Scale constraints to the *DEF-spine* and hat bones

regards,
Paolo

@Paolo Acampora (pkrime) Thank you, sir! Now it's working from text editor. Unwanted scale still there after exporting but now I can just delete all scale keys and distortion gone. Hierarchy much better but there is still ORG Spine bones. I hope this things will be fixed soon and your addon will be perfect. And it would be awesome seeing it inside Rigify toolbar natively in Blender master.
I think your addon need thread on Blender Artists, not everybody reach this place) Thank you for your work!

@Ivan Cappiello (icappiello)

Not tested yet but I'm pretty sure that would fix the shear

@Aleksandr (viadvena)

Yes, there is still some work to do: this tool has been written last year in a hurry to help people left stuck with non working .fbx files.

We should definetely give a round of tests and eventually add it to rigify tools, possibly along some UE4 and Unity metarigs. Then spread the good news to the world

Please keep us updated

regards,
Paolo

I like rigify and a good game export option is on my wishlist on highest priority.
Besides getting the export deform only work right, which your script hopefully solves, (I couldn't test it as for me the button was greyed out..) there is an other problem that somewhat breaks ue4 compability: the position of the twist bones, I mean the hand shouldn't be parented to the twistbone, but rather the forearm bone. The "rigify way" can make some ik setup problematic (two bone ik when there are actually four bones in the chain.
I1m not sure how this could be fixed, the way I tried is to generate single segmented bones for rigify and wrote a small script to duplicate the limb bones which serve as twists. Then set up the hiearchy and constrains.. the problem this is quite crude method and I can't really code.. just collecting codepieces i find on the net.

There is a good script btw:

https://github.com/chichige-bobo/BlenderPython/blob/master/RigifyToUnreal/RigifyToUnreal.py


Which solved the export issue by generating a new skeleton and baked the animations onto the new rig with correct hiearchy. Unfortuanatelly it doesn't work above 2.79.
Would be nice if it was fixed and maybe improved.. (The original author seems to have abandoned coding/blender)

Take a look at this script:

https://gitlab.com/ioflowstudios/rigify-ue4-exporter

Would be cool if this addon was built into rigify and expanded upon to probably support different bone sets, different game engines etc.

Your call for help was heard, brave blenderhead. I tried a quickfix and it worked on my characters.

Please check the attachment and update the addon. Hit "Make Game Friendly" in edit mode (Armature properties)

It will change the deformation hierarchy and hopefully fix your exports

regards,
Paolo

Awesome!! It works for me!
The only change I was made is in the line 8.

"version": (1, 01),

I change this to:

"version": (1, 0),

Otherwise it was impossible to install the addon.
Do you have it on github?

Hi Carlos, great it works for you too

Do you have it on github?

Yes, you can find it here

https://github.com/pKrime/python-snippets/blob/master/blender_addons/rigify_convert_gamefriendly.py

And yes, theat 01 was preventing the script from showing up, how lame of me! :)

Cheers

The rigify_convert_gamefriendly.py dosen't show up in the menu, have to run the it in the text editor to show up. And when it shows up nothing happens when clicking the button. I am in edit mode and have the Rigify generated armature selected.

But found a Rigify fork made for games and it works great for me
BlenderGameRig: https://github.com/SAM-tak/BlenderGameRig

Hi Gustav,

The rigify_convert_gamefriendly.py dosen't show up in the menu

That's correct for the script that has been posted here, yet it is fixed in the github repo

https://github.com/pKrime/python-snippets/blob/master/blender_addons/rigify_convert_gamefriendly.py

And when it shows up nothing happens when clicking the button

If it's possible, you can attach a .blend file containing your rig (armature only), and I will try to see what's not working in the script

But found a Rigify fork made for games and it works great for me
BlenderGameRig: https://github.com/SAM-tak/BlenderGameRig

Looks great indeed, I wonder if it can be made into a rigify extension. My script was intended as a first aid for those who wanted to export already made characters. I agree that starting with a game oriented solution in the first place would be a better approach until rigify will support game engines explicitly

regards,
Paolo

I don't mean to say that your script isn't nice, most of all I would like to have a solution where I can just use a regular Rigify rig in my games. Because Rigify is officially included which this BlenderGameRig is not. It doesn't have the same support in that way.
So if your script worked for me it would be great :)

The github version was the one I used. Running Blender 2.83. I get this error on the most simple of scene, I newly generated Rigify rig. Appreciate that you want to fix the script :)

Hi Gustav,

please worry not: no offence was ever taken! At the moment, all that the script does is to reorder the deforming bones into a single hierarchy, so that an fbx exported with "Only deform bones" enabled, will retain the animations and a nice tree. No renaming will happen.

I have tried it on your .blend and it seems to work. I have never used Mecanim so far, so I cannot tell you which steps can be taken from then on.

The github version was the one I used

Please make sure the one you got is up to date: as reported by Carlos, a typo was responsible for the addon not being listed. Also, I have just fixed a version warning, so you might want to download again

Kind regards,
Paolo

Good :) Will then test it again when I get back home in a couple of days. Seems I have done something strange on my end. Will redownload it and try again. Not using Mecanim because I am not using Unity. I use Godot. Thanks for the help!

Carlos that rigify to unity script seems nice but made only for humanoids plus I don’t use unity. I am using Godot.

Good :) Will then test it again when I get back home in a couple of days. Seems I have done something strange on my end. Will redownload it and try again. Not using Mecanim because I am not using Unity. I use Godot. Thanks for the help!

Carlos that rigify to unity script seems nice but made only for humanoids plus I don’t use unity. I am using Godot.

Hello Gustav!!
"Rigify to Unity" is usefull not only for Unity. This addon fix the deformable bones hierarchy (like a tree), and delete some unnecesary bones (at least for mobile performance requirements, like wrist rotation bone).

That's cool Carlos, could be useful then :). But I am creating non humanoid characters and it seams like it only supports humanoid unfortunately