Search Unity

My Feedback on new Animation Rigging Package

Discussion in 'Animation Rigging' started by mangax, Aug 15, 2019.

  1. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    336
    hello everyone,

    i just wanted to post some thoughts on the new animation package.. overall am happy with it.. but there are things that causes some hassle , which are :

    1) Source targets and hints Objects: current scripts lacks methods to set an IK goal/position through scripts.. this makes our scripted solutions need to reference the source transforms to update their location in runtime which cause additional hassles>>
    A) character prefabs.. the source target and hint must have them all as child gameobjects.. otherwise the prefab system can't serialize them.. so i must i must add them in prefabs as childs.. which this also leads to another hassle >>
    B) updating source hassle... sources will have local positions that don't correspond to world location, i have to make my scripts manually and constantly update them every frame.. this means the scripts will have to do extra job on something already been decided in one frame in which the location in the world should be!

    a perfect example is a walking cycle for a large robot, if a robot walks slowly i can easily set the position / rotation of the desired location, and let the ik scripts handle the rest using the input data i given.. no need to update the location.. only when i need to move the feet for example into new location.. currently i have manually edit it otherwise it will drag it self due to it's parent movement. i thought maybe by unparenting it in runtime..but ik went all wrong.. it's too much hassle already


    2) Multiple Generated Animation outputs????: I noticed in the Visual Graph, the current ik scripts generate multiple animation outputs.. is there any reason for this or is it a bug??
    it looks kind of cluttered in the playable system with multiple animation outputs.. each character might have 3 or 4 easily ((if i would add my own output animation for my playable manager.. ))
    i wonder if possibly stacking all these animation script nodes to one animation output?

    here is it why it's weird.. my current playable mixer solution adds one animation output.. (2 from ik scripts, 1 from my script) but the animation went all jittery on me!!
    so i figured that maybe i need to make the mixer flows through the ik scripts.. so i dug up though connected nodes just to find the first one.. then connecting my mixer to the first node.. then i got rid of jittery animations! great!

    but have you seen the oddness in the current implementation?? (if it is not a bug).. the ik scripts is allowed to generate multiple OutputAnimations and they have no issues working together.. but it is an issue when i add my own animation output.. it should be one way or another.. either allowing any script adding new outputs to work in harmony without jittery, or constraining ik scripts to stack under one animation output..


    thanks for your support!
     
    Last edited: Aug 15, 2019
    Egad_McDad, NotaNaN and Oblivionized like this.
  2. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    1)

    If you wish to set the Transform component that defines the goal on the constraint, you can set the `TwoBoneIKConstraint.data.target` parameter to a new Transform. However, be aware that changing the transform dynamically at runtime after the animation rigging playable graph has been built will not update the goal as you would need to rebuild it for the changes to take effect.

    Losing transform bindings in the scene when creating a prefab is unavoidable considering how prefab works. However, you could just hook the scene transforms to your constraint like explained before after instantiating the prefab in the scene. You could keep the RigBuilder component disabled by default so that you can do your own initialization before enabling it and creating the PlayableGraph.

    2)

    Yes, the PlayableGraph created for Animation Rigging has several outputs, this is no bug. The first output handles the SyncSceneToStream playable chain which synchronizes scene values to make them available to the Animation Rigging jobs. Afterwards, the other outputs handle the multiple Rigs set on your RigBuilder. The Animation Rigging outputs are set to use the previous input evaluation values so that they behave as a post process step to what was evaluated before (see https://docs.unity3d.com/ScriptRefe...utputExtensions.SetAnimationStreamSource.html)

    We created a separate PlayableGraph in order for Animation Rigging to play nice with other animation systems. This way, we can use Animation Rigging with the Animator state machine or Timeline or your custom PlayableGraph.

    However, in 2019.2, we are missing a proper sorting order to better control when a PlayableGraph is evaluated in the Animator. While the Animator state machine always has priority on all other animation systems, we're not guaranteed that the Timeline PlayableGraph will be built before the AnimationRigging graph and thus in the right evaluation order.

    We're fixing that in 2019.3 by adding a sorting order to AnimationPlayableOutput (see https://docs.unity3d.com/2019.3/Doc...PlayableOutputExtensions.SetSortingOrder.html).

    In the meantime, to ensure your PlayableGraph are evaluated in the right order, make sure to also create them in the same order. By controlling when RigBuilder becomes enabled, you will also control when its PlayableGraph will be built, and thus change the evaluation order.

    Hope this helps.
     
  3. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    This probably needs to be in the documentation. And spelled out clearly.


    This workflow should be shown in the documentation explicitly as well -- I know it _seems_ obvious, but it really isn't.
     
    Codester95 likes this.
  4. mangax

    mangax

    Joined:
    Jul 17, 2013
    Posts:
    336
    thanks for help, i figured something similar to this while posting the thread, but that's why i posted this thread..
    to improve and make working with this new tool more intuitive!

    i figured that i would have to resort into some extra management on these new transforms (creation/referencing/deletion/etc) .. but rebuilding and such i never thought of.. this adds even more reason why i think having goals to be set by simple position or rotation can be better in some cases. there will be no need to rebuild anything.




    i tried calling my manager class which creates a playableGraph..
    then after it i called rigBuilder.Build() also tried rigBuilder.enabled=true

    this doesn't work directly from script.. the ik scripts seems not running.
    i still have to disable/re-enable rigbuilder in scene during playmode in order for it to work.. but then it works fine! it seems i need to enable it later after animator plays or something?

    anyway am glad you guys resolving this.
     
  5. ahmidou_mpc

    ahmidou_mpc

    Joined:
    Aug 13, 2019
    Posts:
    9
    I'm getting a
    "could not resolve 'Rig/Arm' because it is not a child Transform in the Animator hierarchy"
    but it is!
    Any idea?
     
  6. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi, we fixed an issue that sounds similar to yours not so long ago.
    Here is the issue tracker link: https://issuetracker.unity3d.com/is...les-cannot-be-resolved-in-custom-c-number-job

    Otherwise, try regenerating an avatar like so:

    Screen Shot 2019-09-30 at 11.29.18 AM.png

    If that doesn't solve it, send us a bug report and we'll take a look!
     
  7. ahmidou_mpc

    ahmidou_mpc

    Joined:
    Aug 13, 2019
    Posts:
    9
    Last edited: Oct 3, 2019
  8. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    @simonbz I'm hitting the same issue, first try with the AnimationRigging package.
    I can't regenerate the avatar as it's greyed out:
    upload_2019-10-4_17-3-48.png
    Any ideas?

    Edit: turns out removing the avatar makes that option not greyed out and then Animation Rigging "works" but of course I lose my actual animation. Not very useful. What am I doing wrong?

    Note: I'm on 2019.3.0b3 with Animation Rigging 0.2.3
     
    Last edited: Oct 4, 2019
  9. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    After trying this for a while I decided to take a look at the Ninja project. Turns out, that guy is cheating - he's using a Generic rig, not a Humanoid one! Switching over to a humanoid rig breaks the whole Animation Rigging system, in that example project and in my project. What's going on? Isn't this supposed to be working on Humanoids?

    Quick forum search reveals:
    a) people having the same issue with no reply for a month now
    https://forum.unity.com/threads/ninja-example-bug-with-humanoid-rig.743510/
    b) an answer from Unity that it "should work" on Humanoids
    https://forum.unity.com/threads/usi...anoid-animations-on-animation-rigging.740249/
    c) open bugs around this
    https://forum.unity.com/threads/usi...o-offset-the-3d-model-im-working-with.740903/
     
    Syberex likes this.
  10. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    The SIGGRAPH workshop ninja character was not advertised as a humanoid rig. There are indeed issues when converting the character to humanoid. The humanoid avatar in this instance seems to be creating issues with the rig constraints. A new avatar is normally generated under the hood whenever there are new rig references so that they are added to the avatar, but there seem to be issues in this case. We'll have a look.

    Animation Rigging is still in preview. We are working on bringing in new functionalities and addressing issues as they come in. As always, the best way to make sure we address your workflow issues is to submit a bug through the bug reporter in Unity.

    We're doing the best we can to go through the Animation Rigging questions in the forum while this technology is still in development, but we're bound to miss some questions.
     
  11. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    Oh, sorry if it did get over as that, but I wasn't complaining, really just trying to figure out whether I'm supposed to be able to use it to layer on top of Humanoids already or not (answer could be "no, that will take a couple months" or "yes, if it doesn't work report a bug"). This was just a follow-up to my question right above :)

    Maybe you can still answer the question above?
     
  12. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Regenerating the avatar will not help you with a humanoid rig. While it's a workaround that might solve some issues for generic characters, you want your original humanoid avatar in this instance.

    I spent some more time looking at the ninja character in the SIGGRAPH workshop project. The main issue I'm finding in this rig is the name given to some game objects in the ControlRig sub-hierarchy. Humanoid rigs must have unique names on all of their game objects, so in the case, there were the game objects "Spine" and "Neck" that were conflicting in the humanoid avatar (I was looking at the NinjaRig_Ramen character). If I rename these game objects to something else, the runtime errors disappear and animation rigging evaluates properly.
     
  13. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    Not sure we're talking about the same thing; as I posted I am in fact trying to use the Humanoid avatar (that's what my animations are for) but hitting the same issue as a previous poster of
    "could not resolve 'Rig/Arm' because it is not a child Transform in the Animator hierarchy"

    I haven't got this to work at all on a Humanoid even when very carefully following the sample structure.
     
  14. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    It's difficult for me to say without looking at your project. I can't reproduce this issue when using the same Unity version (2019.3b3) and package version (0.2.3) you are. What constraints are you using on your character?

    Can you submit a bug report with the Unity bug reporter?
     
  15. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    I can't! These always come back as "Won't fix" as it's a preview package. That being said, I'll send you a file today via DM.
     
  16. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    Can we expect some performance improvements in the future? Right now the spikes produced in the OnEnable method of the RigBuilder script are unbearable (over 18 ms for the advanced ninja sample). Will there be at least some caching involved to help with this issue?
     
    awesomedata likes this.
  17. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    @simonbz sorry for the delay. I tested a bit more and reported a bug: (Case 1193442).

    ezgif.com-resize.gif
     
  18. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    I've had a look at the project you provided in your bug report and I think I found the issue in your humanoid rig setup. It looks like there are mismatching transforms in your two bone IK bone setup on your humanoid hierarchies. The 'Root' bone in the TwoBoneIK component is set to 'mixamorig:LeftArm' in the 'xbot@Treading Water_Generic_TargetChild' game object hierarchy.

    Humanoid IK hierarchy.gif

    Updating the humanoid hierarchies with the proper bone transform seems to fix the issue:

    Humanoid IK Manip.gif

    I'll close the bug report unless you think of something else.
     
  19. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    Good find. But what about the actual thing I was trying here - the top right two guys - applying a Twist correction after a Two Bone IK? (this was my starting point, everything else is just trying to break it down). As you can see they are not doing that arm motion. The goal is to have a typical setup with 2 bone IK (arm / forearm / hand) where the rotation of the hand is properly applied onto forearm and arm with specific percentages to prevent strong distortions. Same as a human arm. There's no need for inbetween bones as in the Ninja with good skinning.
     
  20. OlivierDionne

    OlivierDionne

    Unity Technologies

    Joined:
    Apr 6, 2018
    Posts:
    10
    Hi fherbst,

    The twist correction constraint provided with the rigging package was specifically built to address skinning issues considering a set of procedural twist bones for a given mesh. For performance reasons, the constraint also caches the default bind rotation of the twist bones at constraint creation. Hence this is the reason why you see the arm snapping back to the original t-pose. We should definitely update docs on our side to reflect this.

    In anycase, since all this code lives in the package, you can augment on the implementation to consider your specific use case (the file to inspect is com.unity.animation.rigging/Runtime/AnimationJobs/TwistCorrectionJob.cs).

    Thanks,
    Olivier
     
    NotaNaN likes this.
  21. OlivierDionne

    OlivierDionne

    Unity Technologies

    Joined:
    Apr 6, 2018
    Posts:
    10
    The short answer is: Yes!
    Animation rigging will be converted to use the new DOTS Animation system. And since this is dependent on the DOTS architecture, it will fully make use of the new conversion system based on sub scene entity caching. In other words, all your authoring data will be cached as entity component data ("ready for execution"). You would only pay the cost of conversion if authoring changes are detected.
     
    NotaNaN likes this.
  22. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    802
    @OlivierDionne Thanks for the clarification. I think you should mention that somewhere, if that's what you implemented as a built-in "Twist Correction" it's very misleading.
    "Twist Correction" is usually the name for correcting the twist of bones that are already part of an IK chain to make it look more natural. Having extra bones for that purpose is something that can be additionally done but not necessarily is.

    If I understand you right that means there's no real built-in twist correction, such as could be used e.g. on any model downloaded or created with Mixamo (the big Unity partner for animation and characters)?
     
  23. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    If I hear you correctly, this means "on-the-fly" animation authoring in real time??
     
  24. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    I wonder, will we be able to still use the DOTS rigging package for GameObject based characters/models? Or will it not be possible without setupping playable graphs, if at all?
     
  25. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    Is there any ETA after the release of the DOTS animation portion that you are looking at converting the rigging package to DOTS?
     
    NotaNaN likes this.
  26. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    Just upgraded to Unity version 2019.2.12f1 and in that version the Rig Builder gives me the following error:
    Transform 'castle_guard_02(Clone)' must be the top most parent, found 'RoomSetup'.

    The gameobject called castle_guard_02(Clone) is where the Animator and the RigBuilder components are and its top most parent is indeed RoomSetup. But why does it matters now where the RigBuilder lives? Why does the Rig Builder HAS to be a root transform? It seems weird to me.

    I was using version 2019.2.0f1 before and there wasn't any error.

    Cheers,
     
  27. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi, this is a bug in the current Animation C# Jobs implementation which prevents you from having nested Animator hierarchies. This is a known issue. You can track the progress here if you want: https://issuetracker.unity3d.com/is...sted-animator-hierarchy-triggers-an-exception
     
    danUnity likes this.
  28. kevinjappel

    kevinjappel

    Joined:
    Apr 23, 2015
    Posts:
    2
    @simonbz Another minor piece of feedback: Can the BoneRenderer class be updated so that drawing bones is disabled when Gizmos are turned off? Seems like there's no way to easily hide them without disabling all of the components, unless I'm just missing it.
     
    mangax likes this.
  29. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi @kevinjappel! You can easily hide a skeleton just by toggling the enable state of the `BoneRenderer` component. As for toggling the visibility alongside Gizmos, this is not possible with the current implementation. Bones are rendered during `OnSceneGUI` to allow for batch rendering of all bones and they can't be treated as Gizmos.
     
  30. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    @simonbz
    Are there any plans to fix this in general?? -- This is making extending Animation Rigging unmanageable, and the current workflows for it are ridiculously tedious. I wanted to update the interface, but the bone UI is just not doing it for me.

    For example, I wanted to add a right-click >> add/remove constraint to a bone, then select a constraint from a list on a popup menu. I also wanted to add a right-click >> add/remove constraint to selected bones, with values decreasing (i.e. lerped or curved following an animation curve -- so I can define and modify weights automatically down the bone chains by modifying the animation curve itself) depending upon the order the bones were selected. This is proving very difficult with the way bones are implemented.

    Can you at least implement a temporary "gizmo form" to the selected bones/chains that we can modify in such a way, and take into account the order they were selected (and do things based on that) by right-clicking on them in the scene view?
     
  31. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi! Right now, there are no ongoing plans to update the bones and effectors visuals. As we are shifting our efforts to DOTS for the upcoming rigging workflow, things will slow down as new features go in the Animation Rigging package. In the long term, we plan on moving the implementation to the more robust and extensible prefab handles which is in the works internally.

    Otherwise, the BoneRenderer component is optional as it's not used by the Animation Rigging constraints. You can choose not to use it if you don't like it. Also, you can repurpose it if you wish for it to behave differently. It should be fairly straightforward to reimplement the rendering phase in Gizmo rendering.
     
  32. PJNercessian

    PJNercessian

    Joined:
    Apr 17, 2019
    Posts:
    2
    Sorry, but did you find any solution to this issue? I've been trying to understand their TwistCorrectionJob.cs, and it's just unbelievably confusing, at least to me.

    P.S @Unity, can you start commenting your code if it's gonna have 25 different interfaces and structs all combined to do one small animation??
     
    FlavioIT and awesomedata like this.
  33. Rubinhuang

    Rubinhuang

    Joined:
    Feb 10, 2017
    Posts:
    4
  34. danUnity

    danUnity

    Joined:
    Apr 28, 2015
    Posts:
    229
    Anyone was able to set the target/source for Multi Aim or other constraints at runtime?

    I tried disabling the RigBuilder before PlayMode, setting all the constraints/Rigs and then reenabling the RigBuilder and it did not work. I also tried calling RigBuilder.Build() at the end. Still no luck!

    The answer above is "However, be aware that changing the transform dynamically at runtime after the animation rigging playable graph has been built will not update the goal as you would need to rebuild it for the changes to take effect."

    Ok great but can you force the rigging package graph to rebuild? I thought the Build function was for the purpose but does not seems so?

    Thanks!
     
    marioslokas-v likes this.
  35. marioslokas-v

    marioslokas-v

    Joined:
    Aug 19, 2020
    Posts:
    12
    I am having exactly the same issue. Have you had any luck solving it?
     
  36. Jebtor

    Jebtor

    Unity Technologies

    Joined:
    Apr 18, 2018
    Posts:
    115
    marioslokas-v likes this.
  37. marioslokas-v

    marioslokas-v

    Joined:
    Aug 19, 2020
    Posts:
    12
    Thanks, following the answer to the link you send solved my problem.
    Are there any plans of making the constraints add source objects at runtime?
     
  38. Jebtor

    Jebtor

    Unity Technologies

    Joined:
    Apr 18, 2018
    Posts:
    115
    No, we require the build step in order to use the playable API and gain the performance boost. To add source objects at runtime you need to rebuild the graph.
     
    marioslokas-v likes this.
  39. SalchipapasGames

    SalchipapasGames

    Joined:
    Sep 8, 2018
    Posts:
    12
    Is there an ETA on this?

    Bildschirmfoto 2020-10-12 um 13.26.00.png
     
    PanoTron and awesomedata like this.
  40. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    232
    Hi,
    I'm experiencing this issue as well. It's when I'm creating/destroying game objects on the fly within the animator hierarchy. I've tried rebuilding the RigBuilder as well as assigning a new Generic Avatar by code whenever I make these changes. Although it doesnt seem to make the warnings go away. Are there any other areas I should be checking? btw, Im on Unity 2020.2.0b10.3438.
    Thanks for any ideas!
     
  41. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,
    I don't think this is the same issue. The original issue was that the internal Animator avatar was not properly rebuilt when constraints outside of the avatar were animating generic properties. This is why my workaround to this was to build an avatar manually to properly map the skeleton and the constraints. This has been fixed back in Unity 2019.3.

    However, getting the error `Transform stream handles cannot be resolved` doesn't mean it's all the same issue.

    In your case, removing a transform at runtime does not unbind the stream and scene handles associated to the constraints in the Animator, and this is likely why you encounter this error. The Transform hierarchy in the Animator was not meant to change at runtime as the Animator expects its bindings to remain the same.

    If you need to perform topological changes to your animated hierarchy, we've added new API calls that will let you flush the custom handles that are used by Animation Rigging:
    Code (CSharp):
    1. AnimatorJobExtensions.UnbindAllStreamHandles(this Animator animator)
    2. AnimatorJobExtensions.UnbindAllSceneHandles(this Animator animator)
    This of course needs to be used in conjunction with a `RigBuilder.Build()` and a full rebind of the Animator. Needless to say, this is a costly operation and should be used sparingly.

    Now for the bad news. This new API has been added in Unity 2021.1 and will not get backported to earlier versions. You'll need to wait for the beta version of Unity 2021.1 to be able to try it out. Otherwise, you can try using the function `AnimatorJobExtensions.UnbindAllHandles(this Animator animator)` if you're comfortable using reflection.

    Here is the issue tracker that covers the issue:
    https://issuetracker.unity3d.com/is...t-featured-a-previously-active-rig-constraint
     
    backwheelbates likes this.
  42. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    232
    Cool, thanks @simonbz , I will definitely give this a try. I didn't know about this.
     
  43. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    232
    @simonbz , just trying this now. It doesn't appear that the function is available in Unity 2020.2.0b10.3438. Would you mind providing a simple code example, so I can confirm?
    Thanks again!!
     
  44. PanoTron

    PanoTron

    Joined:
    Oct 21, 2015
    Posts:
    5
    Any progress on this? I am currently trying to avoid rig builder's OnEnable() entirely.