Search Unity

Animation Rigging questions.

Discussion in 'Animation Rigging' started by Vit3D, Feb 7, 2020.

  1. Vit3D

    Vit3D

    Joined:
    May 2, 2015
    Posts:
    64
    Hi All,

    I just started to test features of Animation Rigging (AR) pack, so I have a lot of questions.
    Here two of them:

    1. AR for control character skeleton special bones.

    First of all I'm going to use this pack for creating controllers for so-called "special" character bones like twist, elbow. knee etc.
    I use typical special bones construction, for example my characters arm bones hierarchy looks like this:
    Clavicle
    ....\- UpperArm
    .......\- UpperArmTwist1
    .......|....\- UpperArmTwist2
    .......\- Forearm
    ............\- Elbow
    ............\- ForeArmTwist1
    ............|....\- ForeArmTwist2
    ............\- Hand
    ................\- ...

    In 3ds Max I use controllers for slow down Twist bones rotation by X relative to their parent bone; for Elbow (or Knee) bone I slow down its rotation by all axes. So I tried to do the same using "Twist Correction" feature of AR.

    I successfully set "Twist Correction" for Twist bones (for example ForeArmTwist1 = -0.5; ForeArmTwist1 = 0.5), but got the problems with Elbow because I'm able to select only one Axis.
    I tried to add another "Twist Correction" for Elbow with Z axis selected, but correction values from last controller in the stack simply overwrite correction values from previous controller by all axes. I suppose that each twist controller in the stack uses not result (output) of previous controller as input but native input (values) from beginning of stack.
    Also I tried to add new Rig Layer in the Rig Builder and put second "Twist Correction" in it, but result have been exactly the same -- correction values from second layer overwrite values from previous layer.

    Although "Multi-Rotation" controller does not allow to set negative values, I tested it too.
    I set Elbow as Constrained and Forearm as Source, but looks like "Multi-Rotation" does not work with this settings for my hierarchy.

    Finally I managed (partway) to solve this problem using trick -- I changed hierarchy of bones:
    Clavicle
    ....\- UpperArm
    .......\- UpperArmTwist1
    .......|....\- UpperArmTwist2
    .......\- Forearm
    ............\- ForeArmTwist1
    ............|....\- Elbow
    ............|....\- ForeArmTwist2
    ............\- Hand
    ................\- ...

    As You can see I re-linked Elbow bone from Forearm to ForeArmTwist1.
    For this hierarchy I applied "Twist Correction" (by X) for ForeArmTwist1 and ForeArmTwist2, but did not include Elbow in the list because it got X slow down as child of ForeArmTwist1.
    Then I added "Twist Correction" (by Z) for Elbow bone using Forearm bone as source.

    As result I got Elbow bone slow down by X and Z (relative to Forearm).
    Everything work fine, but frankly speaking I do not like this solution because it is some sort of trick to get round current "Twist Correction" controller restrictions.

    Maybe someone can advice more "direct" way to solve my problem? Any suggestions will be very helpful.

    "Animation Rigging" package is still marked as "Preview", so I have some sort of request to Unity Development team --
    I think will be very useful if You add one more controller to AR, which works the same way as "Twist Correction" but allows to select several (or all) processing axes. Hope this is not too complex.

    2. Using AR with Humanoid rig.

    I'd like to ask -- Is it safe to use "special bones" (see above) AR controllers for character with Humanoid rig defined?
    Special bones are not "mapped" in the Humanoid rig definition, so, at first look, this will not cause problems. Anyone tested something like this?
     
    florianhanke likes this.
  2. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi Vit3D,

    I'm not sure I understand your workflow in this instance.

    TwistCorrection will only operate on a single axis. However, if you want to get a behaviour that is closer to the one in 3DS Max, you can implement a custom version for your needs. Animation Rigging is meant to be extensible as constraints cannot always cover all requirements.

    Otherwise, I would suggest looking at the example that is provided with the package to see how to set up TwistCorrection (Unity/ConstraintSamples/Scenes/Twist after importing the samples in the package manager). Also, take a look at the project we created for the SIGGRAPH workshop we did last year: https://github.com/Unity-Technologies/animation-rigging-workshop-siggraph2019 where the character is also set up with TwistCorrection constraints.

    Yes, Animation Rigging can evaluate with a Humanoid Rig and will be able to read from humanoid bones and exposed transforms as well. The Animator automatically creates an alternate avatar based on the humanoid avatar to map these new bones in the rig definition.
     
  3. Vit3D

    Vit3D

    Joined:
    May 2, 2015
    Posts:
    64
    @simonbz

    Many thanks for Your reply!

    I apologize if my workflow description has been not clear. I could suppose that it's not clear how (and why) I use Knee and Elbow bones in my character rig.
    Typically if to bend character arms and/or legs, mesh in the Knee and Elbow zones has anatomically incorrect shape (too smooth) even if mesh skinning is fine tuned. This problem can be fixed by using special Elbow and Knee bones with slow down controllers -- this makes elbow and knee shapes more natural in motions.
    As I told, in the source 3ds Max model I use slow down for these bones by all axes, but in fact only twist and bend is needed because human skeleton has limited rotation for forearm and calf bones (side-to-side rotation practically impossible for them).
    So by changing hierarchy (see post above) I have found possible solution and applied AR controllers for slow down by 2 axes. But in my new model I'm going to use (add) similar special bones for shoulders and hands to improve mesh deformation. In the human skeleton upper arm and hand bones can be rotated by any axis, so special bones for them should have slow down controllers by all axes. That is why I started this discussion about controllers for special bones.

    In the reply You mentioned that it's possible to create custom controllers for AR system.
    Is there more detailed AR codding documentation and description of method (some tutorial) how correctly add custom controller to the AR system without changing (replacing) original AR code files?
    I specialized on character modeling and have publications in the Unity Asset Store and I'm going to publish there my new character model with AR support.
    Think that You understand, that in this situation will be incorrect to ask users to replace some original AR script by my custom script. I just can instruct them how to add (implement) my custom controller.
     
  4. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    Animation Rigging has been designed with extensibility in mind, so you don't need to worry about having to change code in the Animation Rigging package to create custom constraints.

    We have several resources already where we explain how to build custom constraints. You can have a look at our SIGGRAPH 2019 workshop where we explain how to build several constraints, from the more entry point HelloWorld constraint to the more involved TwistChain:

    https://github.com/Unity-Technologies/animation-rigging-workshop-siggraph2019

    Also, have a look at this talk we did on extending Animation Rigging at Unity 2019: