reattiva / Urho3D-Blender

Blender to Urho3D mesh exporter
Other
124 stars 52 forks source link

Derigify requires update for newer Rigify #83

Open slapin opened 6 years ago

slapin commented 6 years ago

New Rigify uses Pitchipoy rig which contains face. Also other configurations are available (like 2-headed 3-armed creature)... For me, the problem is that there are 4 bones which are special associated with face - teeth.T, teeth.B, MCH-eye.L. MCH-eye.R. These bones control teeth and eyes and there is no DEF bones for them, they themself are deform or parented to. So additional step is needed which would include deform bones which are not DEF (or these bones should be handled in special way).

Jost thought that some generic bone filter would be nice... so I could name bone to be always included in export regardless of deform status. That would allow mount slots and hints. Also I think some silly LOD system could be implemented by bone name (i.e have several rig variants without having to model several skeletons by hand). That would allow batch magic to resolve huge set of problems...

Decomposing armature: rig (908 bones)
Bad ORG bones with no DEF children: ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face, ORG-face
Incompatible Rigify rig
Derigify found 222 DEF bones
reattiva commented 6 years ago

I cannot keep it updated with Rigify, too much work for me now as I don't remember a thing about Rigify. Have you tried to poke around the code?

slapin commented 6 years ago

Well, I did not dig heavily, but it looks like structure of rig changed a bit.

  1. Face rig uses some bones like teeth.T/B, MCH-eye.L/R which are actually deform bones or used as parents. These should be handled in special way. Any guidelines on how to implement this?
  2. Some ORG bones are not parents of DEF bones but produce some different structure, so need special handling. I think this can be easily handled special-casing bones by name.

The problem is I fail to understand how derigify code works. Also I want to have some custom bone filtering, which is why I'm interested too. Could you please explain how this code works? I think it could be generalized for some better bone processing. As currently it is not possible to produce something working for Urho3D out of rigify rig, which is sad as it is very nice for animation.

slapin commented 6 years ago

I think there should be some way to export all deform bones and bones having mesh parented (probably setting these as skinned), but need to properly build parent-child relationship table. I think this can be done in this way:

  1. Build table of bones we're going to export using filtering (names, deform status, etc.)
  2. Add root bone to the table too.
  3. for each bone in table travel its parenting in actual rig and if bone in rig is found, set it as parent of exported bone. If no parent is found, set root bone as parent.
  4. Exported animations should use new parent-child table.

I think doing it this way allows exporting any complicated rigs, also allowing some helper bones (like for IK) still be exported.

slapin commented 6 years ago

I think the indication o broken Derigify is also this message I overlooked before:


These groups are not used for bone deforms: ORG-DEF-f_middle.03.L, ORG-DEF-temple.L, ORG-DEF-butt.L, ORG-DEF-lid.B.L.003, ORG-DEF-lip.B.R.001, ORG-DEF-thumb.01.R, ORG-DEF-lid.T.L.001, ORG-DEF-nose, ORG-DEF-nose.R, ORG-DEF-f_index.02.L, ORG-DEF-palm.04.L, ORG-DEF-shin.L.001, ORG-DEF-brow.B.R.003, ORG-DEF-palm.02.R, ORG-DEF-f_ring.03.L, ORG-DEF-spine.006, ORG-DEF-butt.L.001, ORG-DEF-ear.L.003, ORG-DEF-lip.T.L, ORG-DEF-jaw.R, ORG-DEF-toe.R
``
So it creates groups which do not correspond to any bones for some reason and this is why deformation
in engine is broken (no such groups exist in original mesh). But I wonder why this happens...