Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] GPU Instancer - Crowd Animations

Discussion in 'Assets and Asset Store' started by LouskRad, Apr 29, 2019.

  1. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904

    GPU Instancer - Crowd Animations is released on the Asset Store.​


    The Crowd Animations is an extension for the GPU Instancer Asset, and requires GPUI to work.

    Introducing GPU Instancer - Crowd Animations

    Crowd Animations is an out of the box solution for using massive amounts of animated characters in your scenes with high performance. CA uses the GPU Instancer core and adds GPU skinning techniques on top of GPUI's indirect instancing solution and GPU culling techniques. This results in a combination which will allow you to get the most out of GPU Instancing in Unity for your animated characters.



    Crowd Animations works by baking the bone data of animation clips into a texture and reading that texture in Compute Shaders to feed skinning data to the rendering pipeline for indirect skinned-mesh instancing. Using the GPU Instancer backend for visibility tests in the GPU as well, the Crowd Animations extension is designed to be the ultimate solution for a GPU based animation workflow.


    Crowd Animations supports two different animator workflows:

    Mecanim Animator:

    You can use the Unity Mecanim Animator to handle the state machine for animations as usual, and GPUI will read the animator states from the Mecanim Animator. This will let you use your existing Animators and scripts with Crowd Animations, and make it possible to use indirect GPU Instancing out of the box with all the GPUI features such as GPU frustum and occlusion culling. This workflow increases GPU performance while rendering skinned meshes, but it won't be an ideal solution for projects that are CPU bound since the Mecanim Animator will still create an overhang for each instance.

    Crowd Animator:

    You can use the Crowd Animator to handle your animation clips in the GPU through the GPUInstancer API and decide which animation to play at a given time. This workflow will require you to write your own scripts (or use visual scripting tools) to handle animation states manually - but this workflow will also let you get the most out of GPU Instancer since there won't be any overhang created by the Mecanim Animator.



    Crowd Animations Features:

    - Indirect GPU instancing with skinned meshes.
    - GPU frustum, occlusion and distance culling.
    - VR compatible. Works with both single pass and multipass rendering modes.
    - Supports Built-in, LW and HD Render Pipelines.
    - Custom shader support (requires manual set-up).
    - Animation Blending (up to 4 animations).
    - Multiple skinned mesh renderers and submeshes support.
    - LOD Groups support (all LOD meshes must use the same rig).
    - Bone attachments (Mecanim Animator workflow only).
    - Root Motion support.
    - Ability to use custom shadow distance per prototype and to choose the LOD to render shadows with.
    - Automatic detection of added and removed instances without any additional code.
    - Rigidbody and physics support.
    - Easy to use interface.






    Current Limitations:

    - Animation Layers and Masks are not supported.
    - IK is not supported.
    - Mobile support is designed for high-end devices and currently at an experimental stage.
    - Animation blending uses linear matrix interpolation, meaning blending animations that are very different might cause incorrect skinning results.

    Supported Platforms:
    - DirectX 11 or DirectX 12 and Shader Model 5.0 GPU (Windows)
    - Metal (macOS, iOS)
    - OpenGL Core 4.3 (Windows, Linux)
    - Modern Consoles (PS4, PS5, Xbox One)
    - Vulkan or OpenGL ES 3.1 (Android 8.0 Oreo or later)
     
    Last edited: Nov 9, 2021
  2. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,639
    love it
     
    LouskRad likes this.
  3. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    372
    You guys are kicking some serious ass with your plugins! Congrats!

    Couple of initial questions that aren't clear to me without diving into it myself:
    1. Under either workflow I presume you don't run the animation clips and therefore one other feature that won't work out of the box are animation events correct?
    2. Do Mecanim blendtrees work (for up to 4 animations) out of the box?
     
  4. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hey there and thanks!

    1. Animation events work out of the box in the Mechanim Animator workflow. In this workflow, the animator runs per instance as usual in the background, but GPUI takes over rendering. However, in the Crowd Animator workflow, the Unity Animator component is completely disabled and therefore animation events would not work.

    2. Yes, they work out of the box for the 4 animations with the highest blend weights. For the Crowd Animator, there are also API methods to use blending on animations (again, for up to 4 animations).
     
    strich likes this.
  5. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    372
    Huh! Nice work! I'm curious as to how you disabled Mecanim rendering specifically? I wasn't aware there was an API for that.
     
  6. Rewaken

    Rewaken

    Joined:
    Mar 24, 2015
    Posts:
    124
    Looks Amazing!
    I have a size of 3000 animated meshes pool of the same prefab which is drawn by indirectinstance method so they all have same animation at a time. Is it possible to have a different animation for different instances drawn using CA plugin?
    PS: I am using no gameobject workflow so cant use macanim method also performance budget is tight because I need to draw thousands of instances.
     
  7. eron82

    eron82

    Joined:
    Mar 10, 2017
    Posts:
    83
    Amazing!!! Please let it go out as soon as possible!
     
    LouskRad likes this.
  8. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Disabling the skinned mesh renderers does the job :)
     
    strich likes this.
  9. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,

    CA indeed allows you to have instance based animations; you can check the demo build to see that. This works because CA does not work by mesh switching, but instead applies GPU Skinning on a single mesh and keeps animation information on a per instance basis.
     
  10. CW3MH6

    CW3MH6

    Joined:
    Jul 4, 2013
    Posts:
    14
    GPU Instancer is amazing, and this crowd animations asset looks like it will be too. I was not looking forward to implementing my own custom solution for texture-based GPU animations, so this is fantastic!
     
    LouskRad likes this.
  11. eron82

    eron82

    Joined:
    Mar 10, 2017
    Posts:
    83
    No release date?
     
  12. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    We are currently testing the package. I can't give you a release date, but we will publish the package as soon as we are done testing. We will announce from this forum when we submit the package.
     
    Flurgle likes this.
  13. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi everyone.

    We have just submitted the Crowd Animations package to the Asset Store. It will be released after the Asset Store team is done with their reviews.
     
    Rewaken and julianr like this.
  14. strich

    strich

    Joined:
    Aug 14, 2012
    Posts:
    372
    Fantastic in really excited for you guys. Are you able to share any kind of roadmap of future features at this point?
     
  15. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    151
    What's the price going to be?
     
  16. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Thanks! Our first priority will be to improve Crowd Animations to increase its support for as many use cases as possible. Thus we will mainly do so by shaping our roadmap with the feedback we get from you.
     
  17. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,
    the Crowd Animations extension will be priced 60$. However, it will be initially released with a 35% discounted price of 39$.
     
  18. eron82

    eron82

    Joined:
    Mar 10, 2017
    Posts:
    83
    How much time unity takes to release it?
     
  19. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    I really don't know, but GPU Instancer was released in 15 days. It depends on how fast the Asset Store curation team will be done with the process.
     
  20. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi everyone,

    We're excited to announce that the Crowd Animations extension BETA version has been released on the Asset Store.
     
  21. therewillbebrad

    therewillbebrad

    Joined:
    Mar 2, 2018
    Posts:
    151
    You say that you can use visual scripting tools for the crowd animations api could you elaborate on that workflow? Playmaker specifically. Thanks!
     
  22. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,179
    Question:

    * Does this work with the horses from horse animset pro?

    Feature Request:

    * Please add Boid behavior (flying birds, swimming fish, etc)

    ps: i just bought it anyway, but can't get to test myself until next week. so it's just a curiosity question and if the horses don't work, could you please make them work? thank you! :)
     
  23. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,

    When using the Mecanim Animator Workflow, you do not need to do anything extra, Crowd Animations will work out of the box with your existing setup.

    As for when using the the Crowd Animator Workflow: When you add a prefab as a prototype to the Crowd Manager, GPUI adds the GPUICrowdPrefab script to your prefabs. You can use your desired visual scripting tool to call the methods on this script to handle your animations on your instances.

    We have tested this with Playmaker and Bolt so far. We will write detailed documentation on the wiki site for usage with these assets in the near future. We can possibly add custom Playmaker actions also if necessary.
     
  24. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,
    and thank you for supporting GPUI.

    We made a quick test with horse animset pro. Currently, Crowd Animations works with the horse models and their animations. We have seen a few extra skinned meshes (e.g. horse reigns) causing some problems, and we will look into fixing this. We have not tested with the scripts on the original prefabs, so I cannot comment on that. But it would not be advisable to use crowds with heavy MonoBehaviour scripts on them.

    Noted. We will look into adding an example scene showing a Boid implementation with animated prototypes. Thank you for your feedback.
     
    Rowlan, Akshara and ftejada like this.
  25. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Hi, I've asked about support for GPU Instancer for skinned animation while ago and my wish has been granted. Thanks a lot!

    I have a request and a question.

    The first and immediate usage I'm looking for is local crowd animation (spawned near the player only) such as swamp of butterflies or insects, a flock of birds, or school of fishes.
    Some example scenes would be perfect!

    For the future, do you plan to add interaction with the world? such as collision detections? If so, I can use CA for larger animals that player can interact(such as hunting)

    Thank you very much.
     
  26. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there!

    The main purpose of Crowd Animations is to render your animated characters in crowds with high performance; rather than using it as a particle system or for movement patterns such as flocks, swarms, etc.

    As it is right now, Crowd Animations already works with game objects, meaning you can use Rigidbodies, Colliders, NavMesh Agents, etc. on your instances.

    We are planning to provide examples for implementing your own movement patterns (or provide integrations for existing third party solutions) for usage with Crowd Animations, but the asset itself is not designed as a generic solution for this.
     
  27. ZigMarch

    ZigMarch

    Joined:
    Aug 11, 2013
    Posts:
    20
    From your statement in the past, I thought skinned mesh support would be implemented as a GPU Instancer's 1.x basic feature.

    Is skinned mesh support not a GPU Instancer's basic feature?
     
  28. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,

    GPU Instancer by itself will not support skinned meshes. Technical requirements and user expectations for the extent of the skinned-mesh support required us to implement this solution as a separate asset.

    GPU Instancer has already evolved beyond our initial plans to accommodate new features of Unity and user feature requests. We do not want to add further complex systems into it (like in this case, GPU Skinning and animator workflows), since it would make it quite hard to maintain GPUI's stability.

    Also, publishing Crowd Animations as an extension asset makes it possible for us to develop it as extensive a solution as possible for instanced crowd skinning instead of a limited built in solution for GPUI.
     
  29. ZigMarch

    ZigMarch

    Joined:
    Aug 11, 2013
    Posts:
    20
    I am certainly surprised that there were a lot of features for GPUI and croud animation extention.
    But I was a little sad because I bought GPUI thinking that the release version of this will also include skinned meshes feature.
     
  30. ProverbsVG

    ProverbsVG

    Joined:
    Jun 15, 2016
    Posts:
    3
    Hey there, Do you have a support discord or a way I can reach out privately? I'm currently using GPU Instancer and GPU Crowd as well in tandem. Is that' supported?
     
  31. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,
    you can always use our support mail to reach us. If you explain how you are using GPUI and CA together in your mail, we can help you clarify any questions.
     
  32. psych77

    psych77

    Joined:
    Mar 1, 2017
    Posts:
    55
    Hi,

    Will IK get implemented?
     
  33. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,179
    Thanks, I finally found an hour to check out your asset. I have to say it's most impressive, you guys did a great job. I especially like your demo scenes, they are very helpful to easily get into your asset. I have a few questions if I may:

    * Is there a way to select only specific animations for baking? It would be very helpful for testing. The Malbers assets usually have 100+ animations and baking all of them always takes a few minutes (which is quite fast though for this)

    * Is it possible to improve the quality of the baked animations? eg the hair look a bit blocky when you look closer

    * Regarding Randomizer: It would be cool if the position could be more randomized, currently all the instances are positioned in straight lines. Maybe also use a noise for the placement? Also the size consideration would be nice, eg the horses are one after the other:

    h.jpg
    * is it possible that there's a problem with hidden gameobjects? eg I got console errors regarding Armor001 and noticed that it was hidden. I deleted it and all was fine afterwards

    armor001.png

    * When I click on a horse in the scene it looks like this:

    dbg.png
    Not sure if it's something you need to consider, so just fyi. The transform of the HorseBig model which I used has a rotation of x=-90

    Thank you very much!
     
  34. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,179
    Feature Requests:

    * it would be very nice if there were a possibility to move instances of particles with the crowd. example: the duststorm here should move with the flock:

    pc.jpg
    * it would be nice if there were an option to have all navmesh agents move at the same time; here's eg how Brackey's solved that problem:

     
  35. peeka

    peeka

    Joined:
    Dec 3, 2014
    Posts:
    113
    Hi,

    Love the asset, a quick question, where does the baked animation go? need to know so I can looking into what effect it will have on load time etc.

    Thanks.
     
  36. shehaboftheyear

    shehaboftheyear

    Joined:
    Jul 8, 2013
    Posts:
    1
    Hi,

    The is great and I already got it. Just two problems that I encounter are:

    1- Errors on the PS4:
    Shader error in 'CSSkinnedMeshAnimate.compute': Program 'CSAnimateBones', ambiguous call to 'mul'. Found 6 possible candidates: at kernel CSAnimateBones at CSSkinnedMeshAnimate.compute(55) (on ps4)

    Shader error in 'CSSkinnedMeshAnimate.compute': Program 'CSBonesFixWeights', ambiguous call to 'mul'. Found 6 possible candidates: at kernel CSBonesFixWeights at CSSkinnedMeshAnimate.compute(55) (on ps4)

    Shader error in 'CSSkinnedMeshAnimate.compute': Program 'CSAnimateBones', ambiguous call to 'mul'. Found 6 possible candidates: at kernel CSAnimateBones at CSSkinnedMeshAnimate.compute(69) (on ps4)

    Shader error in 'CSSkinnedMeshAnimate.compute': Program 'CSBonesFixWeights', ambiguous call to 'mul'. Found 6 possible candidates: at kernel CSBonesFixWeights at CSSkinnedMeshAnimate.compute(69) (on ps4)

    2- It is not working On IOS as the if the textures baked is not the same size of the mesh like an anomaly.
     
  37. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    523
    Hi there,

    We will certainly look into implementing an IK solution, however currently we do not have a clear roadmap for this and the process will be quite experimental. So we can not guarantee it at this time.
     
  38. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    523
    Hi Rowlan and thanks!

    Crowd Animations gathers the animation clips from the Animator on the prefab, so that it can run all the clips on the animator. If you want to make quick tests, you can use a dummy animator controller on your prefab which includes only the desired animation clips.

    Currently CA uses weights from maximum 4 bones for each vertex for GPU skinning. And the frame rates can be edited from the manager. If the model is using more than 4 bones for the animations it might look slightly different when rendering with GPUI. While the max bone count can be increased, it wouldn't be ideal for using with crowds, because it would increase the performance costs exponentially. If possible, it would be better to modify the model to use max 4 bones.

    Randomizer component controls only the animation clips for the Crowd Animator workflow. The placement/distances are implemented specifically for the demo scene. We will look into adding these options for the demo scenes for testing your own models easier.

    We will look into this. Thanks for the feedback.

    Unity uses an outline/selection shader to visualize the selected renderers. What you see there is the outline of the original mesh without the GPU skinning applied.
     
  39. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    523
    Thanks for the feedback. We will provide examples/explanations for implementation of similar systems in the future.
     
  40. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    523
    Hi there,

    You can find the prototype data and baked animation textures under the GPUInstancer/PrototypeData/Crowd folder.
     
    peeka likes this.
  41. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    523
    Hi there,

    Thank you for reporting this issue. It looks like the shader has compatibility problems with PSSL. We will fix this in the next update. You can contact us from the support mail so we can send you the fix beforehand.

    The GPUI core package supports mobile platforms, but the Crowd Animations Extension does not support them. The reason for this is that the GPU skinning techniques used by Crowd Animations introduce further GPU requirements (e. g, additional buffers) which would not be an ideal solution for use with most mobile platforms.

    You can take a look at the minimum requirements for both packages from this link:
    https://wiki.gurbu.com/index.php?title=GPU_Instancer:FAQ#What_are_the_Minimum_Requirements.3F

    We will consider the possibility of mobile support after the BETA phase.
     
  42. inventonater

    inventonater

    Joined:
    Nov 16, 2014
    Posts:
    4
    Thanks for an awesome plugin, its very impressive!

    Please consider mobile support! I unfortunately bought this thinking it could do mobile and was sad to realize only the base package can.

    How likely would this addition be in the future?

    Again, thanks for the great work!
     
    madrobotMK likes this.
  43. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Thanks for the kind words!

    As we mentioned above, GPU skinning techniques used by Crowd Animations introduce further GPU load (additional buffers, compute shader operations, etc.) which might not be ideal as a generic solution when used with mobile platforms. We will investigate the potential in this area, and can only comment about its likelihood afterwards.
     
  44. paulodgn

    paulodgn

    Joined:
    Jul 19, 2016
    Posts:
    12
    Looks very interesting indeed. grats.

    Does it support mobile VR? Currently developing for the Oculus Quest wich suports OpenGL ES 3.1. Has anyone tryed yet?
     
  45. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,
    Crowd Animations currently does not support mobile platforms. You can see the minimum requirements here.
     
  46. DavyM

    DavyM

    Joined:
    Jun 13, 2018
    Posts:
    4
    Hey,
    After importing the asset I'm getting the following errors:
    (Using Unity 2018.4.0f1)

    Assets/GPUInstancer-CrowdAnimations/Demos/CrowdAnimationsDemo/Scripts/CrowdAnimationsDemoSceneHandler.cs(81,29): error CS1502: The best overloaded method match for `GPUInstancer.GPUInstancerAPI.RegisterPrefabInstanceList(GPUInstancer.GPUInstancerPrefabManager, System.Collections.Generic.IEnumerable<GPUInstancer.GPUInstancerPrefab>)' has some invalid arguments

    Assets/GPUInstancer-CrowdAnimations/Demos/CrowdAnimationsDemo/Scripts/CrowdAnimationsDemoSceneHandler.cs(81,74): error CS1503: Argument `#2' cannot convert `System.Collections.Generic.List<GPUInstancer.CrowdAnimations.GPUICrowdPrefab>' expression to type `System.Collections.Generic.IEnumerable<GPUInstancer.GPUInstancerPrefab>'

    How to fix this? I also don't see the
    Tools -> GPU Instancer -> Add crowd manager option popup.

    A screenshot from the demo scene is below.
     

    Attached Files:

  47. snacktime

    snacktime

    Joined:
    Apr 15, 2013
    Posts:
    3,356
    Does this handle bone weights correctly for blending? That has been the main thing none of the other assets that do instanced skinning do correctly. Layers would be awesome but just correct blending I'd pay for.
     
  48. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,
    it looks like the compiler version you are using cannot cast the class automatically. Can you try editing the following line in the file CrowdAnimationsDemoSceneHandler.cs and see if it solves the problem:

    Line 55:
    List<GPUICrowdPrefab> instanceList = new List<GPUICrowdPrefab>();

    into:
    List<GPUInstancerPrefab> instanceList = new List<GPUInstancerPrefab>();
     
  49. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,
    GPUI uses 4 bones per vertex to calculate blending. The blending would be right as long as the rig relies mostly up to 4 bones for a given vertex for the animation effect, but if additional bones after 4 changes the animation drastically, you would see unexpected results.

    Also, it can blend up to 4 animations. Masks and Layers are currently not supported.
     
  50. DavyM

    DavyM

    Joined:
    Jun 13, 2018
    Posts:
    4

    Thanks, now it works!

    I see that there is an integrated MapMagic and Gaia feature. Will there also come an integration feature for World Creator 2?
     
    Last edited: Jun 29, 2019