Meta-rigs (Human and Animals) in BGE

Hello BA. I have newb question. I love to rig and animate my models with meta-rigs be it bibeds (humanoids) or quadrupeds (animals). Meta-rigs are flexible and complex enough to create good animations including facial expressions. They are working nice with BGE it’s good news. But metarigs are really complex systems they have many hundrets of bones on different layers - DEF bones, MCH bones, ORG bones, tweak bones, not to mention all those constraints, helpers and widgets. Alone wolf meta-rig (blender 2.79) has almost 800 bones! There are two basic armatures in 2.79 - human and quadruped, but they are without face and finger bones they could be used for background characters. But even Human basic meta-rig without face and finger bones has > 200 bones! Isn’t it too much for game engine?

So question: is it good idea to use such complex armatures in BGE at least for main characters? Or its better to use simplified armatures sacrificing good looking animations. Or maybe there is way to optimize meta-rig armatures for BGE?

Could you share your experience\workflow with built-in meta-rigs in BGE.

No, it is not good practice to use many bones in BGE or ANY other engine. And yes, game animators are using meta-rigs all the time, just when you export your FBX you check “only deform bones” option. So in other words, what comes in the engine (Unity/Unreal) is not meta-rigged just the deform bones without control bones. That’s how it works everywhere.
What you need in BGE is to find a way to delete control bones, when your animations are ready or some way for control bones to not be present, when the game starts.

Here is a basic meta-rig in blender, you can add face bones, or anything…actually blender animation system is very advanced and flexible…many pro animators are using blender for game animations in big studios.

Thank you for clear answer. I will watch this tutorial and set up my metarigs for using in BGE.

So i watched this tutorial. Nothing new to me. I already know how to rig models with Meta-rig. I need to know the way to “hide” all bones except deformation bones - so that BGE won’t taking in account all control- and extra-bones. Is it enough just to hide all layers except layer with DEF bones or i have to manually delete all those bones from armature? In that case i will lose ability to tweak, fix or create new animations with that armature.

You can manipulate the bones via this in python, but I don’t think you can delete individual bones. Hmmmm…

Actually, I think moving control bones to a hidden layer will work. But it should be tested.

Well then i should find other solution. Maybe i should export meta-rig with baked animations to fbx (only deform bones), and then import that .fbx back into blender. Not very elegant solution. Each time i will need to fix animation\pose i will be forced to reexport\reimport fbx. Other method i could think is using contsraints. Take simple armature align each bone with meta-rig respective bones and use on each bone of that simple armature rotation constraint to copy rotation of meta-rig bones. Simple armature will be repeating all animations of meta-rig, only thing left is to create keyframes (actions) for simple rig. It could work, but it’s lot of boring work - assigning rotation constraints to hundrets bones. This is even less elegant solution than first one. But at least it allowing me to edit animations without exporting\importing files.


rig a ragdoll and then use copy rot constraints on the ragdoll rigid body bones
this way you can then check record (in upbge I think we can check record and then even call suspend physics and it will still record) (to send performance back to blender)

this way you rotate the ragbones w/py easily to animate the actor

have your meta rig high poly and use it to make wrinkle maps per bone but don’t and bake over to low poly rig , dont go overboard on the number of in game bones for in game stuff as its vertcount*number of bones+ik cost

use the bone rot or relative pos to drive the wrinkle maps and you can use far less bones and extract far more detail

Thank for your advice. Yes, i’m thinking about bone rotation constrants. Its look to me most flexible solution, and very time consuming tho. But when all bones will be constrained i will get simplier clone armature of meta-rig. Anyway it seems there is no easier solution for this.

At the original post…you can use many bones when doing all your animations…I like to use a lot of constraints etc, but the BGE or even UPBGE does not like that…so I bake down the IK to FK and clean up the keyframes a bit, then I delete all the leaf and IK bones…this leaves me with an FK animated rig/mesh and that is what would be imported…you may not notice much impact in the engine with only one or two deforming meshes, but once you get a few in game you will notice a HUGE impact…so I highly recommend converting to FK animations.

less bones = higher FPS
less deforming verticies = higher fps

I also disable animations on models beyond a certain range of the player.

I hope the input from everyone here has been useful. If not, feel free to continue asking questions or for us to refine our responses…enjoy.

Thank you for your post. I will take in account what you’ve said about switching off animation on far characters! About FK\IK. I will try both methods - first i will create simplier armature matching meta-rig but with small amount of bones and WITHOUT any IK constraints, and then i will use rotation constraint on that simple armature copying rotation of similar bones of meta-rig. And after animation is done with metarig, i will just bake animation on my simple armature. And other method i will try to export animated meta-rig into FBX with only deform bones option. And then import FBX in blender. ANd i will see wich method is working better.

And one more question: what do you think wich amount (or range) of bones is optimal for main character and for background characters (humanoids) in BGE? Just to keep in mind.

one can swap rigs based on how far away the agent is

this will use more ram as a cost, but be faster on the gpu/cpu per frame.

a stock ‘armature lod system’ would be intresting.

I would say about 50 bones + or - 10 for a biped, quadraped maybe around 70…I think there was a limitation on some video cards that would not allow more than 77 bones??? but since I do not have the facts at hand I could not say…

I am using @45 bones on my characters, with my main character using 54(yes the reverse of 45…odd?)…my dragon only uses 33 bones…if I recall correctly and is actually one of my least complex models.

no need to swap rigs on lod’s, you can literally just replace the entire model and rig with an lod version via python just use an arbitrary mesh as the controller that holds the logic(I use empties because they cost about the same as one vertex…maybe less, not having any uv data etc)…but this is more an intermediate approach and unless you are comfortable in the engine I would not go this route.

Ok i will keep in mind your experience. So you are using 54 bones at main character is that means you are using shapekeys to animate facial expressions? So do shapekeys have less impact on performance than bones?

My main character does not use facial expressions…you generally never see his face…if I do cinematic I use a different model so if the frame rate drops it is not during gameplay.

I have 20+ bones for a quadruped, mainly driven by procedural animation

with each limb(including arms) consists of 2 deform bones and 1 ik constraints bone target with copy location constraints on a game object with rigid body constraints, cost 1.5~2 ms each frame to animate it on my pc

the costs are mainly from the ik, but I would still recommend this setup since that took care of both surface planting and ragdoll without a single line of code

I have to concur, for something like planting each ‘hoof/paw’ or whatever to ground, this is a small cost…but I am curious how you control ankle/wrist actions with only two bones per limb?

I don’t :smiley: the quad is a spider tank without any movement in those areas