Rigify: add option to parent all deform bones according to metarig #104644

Open
Leslie-Leigh wants to merge 1 commits from Leslie-Leigh/blender-addons:rigify_parent into blender-v3.4-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
First-time contributor

This PR wants to add an option to rigify which, if toggled, parent all deform bones in generated rig according to metarig's original bone hierarchy.


Motivation

Currently, rigs generated by rigify are not game-friendly.

In this video, the author compared rigify vs auto rig pro, and given rigify only C score on exporting to game engine.

Some users even post the solution to strike the problem. This series video shares how to achieve a game-ready rig. The idea is, manually add some rig and constraint them to follow the deforming bones generated by rigify.

In my opinion, one of the problems is the deforming bones' hierarchy is sometimes totally different from metarig's one.

For example, for a basic human meta-rig sample provided by rigify, it has a clear bone hierarchy:

basic-human-metarig-bone-hierarchy.png

During generation, rigify generates lots of helper bones (mch, ctl...). These bones sure are not suitable for directly exporting to game engine. Usually, users export the finally rig with a "deforming bones only" option (which as I know, are supported both by glTF and FBX exporter). Then the result model should contain bones prefixing with "DEF-", let's look at these bones:

rig-generated-from-basic-human-meta-rig.png

As you can see, the hierarchy is not organized in an expected way. For example: DEF-pelvis.L/R is not child of root or DEF-spine; DEF-arm.L/R is not a child of DEF-shoulder.L/R...

So, even we export using "deforming bones only", we still cannot get an ideal hierarchy.


This PR here wants to strike this problem.

As I observed, almost each DEF- deforming bone has at least a copy-transform constraint. So, in theory, it doesn't matter if it wasn't under some bones. So, in this PR, I:

  • Added a "parent all deform bones" boolean generation option.

  • If the option is true, parent each rig chain to parent chain's deforming bone instead of helper bones. For example, for a basic.limb rig which is a child rig of a basic.spine rig:

    • Gets its "rig parent bone", which for example is ORG-spine.01 in the parent basic.spine rig.

    • Attempt to find the corresponding deforming bone of ORG-spine.01, if everything goes fine, the result should be DEF-spine.01.

    • Parent the head deforming bone of the basic.limb rig under DEF-spine.01.


I have tried the modification with the builtin horse meta-rig, the result rig looks like this:

pr-result-basic-human.png

This PR wants to add an option to rigify which, if toggled, parent all deform bones in generated rig according to metarig's original bone hierarchy. --------------------- # Motivation Currently, rigs generated by rigify are not game-friendly. In this [video](https://www.youtube.com/watch?v=Ve3C9Xj6b38), the author compared rigify vs auto rig pro, and given rigify only `C` score on exporting to game engine. Some users even post the solution to strike the problem. [This series video](https://www.youtube.com/watch?v=INK__p3CWUw) shares how to achieve a game-ready rig. The idea is, manually add some rig and constraint them to follow the deforming bones generated by rigify. In my opinion, one of the problems is the deforming bones' hierarchy is sometimes totally different from metarig's one. For example, for a basic human **meta-rig** sample provided by rigify, it has a clear bone hierarchy: ![basic-human-metarig-bone-hierarchy.png](/attachments/f9217000-581d-4194-9e74-698eaee85cf8) During generation, rigify generates lots of helper bones (mch, ctl...). These bones sure are not suitable for directly exporting to game engine. Usually, users export the finally rig with a "deforming bones only" option (which as I know, are supported both by glTF and FBX exporter). Then the result model should contain bones prefixing with "DEF-", let's look at these bones: ![rig-generated-from-basic-human-meta-rig.png](/attachments/9a064c29-a4ff-4361-85d6-ffc8220f87db) As you can see, the hierarchy is not organized in an expected way. For example: `DEF-pelvis.L/R` is not child of `root` or `DEF-spine`; `DEF-arm.L/R` is not a child of `DEF-shoulder.L/R`... So, even we export using "deforming bones only", we still cannot get an ideal hierarchy. --------------------------------------------------------- This PR here wants to strike this problem. As I observed, almost each `DEF-` deforming bone has at least a copy-transform constraint. So, in theory, it doesn't matter if it wasn't under some bones. So, in this PR, I: - Added a "parent all deform bones" boolean generation option. - If the option is true, parent each rig chain to parent chain's deforming bone instead of helper bones. For example, for a `basic.limb` rig which is a child rig of a `basic.spine` rig: - Gets its "rig parent bone", which for example is `ORG-spine.01` in the parent `basic.spine` rig. - Attempt to find the corresponding deforming bone of `ORG-spine.01`, if everything goes fine, the result should be `DEF-spine.01`. - Parent the head deforming bone of the `basic.limb` rig under `DEF-spine.01`. --------------------------------------------- I have tried the modification with the builtin horse meta-rig, the result rig looks like this: ![pr-result-basic-human.png](/attachments/c04cac67-5c15-4337-b05a-04dcbaa07663)
Leslie-Leigh added 1 commit 2023-05-28 15:10:50 +02:00
This pull request can be merged automatically.
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u rigify_parent:Leslie-Leigh-rigify_parent
git checkout Leslie-Leigh-rigify_parent
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 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#104644
No description provided.