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. Nyphur

    Nyphur

    Joined:
    Jan 29, 2016
    Posts:
    98
    Hey, I'm having real trouble getting one of my shaders to work with GPUI Crowd Animations. It was originally created in Amplify Shader Editor and I edited it manually according to the instructions on the wiki. The GPUI Crowd Manager did accept it as a valid shader but animations don't play. When I hit "Test Animations" the animations do play but the model has a different shader on it, so I suspect I've missed something in my shader. Here's a copy of it, does anything jump out as wrong or missing?

    EDIT: For reference, I'm using the Crowd Animator type workflow, not Mechanim.

    Code (CSharp):
    1. code removed
     
    Last edited: Oct 13, 2020
  2. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Hi again,

    Yeah the main use case I'm thinking of is for hitboxes on NPCs.

    Here's a screenshot of a prototype that I'm making to test CityGen3D compatibility with a variety of assets, as well as showcasing CityGen3D in a game environment.
    It uses GPU Instancer Crowd Anims alongside Opsive Ultimate Character Controller (for player) and A* Pathfinding Project for multithreaded AI.
    The scene is a 1km part of London generated automatically by CityGen3D, and thanks to your asset and Aron's amazing A* Pathfinding, I'm getting over 1000 NPCs running around it, which is lots of fun!

    bad_aim.png

    As mentioned previously, ideally I want to be able to differentiate between head and body collisions (to deal different damage amounts depending on where weapons hit).
    I've not looked that deeply in the Instancing code yet, but is it possible to identify what frame is being played back of the current animation?

    If so, I'm wondering if some sort of solution for the Crowd Anims workflow could be found whereby the bone transforms are stored when baking the anims and then looked up and applied at run-time for accurate hitbox collision tests on Crowd Anim NPCs.

    As I say, I've no idea if that's feasible or if any such solution would end up being too slow, but I just wanted to give a bit more detail about an example use case to keep in mind, as you said you were looking into possible applications and solutions to this.

    Thanks again for a great asset!
     
  3. Nyphur

    Nyphur

    Joined:
    Jan 29, 2016
    Posts:
    98
    If it's a hitscan weapon for a game with thousands of enemies, one highly scalable solution for targeted hits would be to render a special data frame out to a rendertexture when the weapon is fired and then design an instanced shader that encodes the information you want in the colour. For example, you could use the combined red and green channel to encode the instance number (max of 65,535) and then use the blue channel to encode hit location from a texture.

    The main disadvantage of this technique is that it requires an additional draw call to draw the special frame, but you can mitigate that by only drawing it on frames when the weapon fires and limiting the camera area and shader complexity. It would also need some modification to allow you to fire through-shots.

    The advantages are that it's pixel-perfect, scales to bajillions of enemies, and completely eliminates all need for collision detection or rays. You could also look up adjacent pixels in the data texture to add a kind of soft auto-aim or create a hitscan weapon with a cone of effect like a shotgun. I used the technique for a previous game I made, admittedly I built my own engine for that game but the technique should still work in Unity and should work with GPU Instancer.
     
    LouskRad and CityGen3D like this.
  4. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Thanks for this insight, certainly gives me some food for thought.
    I'd love to see an integrated solution like this in GPU Instancer Crowds in future, because a fast hitbox detection system combined with the already super fast rendering, would be great to see and would extend the usability of the system much further.
     
  5. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    At first glance the issue might be the order in which you do the instancing setup:

    void vert(inout appdata_full v, out Input o)
    {
    GPUI_CROWD_VERTEX(v);
    UNITY_INITIALIZE_OUTPUT(Input, o);
    UNITY_SETUP_INSTANCE_ID(v);
    }

    should be:

    void vert(inout appdata_full v, out Input o)
    {
    UNITY_SETUP_INSTANCE_ID(v);
    GPUI_CROWD_VERTEX(v);
    UNITY_INITIALIZE_OUTPUT(Input, o);
    }

    because the crowd vertex setup function depends on the instance IDs.
     
  6. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    We are working on using async readback on the bones for this, and testing the solution for performance. It looks like this solution will require a job system and burst compiler to get the most out of it. But there will still be some performance impact caused by the readback and applying the translation data back to the transforms.

    This will allow for using colliders (and any game object) attached to the bones in the Crowd Animator workflow; but to clarify we have no plans for developing a further improved hitbox detection system.
     
    CityGen3D likes this.
  7. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Thanks for the info, it sounds very promising.
    I'll keep an eye out for further developments in this area.
     
  8. OliverVSmith

    OliverVSmith

    Joined:
    Nov 7, 2017
    Posts:
    51
    Hi, I'm having some issues instantiating Crowd prefabs from an Asset Bundle.
    When dragged into the scene, or spawned from a reference they are fine, however if I use our normal workflow of spawning from Asset Bundles, first they do not register automatically, then I follow what I think is the correct workflow (or close to?)

    Code (CSharp):
    1. GPUICrowdPrefab prefabInstance = SceneObject.GetComponent<GPUICrowdPrefab>();
    2.         GPUICrowdManager gpuiCrowdManager = GameObject.FindObjectOfType<GPUICrowdManager>();
    3.         if ((GPUInstancerPrefabManager)GPUInstancerManager.activeManagerList.Find(manager => manager.prototypeList.Contains(prefabInstance.prefabPrototype)) == null)
    4.         {
    5.             Debug.LogWarning("Not in ActiveManager");
    6.          
    7.             gpuiCrowdManager.DefineGameObjectAsPrefabPrototypeAtRuntime(SceneObject, true);
    8.             GPUInstancerAPI.InitializeGPUInstancer(gpuiCrowdManager);
    9.            
    10.             Debug.Log($"Added Prefab to Runtime and Initialised {gpuiCrowdManager.prefabList.Count}");
    11.  
    12.         }
    13.  
    14.         GPUInstancerAPI.AddPrefabInstance(gpuiCrowdManager, prefabInstance);
    I see the Assets correctly added to the Manager in Scene
    upload_2020-6-18_0-14-56.png
    (Doubled up because I don't clear the prefabs present in the scene already)

    However, I then receive this error every frame
    Any thoughts or help much appreciated.
     
  9. mau_iida

    mau_iida

    Joined:
    Apr 2, 2020
    Posts:
    8
    Hi, I have updated to latest version form GPUI 1.4.0 and GPUICrowd 0.93 with my current project.
    Then the GPUICrowdPrefab.crowdAnimator got lost, it always been to null.
    I have tried to rebake the animations, and delete the prototype and add them again. it just gets the same result.
    Do you have any idea about this?
     
  10. LouskRad

    LouskRad

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

    the method DefineGameObjectAsPrefabPrototypeAtRuntime is designed for the base GPUI and currently it is not tested with Crowd Animations. It might be that additional steps are necessary to make it work with handling the baked animation data. We will take a look at this, but for now you can debug and see what data is missing and set them manually.
     
  11. LouskRad

    LouskRad

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

    It might be that once you updated the packages and re-baked the animations, the selected workflow in your manager has switched to the Mecanim Workflow. Please make sure the Crowd Manager indicates that you are using the Crowd Animator workflow and see if this helps.
     
  12. Korsigon

    Korsigon

    Joined:
    Oct 6, 2014
    Posts:
    16
    I'm using the Crowd Animator type workflow and it's all fine until my baked right turn and left turn animations get the sheep stretched out. The faster the sheep turn , the faster the sheep grows and never stops growing. All other animations are okay. There's no issue when using the Mecanim Animator workflow. What could be wrong? Thanks.
    Note: The instanced sheep are from a single prototype. The baked animation gets stretched in the x-z plane. The height remains the same.

    ExpandingBakedAnimation.png
     
  13. Draxi_

    Draxi_

    Joined:
    Sep 6, 2015
    Posts:
    7
    Hi,
    I'm making a military strategy game with VR support.
    I'm using optional renderers for weapons on the soldiers. (1 skinned mesh renderer weight painted to the hand for each weapon).

    Issue #1
    When trying to use transitions in the Crowd Animator workflow the weapons are getting delayed by 1 animation.

    For example when I set the animation to run and then set it to crouchwalk, the soldier would transition perfectly from running to crouchwalking but the weapons would keep doing the running animations (floating near the soldier's head).

    I also found the same issue on the optional renderer demo. When I change the GPUICrowdAnimatorRandomizer script, by adding the transitionTime parameter to the StartAnimation method, limbs of the bunnies would start doing the same things as the soldier's weapons.
    Video:


    Issue #2
    When changing between animations the weapons sometimes jump to a different soldier so some of them have no weapons and some have multiple weapons flying next to them. They are playing the animation of the soldiers that are supposed to hold them but they appear at different soldier's transform.

    Each soldier has a script with methods to:
    - change weapon (turn off the active weapon gameobject and turn on the other)
    - change animation by using the GPUI Crowd API

    and there is coroutine that uses these methods and goes through some animations.
     
  14. mau_iida

    mau_iida

    Joined:
    Apr 2, 2020
    Posts:
    8
    Hi, still have the issue.
    Actually the Instance hasn't been created..

    Any idea why GPUInstancerPrefabManager.Awake() won't be called when I play on Editor? but when I stop Awake() is called from editor script. In our project, we have create a prefab for the GPUIManager, and use the reference in the scene. Not sure why the v1.4.0 could work well.
     
  15. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Thank you for the feedback.

    This could be related to the model's rig. If you can email us a sample project so we can investigate this issue.

    Thank you for the feedback.

    We have not tested the optional renderers feature in such use cases. We will look into these and provide the necessary fixes in a future update.

    It might be related to the new Unity editor features that are under the Project Settings -> editor:

    upload_2020-7-3_19-4-10.png
     
  16. KD_W

    KD_W

    Joined:
    Feb 9, 2015
    Posts:
    19
    Hi is there a way to bake animation which meshes are inside joints and use animation event to hide and display them?
    Capture.PNG
     
  17. sordidlist

    sordidlist

    Joined:
    Sep 2, 2012
    Posts:
    86
    Hey, thanks for creating this wonderful tool!

    I'm still working my way through documentation and examples, but is it the recommended practice to have one separate gameobject/script that handles all the changes to instance animations, as opposed to having a script on each character that handles the transitions individually? I'm hoping to do something similar to what you did in the navmesh demo scene, where I have a bunch of simple characters who just need to be able to move around.
     
  18. LouskRad

    LouskRad

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

    Crowd Animations v0.9.5 is now available on the Asset Store. With this version, there will be some important changes to GPUI that you can read from this forum post.

    Unity versions: To support the new and changing features of Unity, new Crowd Animations versions from v0.9.5 on will now only officially support Unity 2019.1.10 and later versions. The latest version before this (v0.9.4) will still be available to download and you can use it for Unity versions before 2019.1.10.

    Async Bone Updates: This version brings support for attachment object via async bone updates for the Crowd Animator workflow. Please check the wiki for further information.

    Important: This version requires GPU Instancer v1.4.2 or later. Please note that all animations need to be re-baked after this update. Please also make sure to backup your project if you are updating from a previous version of Crowd Animations.

    Here is the full changelog for CA v0.9.5:

    New: Added Async Bone Updates feature for Crowd Animator workflow
    New: Added Assembly Definition files
    New: Added Depth Normals shader to be able to use post processing effects like Ambient Occlusion in Forward Rendering mode

    Fixed: Transitions not reaching to the end weights in some cases
     
  19. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,
    Crowd Animations only bakes Skinned Mesh data, and not data for attached Meshes. If you are using the Mecanim Animator workflow, you can simply enable/disable the game objects that are attached to your bones. If you are using the Crowd Animator workflow, you can now (with CA v0.9.5) use Async Bone Updates for your attached objects.

    Handling your crowd from a single script would generally be more ideal since you will only use a single Update loop instead of per character. This will also result in a more memory efficient solution.
     
    sordidlist likes this.
  20. sordidlist

    sordidlist

    Joined:
    Sep 2, 2012
    Posts:
    86
    Appreciate the quick response and thorough documentation.

    FYI, I stumbled upon a small typo just now in NavMeshDemoSceneController.cs, I believe "SpawnLoacation" was meant to be "SpawnLocation", though it doesn't affect anything functionally and I had no trouble following what to do.
     
  21. OliverVSmith

    OliverVSmith

    Joined:
    Nov 7, 2017
    Posts:
    51
    Hi, I sent a support request email about this and haven't heard back.

    Is there a better process I should be following in order to spawn gameobjects (that have already been baked, then added to an Asset Bundle) to work with Crowd Animations?
     
  22. sordidlist

    sordidlist

    Joined:
    Sep 2, 2012
    Posts:
    86
    I'm not the app developer but if you're only wanting to spawn pre-baked GPUICrowdPrefabs, I've had a lot of luck following the NavMeshCrowdDemo.cs (or something along those lines), it's the example where the chomper creatures navigate to where you click on the ground. Specifically check out the AddAgents() method for inspiration. I hope that's helpful, and sorry if I misunderstood your question.

    EDIT: as for Asset Bundles, I haven't done it myself but I'd think if you loaded the crowd prefab into memory before trying to spawn with the crowd manager, you should be okay.

    EDIT 2: One other thing is to make sure your crowd manager has auto-registering new instances enabled, as it's disabled by default.
     
  23. OliverVSmith

    OliverVSmith

    Joined:
    Nov 7, 2017
    Posts:
    51
    So looks like I've resolved this.
    Not sure if I was overthinking or misunderstanding, and still not totally sure this is the correct way, but now I load in the Asset from the Bundle that has had its Animation already baked, get the GPUICrowdPrototype from the GPUICrowdPrefab component on the Asset, add that directly to the GPUICrowdManager.prototypeList, and finally disable and then enable the Manager component.

    I'm sure there must be a better way of doing this, or maybe this is just the way to make it work at runtime since it's still Beta?

    So my test code looks something along these lines.
    upload_2020-7-12_16-49-30.png

    Thanks for the tip GrowlingEgg, wasn't directly helpful, but it did lead me to delve a LOT more into the code to figure out the secret sauce. It's wild and whacky and just seems to not be directly/seamlessly supported at the moment, but the workaround works (so far)
     
    sordidlist likes this.
  24. OliverVSmith

    OliverVSmith

    Joined:
    Nov 7, 2017
    Posts:
    51
    Run into another issue now unfortunately. Need to be able to turn off Receiving Decals in the HDRP (7.3.1) Material.
    We had to switch to a pure HDRP Lit for the Material as our custom Shadergraph Shader wasn't being recognised as being able to be used for GPU Instancing (although.. Unity said it was?).
    On the Material we can disable Receiving Decals, but when using the Instanced animated Crowds, they receive decals.

    Any help on this would be very much appreciated.
     
  25. pierre92nicot

    pierre92nicot

    Joined:
    Aug 21, 2018
    Posts:
    57
    Hi, I have errors when I enter play mode :
    First

    ArgumentException: An item with the same key has already been added. Key: -214092133
    System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <e1319b7195c343e79b385cd3aa43f5dc>:0)
    System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <e1319b7195c343e79b385cd3aa43f5dc>:0)
    GPUInstancer.CrowdAnimations.GPUICrowdUtility.SetAnimationData (GPUInstancer.CrowdAnimations.GPUICrowdRuntimeData runtimeData) (at Assets/GPUInstancer-CrowdAnimations/Scripts/Core/Static/GPUICrowdUtility.cs:67)
    GPUInstancer.CrowdAnimations.GPUICrowdRuntimeData.InitializeData () (at Assets/GPUInstancer-CrowdAnimations/Scripts/Core/DataModel/GPUICrowdRuntimeData.cs:37)
    GPUInstancer.GPUInstancerUtility.InitializeGPUBuffer[T] (T runtimeData) (at Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:130)
    GPUInstancer.GPUInstancerUtility.InitializeGPUBuffers[T] (System.Collections.Generic.List`1[T] runtimeDataList) (at Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:30)
    GPUInstancer.GPUInstancerPrefabManager.InitializeRuntimeDataAndBuffers (System.Boolean forceNew) (at Assets/GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:184)
    GPUInstancer.CrowdAnimations.GPUICrowdManager.InitializeRuntimeDataAndBuffers (System.Boolean forceNew) (at Assets/GPUInstancer-CrowdAnimations/Scripts/GPUICrowdManager.cs:345)
    GPUInstancer.GPUInstancerManager.OnEnable () (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:204)
    GPUInstancer.CrowdAnimations.GPUICrowdManager.OnEnable () (at Assets/GPUInstancer-CrowdAnimations/Scripts/GPUICrowdManager.cs:107)

    and this one looping

    NullReferenceException: Object reference not set to an instance of an object
    GPUInstancer.CrowdAnimations.GPUICrowdManager.UpdateAnimatorsData (GPUInstancer.CrowdAnimations.GPUICrowdRuntimeData runtimeData) (at Assets/GPUInstancer-CrowdAnimations/Scripts/GPUICrowdManager.cs:485)
    GPUInstancer.CrowdAnimations.GPUICrowdManager.LateUpdate () (at Assets/GPUInstancer-CrowdAnimations/Scripts/GPUICrowdManager.cs:257)

    There is no error in the GPUICrowdManager when I select a prototype.
    I use the mecanim workflow, standard shader and unity 2018.4, the animation are baked and all demo scenes work.
    I have tried to delete GPUI and CrowManager before reimporting GPUI first then CrowManager but without success.
     
    Last edited: Jul 16, 2020
  26. KD_W

    KD_W

    Joined:
    Feb 9, 2015
    Posts:
    19
    Async Bones option is causing memory leaking.
     
  27. niflying

    niflying

    Joined:
    Jul 11, 2012
    Posts:
    108
    I find that the animation not the same as the original.
    Check this out please

    upload_2020-7-18_22-38-36.png

    You could see that the original one is more smoother than others.
    I've change the material but nothing changed.
    upload_2020-7-18_22-39-40.png

    Please help.
     
  28. Draxi_

    Draxi_

    Joined:
    Sep 6, 2015
    Posts:
    7
    Hi,
    the new Async Bone Updates work great! It solved my issue with optional renderers. (which I think you should still look into because you can't really use transitions with optional renderers right now)

    I have a question.
    Would it be any more efficient to have an option to update only some bone transforms like you can do with exposing mecanim bones? I feel like it's wasting performance by updating all transforms and not only the ones I need. (for example right hand for holding stuff)
     
  29. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Thank you for the feedback.
    Currently Crowd Animations does not offer a shader graph node for custom shaders. As for always receiving decals on the supplied lit shader, we will investigate this.

    Hi there,

    CA holds clips and states in the dictionary that you get the error from. It looks like for some reason, a state (or a clip) is not unique when being added to the manager. We can investigate this issue if you send us a sample project showing this.

    If you can tell us the details, we can investigate this issue.

    Hi there,

    We will investigate this, can you please tell us which Unity and HDRP versions you are using?

    Thank you for your feedback.
    We will do more tests and improvements on this feature for the following updates.
     
    pierre92nicot likes this.
  30. OliverVSmith

    OliverVSmith

    Joined:
    Nov 7, 2017
    Posts:
    51
    Thanks, if there's any way that the decals issue could be fixed ASAP, that'd be great. Looming deadline I'm afraid
     
  31. pierre92nicot

    pierre92nicot

    Joined:
    Aug 21, 2018
    Posts:
    57
    Hi, I have renamed some redundant animator state and now I have no more errors.
    But now I have this log looping :

    GPUI Mecanim Animator can not find state: UnityEngine.AnimatorStateInfo
    UnityEngine.Debug:Log(Object)
    GPUInstancer.CrowdAnimations.GPUIMecanimAnimator:UpdateDataFromMecanimAnimator(GPUICrowdRuntimeData, Int32, Animator, List`1) (at Assets/GPUInstancer-CrowdAnimations/Scripts/Core/AnimatorWorkflow/GPUIMecanimAnimator.cs:27)
    GPUInstancer.CrowdAnimations.GPUICrowdManager:UpdateAnimatorsData(GPUICrowdRuntimeData) (at Assets/GPUInstancer-CrowdAnimations/Scripts/GPUICrowdManager.cs:485)
    GPUInstancer.CrowdAnimations.GPUICrowdManager:LateUpdate() (at Assets/GPUInstancer-CrowdAnimations/Scripts/GPUICrowdManager.cs:257)
     
  32. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    177
    Hi,

    The "Bake animations" button is broken in Unity 2020.1 ! Probably due to the new Editor Progressbar implementation in Unity 2020...
     
  33. OliverVSmith

    OliverVSmith

    Joined:
    Nov 7, 2017
    Posts:
    51
    Any progress on this one?
     
  34. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    It seems that I need to clarify a point. When CA detects that you use the HDRP Lit material on a skinned mesh, it uses its own shader when rendering the mesh. This shader however is a lot more limited that the original Lit shader, and among other things, decals are also not supported by it.

    However, In the next update we will add a ShaderGraph node for crowd animations which will allow you to use your custom ShaderGraph shaders with it. For convenience, I will attach the node here so that you don't have to wait the update to use it.

    You can use the node as follows:

    image_2020_07_28T01_01_06_028Z.png

    For this to work with your existing Crowd Animations, however, you need to make the following changes in the GPUICrowdUtility.cs file:

    Line 373:
    return originalShaderText.Contains("GPUICrowdInclude.cginc") || originalShaderText.Contains("GPUI Crowd Setup");
     

    Attached Files:

  35. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    We can't replicate this in our tests. Please check if any additional packages you might be using is causing this issue.
     
  36. LouskRad

    LouskRad

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

    I just wanted to let you know that the GPU Instancer team will be on a summer break until September 1st. We will be answering all the questions and support requests after the break.
     
    marcmantraunity likes this.
  37. marcmantraunity

    marcmantraunity

    Joined:
    May 31, 2014
    Posts:
    21
    Hi @LouskRad I'm trying to add the shader code inside my custom shaders done using Amplify and I can't find the solution. GPU Crowd always alert me can't find a correct shader and it try to change the shader. The system goes well using your standard shader, but I can't find a solution using ASE.
    I'm trying on built-in render pipeline, unity 2019LTS and ASE 1.83, I follow step by step but seems I miss something I can't find.
    Is it correct? Thanks in advance

    upload_2020-7-31_19-5-30.png
     
  38. marcmantraunity

    marcmantraunity

    Joined:
    May 31, 2014
    Posts:
    21
    Another update which show me no animation and albedo, black result. But seems to be better as I'm using vertex and normals...

    upload_2020-8-5_12-40-34.png
     
  39. OliverVSmith

    OliverVSmith

    Joined:
    Nov 7, 2017
    Posts:
    51
    Huge thank you for this! It's working great
    Hope you all have a good break.
     
    LouskRad likes this.
  40. VirtusH

    VirtusH

    Joined:
    Aug 18, 2015
    Posts:
    95
    Having 'Use Root Motion' ticked on a prototype with no root motion in the animation ends up with Matrix4x4.IsValid throwing an exception from deep within GPUI code. It took me quite a while to localize the problem, and I'm quite sure I never ticked 'Use Root Motion'.
     
  41. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    6,203
    Current limitation: don't support light probes, since LPPV are 3d textures, do these work?
     
  42. VirtusH

    VirtusH

    Joined:
    Aug 18, 2015
    Posts:
    95
    upload_2020-8-30_17-53-45.png

    Crowd Manager Editor throws a fit if you recreate a prefab it's referencing. This makes sense, but the crowd manager should really be able to handle a missing prefab reference. :\

    Even worse, this issue breaks the inspector completely, meaning I may have to just reset the whole component and lose all my settings....
    upload_2020-8-30_17-56-53.png

    For now I'm going to see if I can 'fix' it with another script or with some modification to the editor code. :\
     
  43. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    We have not tested custom CA shaders made with ASE. If you can send us your shader we can investigate the issue and try spotting the problem.

    Thank you for the feedback. We will look into this issue.
     
  44. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    177
    Hi,
    After upgrading my project to URP (URP 8.2 ; Unity 2020.1.6f1) Crow Manager stopped working (My skinned mesh in not visible anymore when Crowd Manager GO is ACTIVE; No error on Console).

    re-baking animation; Clear Shader Binding; Clear Shader variants dont fix the issue.

    I'm also getting this error on GPUI Crowd Manager (on all of my Prototype) :



    Any idea of what can cause this? Do i have to install specefic shader for URP (already installed the "GPUI-CA_URP_7_Shader" in Extra folder) ?

    Thank you for your help.
     
    Last edited: Sep 23, 2020
  45. LouskRad

    LouskRad

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

    if you have changed pipelines in your project, there is a chance GPUI did not follow that operation. You can open the Preferences window (Edit -> Preferences -> GPU Instancer) and click the "Reload Packages" button in that window.
     
    amynox likes this.
  46. HakJak

    HakJak

    Joined:
    Dec 2, 2014
    Posts:
    192
    Does this work with blendshapes?
     
  47. LouskRad

    LouskRad

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

    blend shapes are not supported.
     
  48. VirtusH

    VirtusH

    Joined:
    Aug 18, 2015
    Posts:
    95
    Hi,

    In many ways we love GPUI Crowds, the power it offers is incredible. However, we've had numerous issues with it, issues that are inhibiting our intended use.

    Context - What we're doing with GPUI Crowds:
    We've split our crowd models into 4 parts (hair, head, bodyTop, bodyBottom) and we've got a data-driven system to generate variations at runtime. In our data (Scriptable Objects), we've got these instances defined for our purposes, so using reflection I call the GPUI method that adds prototypes to the Manager so we can theoretically scale up our use of variations. We then bake all the animations and whatnot, then set the animator type and untick root motion. Everything is handled GameObject-less for scalability. While GPUI does seem to support adding prototypes at runtime, I don't see any way to prebake all the animation data. Further it seems reasonable to me that I should be able to programmatically add prototypes to the manager, but there is no clear path to do so that I've seen.

    Our perspective:
    Trying to use the crowd pipeline by click-dragging in the inspector and hoping for the best is just not feasible for our project. We're planning at the very least to have many tens of variation objects, and crowds of thousands. We have got all this working rather painfully, though it continuously breaks down and pushing it through Git has only been more problematic. We recognize that this software is not in it's final form yet, and hope that we can both see our problems solved and help improve GPUI Crowds for everyone!

    When it's working:


    Core Problems:
    • Some or all Crowd Manager prototypes simply disappear, sometimes on play, sometimes when reloading the scene, and always when it interacts with Git in any way. All we've been able to do to combat this is add more automation to our side of the pipeline and regenerate everything. Sometimes we'd even have to delete all the prototype data. Regenerating everything is extremely time-consuming.
    • Root motion toggle constantly does not save, usually only on random prototypes. As a sanity workaround we had to add a button that accesses the prototype list and changes the values.
    • I still don't fully understand why, but I had a nightmare trying to bake animations for certain objects. I can't tell if it has to due with the animation controller, avatar settings, animation compression, all or something else... Ultimately there are just so many pitfalls with animation baking, where an animation will work with standard Unity animation, and then just not bake correctly with no errors or anything. I'm not sure what can be done about this, except to have more info on the wiki, or more analysis internally to detect baking issues.
    • Configuring the Crowd Manager and it's prototypes from script seems to have no explicit support. So far I've had to use reflection, or reach into exposed variables to manage things. It seems possible that what I'm doing could be causing some of the prior issues, but I'm taking the only route I can find to support the pipeline we need.

    Thank you, and let me know if you need more information. :)
    If it comes down to it, we're prepared to give access to the project.
     
  49. Draxi_

    Draxi_

    Joined:
    Sep 6, 2015
    Posts:
    7
    Hi,
    while trying to add VR support to our game we ran into some problems.

    We're using:
    • Unity 2020.1.6f1
    • GPU Instancer 1.4.2
    • GPU Instancer - Crowd Animations 0.9.5
    • HDRP 8.2.0
    • Burst 1.3.7
    • XR Plugin Management 3.2.15
    • OpenVR XR Plugin 1.0.1 (SteamVR)
    I created a new project only with these assets and also ran into the same issues.
    With Single Pass Instanced stereo rendering: (we will use this one for performance boost)
    • characters in random places "flicker", sometimes only in one eye
    • errors with async bone readback turned on
    With Multi Pass stereo rendering:
    • shadows only in left eye
    • errors
    I tested it with 1000 instances.
    I feel like the async readback issue is caused by newer version of Burst and the rest of the things are caused by the way XR renders the scene?
    Same issue with the flickering came up when using GPU Instancer (non-crowd).



    Thank you for this amazing asset once again and I hope the issues will have some simple fix.
     
  50. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there, and thank you for your detailed feedback.

    On programmatically adding prototypes to the manager; the methods to add the prototypes to a manager at runtime are all public. However, baking is not intended to be done during runtime. Instead, CA currently supports using bake data from other prototypes. Using this, you can bake all the animation data prior to runtime and programmatically build your prototypes using these data at runtime. For example, you can bake the animation data for a generic human rig that you are using, and use the same bake data on all the variations that use the same rig at runtime. We will look into adding a demo scene to exemplify this usage.

    As for the root motion toggle, it takes the "Apply Root Motion" toggle value on the animator that is being used to bake the prototype animations. So on every bake, it will reset to the value on the animator.

    On configuring the Crowd Manager and it's prototypes from script, what specific fields are you having trouble with? We intentionally took care for most of the internal fields to be easily accessible - those that would make sense anyway.

    I cannot provide a generic response for the git issues and the issues you have for certain objects. However, if you can provide more specific information on these (maybe a sample scene and/or code) we can investigate those issues specifically.
     
    VirtusH likes this.