rigify: rigs don't export well to game engines #57536

Closed
opened 2018-10-31 12:36:49 +01:00 by Paolo Acampora · 35 comments
Member

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

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
Author
Member

Added subscriber: @PaoloAcampora

Added subscriber: @PaoloAcampora
Paolo Acampora self-assigned this 2018-10-31 12:42:18 +01:00
Author
Member

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

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

The attached addon converts rigify human (other rigs need testing) to a hierarchy that will work in Unity [rigify_convert_gamefriendly.py](https://archive.blender.org/developer/F5308547/rigify_convert_gamefriendly.py) The panel **Rigify Games** will appear in the *Armature* properties when a rigify rig is in edit mode
Author
Member

Added subscribers: @dfelinto, @icappiello, @LucioRossi

Added subscribers: @dfelinto, @icappiello, @LucioRossi

Added subscriber: @angavrilov

Added subscriber: @angavrilov

Be mindful of blender/blender#54159, blender/blender#52063.

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.

Be mindful of blender/blender#54159, blender/blender#52063. 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.

Added subscriber: @viadvena

Added subscriber: @viadvena

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.

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.
Author
Member

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

rigify_convert_gamefriendly_1.01.zip

regards,
Paolo

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 [rigify_convert_gamefriendly_1.01.zip](https://archive.blender.org/developer/F8199234/rigify_convert_gamefriendly_1.01.zip) regards, Paolo

@PaoloAcampora 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.

изображение.png

@PaoloAcampora 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. ![изображение.png](https://archive.blender.org/developer/F8199313/изображение.png)
Author
Member

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

rigify_games.jpg

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

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 ![rigify_games.jpg](https://archive.blender.org/developer/F8199338/rigify_games.jpg) 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
Member

@PaoloAcampora, check if this feature https://developer.blender.org/D5588 implemented by @angavrilov can be of any help once the rig goes to fbx

@PaoloAcampora, check if this feature https://developer.blender.org/D5588 implemented by @angavrilov can be of any help once the rig goes to fbx

@PaoloAcampora 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!

@PaoloAcampora 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!
Author
Member

@icappiello

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

@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

@icappiello Not tested yet but I'm pretty sure that would fix the shear @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

Added subscriber: @mzprox

Added subscriber: @mzprox

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)

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)

Added subscriber: @Frizzil

Added subscriber: @Frizzil

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.

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.

Added subscriber: @TodorNikolov

Added subscriber: @TodorNikolov

Added subscriber: @carlosmu

Added subscriber: @carlosmu

In #57536#825968, @PaoloAcampora wrote:
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

rigify_convert_gamefriendly_1.01.zip

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?

> In #57536#825968, @PaoloAcampora wrote: > 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 > > [rigify_convert_gamefriendly_1.01.zip](https://archive.blender.org/developer/F8199234/rigify_convert_gamefriendly_1.01.zip) > > 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?
Author
Member

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

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

Added subscriber: @phelioz

Added subscriber: @phelioz

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

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
Author
Member

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

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 :)
rigify_test.blend

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 :) [rigify_test.blend](https://archive.blender.org/developer/F8697634/rigify_test.blend)

Also check this! Is very similar.
https://github.com/AlexLemminG/Rigify-To-Unity

Also check this! Is very similar. https://github.com/AlexLemminG/Rigify-To-Unity
Author
Member

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

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.

In #57536#982410, @phelioz wrote:
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).

> In #57536#982410, @phelioz wrote: > 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

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

Added subscriber: @Loganahogan

Added subscriber: @Loganahogan
> https://github.com/pKrime/python-snippets/blob/master/blender_addons/rigify_convert_gamefriendly.py This is incredible! Thank you so much!

Added subscriber: @OscarFranco

Added subscriber: @OscarFranco
Author
Member

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'
Author
Member

I think this task can be closed: AFAIK there are no plans, and few reasons, to change rigify architecture only to accomodate games.

The issue is now well known and there are many solutions around, my original solution has evolved into a bigger add-on that can be found here

https://github.com/pKrime/Expy-Kit

I think this task can be closed: AFAIK there are no plans, and few reasons, to change rigify architecture only to accomodate games. The issue is now well known and there are many solutions around, my original solution has evolved into a bigger add-on that can be found here https://github.com/pKrime/Expy-Kit
Sign in to join this conversation.
No Milestone
No project
No Assignees
11 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#57536
No description provided.