Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Other Rukhanka - ECS Animation System

Discussion in 'Entity Component System' started by Rukhanka, Feb 9, 2023.

  1. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    The absence of an animation system leads to a self-made subproject for current DOTS projects. Which consequently evolved into a standalone tool. It was a relatively long road from DOTS 0.17 to Entities 0.51 and finally 1.0.0-pre.15.

    In short: use default Unity's Mecanim and Animation Clips as authoring workflow. Rukhanka will do the rest: bake state machines and animations in entity components, advance state machines, play animations and feed animated matrices to the SkinMatrix buffers of the Entities Graphics Package. Entities Graphics will render animated objects.

    Rukhanka - ECS Animation System

    Above link has brief description of the project. Consult documentation and feel free to ask any questions/make suggestions/critique/etc
     
  2. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    Version 1.0.1 is released.

    Changelog:
    Changed
    • Crowd and Stress Test samples now have control for skeleton visualization enabling (with RUKHANKA_DEBUG_INFO defined).
    • Crowd and Stress Test samples now show total number of animated bones in scene.
    Added
    • IEnableableComponent interface for AnimatorControllerLayerComponent and RigDefinitionComponent.
    • Description of main Rukhanka entity components.
    Fixed
    • Incorrect handling handling of uniform scale in animations.
     
  3. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    Version 1.0.3 is released.

    Changelog:
    Fixed
    • Incorrect handling of very small transition exit time during state loops.
    • Preventing NANs (division by zero) when transition duration is zero.
    • Memory allocation error in PerfectHash tests.
    • Controller parameters order in authoring animator does not coincide with generated AnimatorControllerParameter buffer.
    • Empty animations to process buffer were handled incorrectly.
    • Exit states of state machines are now handled properly.
    • Animator state `Cycle Offset` treated as animation normalized time offset as in Unity.Animator.
    Added
    • Adding authoring Unity.Animator and all used Unity.Animation in the baker dependency list.
    • Extended animator controller logging with RUKHANKA_DEBUG_INFO which displays all states parameters and transitions of baked state machines.
     
    toomasio and Opeth001 like this.
  4. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,068
    Is humanoid support planned for this year?!
    THANKS!
     
  5. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    It is almost ready. I would say it is 99% ready. But I can't get how three muscle values for bone should be converted into single quaternion. All my experiments leads to wrong result in some cases. I am digging into animation forums, asking people but still no correct solution found. Trying more.
     
    JohngUK, toomasio, Endlesser and 4 others like this.
  6. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    Version 1.1.0 was released.

    Changelog:
    Added

    • 'Unity Netcode for Entities' package support. Animations and controllers can be synchronized using interpolated and predicted modes.
    • New 'Netcode Demo' sample with 'Rukhanka' and 'Netcode for Entities' collaboration showcase.
    • Animator parameter aspect to simplify animator controller parameter data manipulation.
    Changed
    • Minimum 'Entities' and 'Entities.Graphics' packages version is 1.0.10.
    Fixed
    • State machine transitions with exit time 0 were handled incorrectly.
    • Transitions with exit time 1 are looped contrary to Unity documentation. 'Rukhanka' behavior changed to match 'Mecanim' in this aspect.
    • Various deprecated API usage warnings.
     
    bb8_1, toomasio, xVergilx and 4 others like this.
  7. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    Version 1.2.0 was released.

    Changelog:
    Added

    • Compute deformation node for 'Amplify Shader Editor'. Now it is possible to make 'Entities.Graphics' deformation-compatible shaders with this tool.
    • Trigger set API for 'AnimatorParametersAspect'.
    • Animator parameter access performance tests.
    • Own entity command buffer system for optimizing ECB usage after 'AnimationControllerSystem'.
    • Animator state query aspect for access to runtime animator data.
    Changed
    • Animator parameter internal hash code representation was moved from Hash128 to uint. This leads to a smaller 'AnimatorControllerParameterComponent' size and better chunk utilization.
    Fixed
    • The state machine states without an assigned motion field had incorrect weight calculation.
    • Exit and enter transition events that happened in the same frame lead to one incorrectly processed frame. This was clearly observable with transitions from/to "no-motion" states.
    • Trigger parameters were reset even if the transition cumulative condition (all conditions must be true) is not met.
    • Entering through the sub-state machine's 'Enter' state was handled incorrectly.
    • Exiting from nested sub-state machines using the 'Exit' state was handled incorrectly.
    • Multiple transitions from the 'Enter' state machine state were handled incorrectly.
     
    saskenergy, apkdev, xVergilx and 2 others like this.
  8. darkriver41

    darkriver41

    Joined:
    May 5, 2019
    Posts:
    4
    Hey, this asset looks amazing, is it possible to have some benchmark numbers regarding performance so we can have an idea before buying ? Thanks
     
  9. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    Hi, sure. Some measurements on "Stress Scene" with ~10K animated entites (~870K animated bones)
    * Ryzen 7 5800X Windows: frame time is ~42 ms.
    * MacBook Pro with Apple M2: frame time is ~47 ms.
    Must note that there is optimization milestone planned in near future (after humanoid animation support will be done) which introduces some big optimization strategies like frustum and occlusion culling, rig bone hierarchy optimization, etc.
     
  10. darkriver41

    darkriver41

    Joined:
    May 5, 2019
    Posts:
    4
    Thats impressive, i think i can get even better performance because i wont need 10k agents and, plus i suppose you tested with a lot of features enabled ? i wont do that either, i mainly need a way to play and blend animations. Culling will be a huge plus though! Thank you very much!
     
    Rukhanka likes this.
  11. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    Tested entities are animated models with simple animators with several animations. Not so complex, but the complexity of the animator has no big influence on performance. The number of bones and simultaneously computed animations - is.
     
    darkriver41 likes this.
  12. Kleptine

    Kleptine

    Joined:
    Dec 23, 2013
    Posts:
    254
    Grabbed this asset, and it worked like a charm for the walk/run blendtree I had setup. Fantastic work! The parameter setting aspects are amazing too. :)
     
    Rukhanka likes this.
  13. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    Thanks. More features to come.
     
  14. WAYNGames

    WAYNGames

    Joined:
    Mar 16, 2019
    Posts:
    939
    When are you gonna be bought by Unity like the kinematic character controller made by PhilSA ?
     
    lclemens likes this.
  15. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    :) I think the answer is - "Never". A more favorable scenario is "Entities.Animations" comes out and Rukhanka not needed anymore. :)
     
  16. Thermos

    Thermos

    Joined:
    Feb 23, 2015
    Posts:
    148
    And you, my friend, are a true hero.
     
  17. Kleptine

    Kleptine

    Joined:
    Dec 23, 2013
    Posts:
    254
    I spotted that the systems in Rukhanka still run, even if there's no entities in the world that use animation. I know performance is on the list, so worth taking a look at maybe!

    Looks like the systems have [RequireMatchingQueriesForUpdate] but I don't know enough about ECS to know why that wouldn't be working.
     
    lclemens likes this.
  18. Kleptine

    Kleptine

    Joined:
    Dec 23, 2013
    Posts:
    254
  19. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    Thanks for reporting this. I will investigate.
     
    Kleptine likes this.
  20. lclemens

    lclemens

    Joined:
    Feb 15, 2020
    Posts:
    714
    I concur with WAYN. Animation is the first thing everyone asks about when they start DOTS. Unity would be smart to buy it off you and/or hire you because it's going to take years for something to come out, and animation is one of the top 3 reasons people use a gaming engine in the first place. As you know there are a couple other good ECS animation systems out there, but I think yours is the easiest to dive into since it re-uses the standard authoring tools.
     
    JakesOC, StickyKevin and WAYNGames like this.
  21. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    Version 1.3.0 was released. Main feature of this version is Humanoid animation and avatars support.

    Changelog
    Added
    • Humanoid-type support for models and animations.
    • Humanoid avatar mask support.
    • Humanoid avatars and animations sample scene.
    Changed
    • The rig definition authoring script now contains zero configuration fields. The avatar mask used for rig definition is not needed anymore. All required information Rukhanka reads from Unity Avatar. This is a breaking change. Please carefully read the upgrade process.
    Fixed
    • AnimatorControllerParameterComponent buffer did not replicate with NetCode.
     
    Singtaa, Thermos, Opeth001 and 5 others like this.
  22. shotoutgames

    shotoutgames

    Joined:
    Dec 29, 2013
    Posts:
    283
    Amazing. Is this feasible for a current project that already has many entities synced and animated via game object? I am guessing no :)
     
  23. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,068
    I saw that you've added humanoid support! This is the version I've been waiting for;). I read through your documentation, but it seems to be missing a few details. Can it handle runtime downloaded humanoid characters and animations ?
     
    Last edited: Aug 13, 2023
    lclemens likes this.
  24. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    All ECS data should be prepared beforehead by bakers. I think you can use use entities content management
     
    Opeth001, lclemens and Singtaa like this.
  25. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    Version 1.4.0 was released. This release contains a lot of changes and improvements. The most notable ones are physics collider attachment support, better root motion, and bone entity stripping feature. As a neat bonus Rukhanka is on the sale now with 50% off.

    Changelog
    Fixed
    • Several memory leaks during baking and runtime.
    • Incorrect additive animation calculation for humanoid animations.
    Added
    • Two new sample scenes: Ragdoll and Simple Physics.
    • Animation keyframe binary search was implemented.
    • Rukhanka can now work with unparented bone entities. This allows to properly handle physics body bone attachments.
    • Unneeded bone entity stripping functionality. Refer to documentation for the detailed description.
    • Internal bone animation data is now exposed as a RuntimeAnimationData singleton.
    • Full root motion support for Humanoid and Generic rigs. All root motion animation configuration parameters are supported.
    • Rukhanka now requires UNITY_BURST_EXPERIMENTAL_ATOMIC_INTRINSICS script compilation symbol. It will be added to project scripting define symbols automatically if not present.
    Changed
    • Updated Entities dependency to version 1.0.16.
    • Removed synchronization point related to AnimationToProcess buffer filling.
    • Removed synchronization point related to root motion delta states processing.
    • The animation process system is split into two distinct parts: animation calculation and animation application. This allows to injection of animation results post-processing and modifications (for example IK) functionality.
    • Runtime created bone-name-to-index hash map was removed. It has been replaced with a blob perfect hash map created during baking time.
    • Samples were moved to the samples tab of package properties. There are shared HDRP/URP sample scenes now. Materials and scene properties will adapt to the current renderer pipeline automatically.
    • Animation controller layer weight is a runtime property of AnimatorControllerLayerComponent now.
     
    xVergilx, Opeth001 and WAYNGames like this.
  26. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    1,068
    For games with hundreds or even thousands of character skins, like Fortnite, managing them through the content manager within a subscene becomes impractical. Instead, it's more efficient to load cosmetics separately during runtime rather than loading an entire subscene filled with hundreds of them.

    It would be incredibly easier if we could simply instantiate an animated character entity prefab and override its mesh and materials. This approach can significantly reduce the overall workflow and required resources.

    I could be wrong as I never used Rukhanka before. but the asset is very advanced, easy to use as it follows the Mono approach.

    Btw, I am surprised that Unity didn’t adopted this asset and made it official. It is by far more sophisticated than the Animation package made by Unity.
     
    Last edited: Sep 29, 2023
  27. Rukhanka

    Rukhanka

    Joined:
    Dec 14, 2022
    Posts:
    177
    Version 1.4.1 is out. This mostly bugfix release with important changes related to humanoid rigs. It is strongly advised to update, if you use humanoid avatars and animations (with or without root motion).
    Changed
    • All runtime systems TempJob allocations was changed to WorldUpdateAllocator.
    • Code cleanup with more extensive SystemAPI usage.
    • Moving shared utility code into separate Rukhanka.Toolbox assembly.
    Fixed
    • Incorrect root bone indexing for humanoid rigs.
    • Incorrect non-root motion of humanoid rig hips.
     
    lclemens likes this.