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.

[RELEASED] GPU Instancer - Crowd Animations

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

  1. Mic_Emond

    Mic_Emond

    Joined:
    Nov 16, 2016
    Posts:
    44
    Hello again,
    I have a situation where all my sub-objects of prototypes get unparented after calling AddPrefabInstance on the CrowdManager.

    My setup is:
    - ROOT
    - MESH
    - Root_Bone
    - bone (21 bones hierarchy)​
    - object with logic
    - object with logic child 1 (2, 3 etc)​

    After doing AddPrefabInstance
    The hierarchy in the scene gets flattened, even for the "object with logic" children. Meaning it's now:
    -ROOT
    - MESH
    - Root_bone
    - bone child 1
    - bone child 2
    - object with logic
    - object with logic child 1
    - etc
    All at the same level as "mesh".
    I've tried debugging etc, I can't see where this unparenting is happening.
    If I DONT use "sync bones". None of the bones are in the hierarchy, but the rest is still flatened.

    The model is setup with the "optimize gameobjects" option to OFF.
    I tried a prototype that was setup as a variant of the original fbx model. And a prototype with a original prefab created from the base model after doing "unpack" on the model.

    Could really use some help with this one, I've been bashing my head against it for a couple of days.

    EDIT:
    I've add some success with the following setup:
    NEW ROOT
    MODEL ROOT (keep link)
    Bone root
    bone 1 ,etc
    Attachement weapon​
    Object with logic
    Colliders
    Etc

    The bone hierarchy still gets flattened (only the ones with attachments show up)
    But the weapon attached now doesn't get flattened. Neither does anything "outside" the model root.

    Would still appreciate a pointer on what is happening here? In the demo for attachment, the whole bone hierarchy is there also. (which I don't mind, but would be nice that GPUInstancer affect only specific objects/ bones and not the whole hierarchy :/ )
     
    Last edited: Mar 28, 2023
  2. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    440
    Hi there,
    Crowd Animator requires to flatten the hierarchy by design so the transforms can be processed individually, used in suitable data structures in the GPU and modified in threads. So unfortunately there is not an option to keep the hierarchy.
     
  3. mrCharli3

    mrCharli3

    Joined:
    Mar 22, 2017
    Posts:
    876
    please check support email
     
  4. Raptor2k2

    Raptor2k2

    Joined:
    Jun 8, 2013
    Posts:
    2
    Hi, we've been considering integrating this plugin to our project. Our project is heavily based on the animator but the performance gain that we obtain using crowd animator are impressive enough to justify refactoring our codebase. One thing that I feel is missing is to have the equivalent of the OnAnimatorMove callback. We need to have root motion informations without the plugin updating transforms automatically. I can see where and how the plugin handle root motion and update transforms in a job. Any suggestion on how we could get position / rotation delta inside a MonoBehaviour?
    I've been able to hack my way by passing additional native arrays to the root motion jobs and preventing the job to change the transform access array but it's super messy and I'd rather have an official way of doing it
     
    Last edited: May 19, 2023
  5. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    440
    Hi there,
    If you need to calculate the position / rotation change from the previous frame, you can store the information and calculate the difference in a MonoBehaviour.
    Crowd Animator does not have a built-in way of doing it because it would slow things down to add callbacks or make additional calculations and store additional data.
     
  6. Abbrew

    Abbrew

    Joined:
    Jan 1, 2018
    Posts:
    411
    Hello, I'd like to know which is faster in these hypothetical scenarios:

    40,000 instances, each one with 300 triangles
    8,000 instances, each one with 1,500 triangles

    Basically, what's the tradeoff between having many low-poly instances, and few high-poly instances? Which is more of a drain on performance - poly count, or instance count?
     
  7. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    1,964
    I would say.
    8k instances is better.
    You will have your mesh stored on a gpu so only transformations are going to be sent.
     
    GurhanH likes this.
  8. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    440
    Hi there,
    Usually having higher instance count with lower triangles is better with GPU instancing rendering performance. But as @koirat mentioned, if you are making transform updates every frame, it might cause a bottleneck because of higher data transfer to GPU.
     
    Abbrew likes this.
  9. Mic_Emond

    Mic_Emond

    Joined:
    Nov 16, 2016
    Posts:
    44
    Hello,
    Any plans on supporting Vulkan on PC ?
    The asset store page shows that it should support Vulkan for Android. Figured I'd try, but I'm getting errors when trying to use it on Windows.
     
  10. zkajo

    zkajo

    Joined:
    Jul 28, 2016
    Posts:
    9
    I'm trying to expose some transforms on my prefab. I tried with only one or two, but the following test contains all of them. I'm using crowd animator.

    Only one is ever exposed - rest are missing (deleted). Why does it happen? I can't find anything in the documentation.





    Also, I'm getting some nasty deformations like here which do not happen in original animations. Is there any way to prevent that?

     
  11. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    440
    Hi there,
    We did not see any issues using Vulkan on PC during our tests. Can you please make a detailed bug report following this guide so we can investigate.
     
  12. daoviettuan2002

    daoviettuan2002

    Joined:
    Nov 5, 2018
    Posts:
    9
    Hi Sir,
    I have a question. Can I get value isfrustum of player when player inside camera or outside? I checked Use Frustum Culling is enable.