Search Unity

[RELEASED] GPU Instancer - Crowd Animations

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

  1. unity_zw6QHpcgpJfeDA

    unity_zw6QHpcgpJfeDA

    Joined:
    Mar 23, 2018
    Posts:
    6
    Lovely Asset! I use it for characters with equipment (normal MeshRenderer objects which can be activated/deactivated dynamicallly) how can these be combined with this tool, to work properly?
     
  2. LouskRad

    LouskRad

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

    You can use the Enable Async Bone Updates feature for this. This will update the bone transforms (and attachments under them) by reading back from the GPU asynchronously.
     
  3. aganm

    aganm

    Joined:
    Sep 25, 2019
    Posts:
    114
    Does this work with an asset like Final IK and Puppetmaster?
     
  4. GurhanH

    GurhanH

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

    Crowd Animations currently only works with baked animation data, which means editing bones at runtime is not possible. So it will not work with Final IK or Puppetmaster.
     
  5. Feldruebe

    Feldruebe

    Joined:
    Jun 11, 2015
    Posts:
    5
    Hello,

    I am using the mecanim workflow with exposed transforms an automatic transform updates. The problem that I am facing is that when I attach other objects to them I get a displacement when moving. I figured out that this displacement vanishes if I move the object in FixedUpdate. Is there something I can do about this?
     
  6. LouskRad

    LouskRad

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

    It might be related to script execution order. In that case, you could try moving your movement script to work before the Crowd Manager.
     
  7. Resonantmango

    Resonantmango

    Joined:
    May 28, 2017
    Posts:
    7
    Thanks for the asset! What is the possibility for adding mobile support? (My company is willing to negotiate terms to make this a priority if you are open to discussion)
     
  8. LouskRad

    LouskRad

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

    The issue regarding mobile support is not one of implementation but rather one of performance. In comparison with the base GPUI package, Crowd Animations uses the GPU of the target platform even further with bone calculations, which beats the purpose in low powered GPU systems such as mobile devices. With that, mobile support is not in our roadmap for the near future for Crowd Animations.
     
  9. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Hi! Is it possible for the same prefabs to have different materials on them at runtime? I am not exactly a pro-scripter, yet I still looked at the API documentation.. so I assume I might have to use DefineGameObjectAsCrowdPrototypeAtRuntime for this? Although I am not sure how to get it to work as I've been fiddling around with it a bit.

    I just figured it'd be weird for it to be so limited in regards to not being able to activate enable/disable a different mesh within the prefab/use a different material so I wanted to make sure.

    I know it's possible with GPUI Prefabs, but I need the crowd GPUI for this. I also realize that GPUICrowdAPI.ChangeMaterial exists, but this changes it for the entire prototype rather than the instance.

    Thanks in advance.
     
    Last edited: May 21, 2021
  10. LouskRad

    LouskRad

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

    It is not possible for an instance to use a different material than the others of the same prototype without breaking instancing. This is a limitation of the gpu instancing technique itself. However, one workaround for this is to use a material variations approach on the same material - which you can see as exemplified in the TextureVariationDemo scene (in the Crowd Animations package).

    As for enabling/disabling a mesh object under the prototype; you can do this (e.g. see OptionalRenderersDemo scene). What you cannot do is to change the materials of these meshes per instance.

    Please also note that this is not only a limitation of the Crowd Animations; it also applies to GPU Instancer as well since it is the limitation of the technique. For more information on this, you can take a look at this wiki page on how gpu instancing works.
     
  11. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    I am using synty assets and hoped I could use that Texture variation approach; unfortunately I've got no clue how shaders work to set it up correctly. I tried combining textures because that's sort of what I saw was done with the fish textures; but it looks messed up either way.
     
  12. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    178
    Hi,
    After upgrading to Crowd animation v1.0.0 the GPUI crowd animation stops upgrading the NPCs positions: I mean i can see in editor scene that the NPC transform is moving but in the game scene the NPC (render) stay in the same position.

    As always "Auto Update Transform data" is checked in their prototype and don't understand why it's not updating their position in runtime.

    When i disable GPUI (NPC unity render get activated back) everything start working as before.

    Is this a bug ?

    I'm using Unity 2020.3.11f with URP 10.5

    Thanks
     
  13. GurhanH

    GurhanH

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

    I just made a test on Unity 2020.3.11f with URP 10.5 and it seems to work fine. Did you get any error logs on the console? If possible, it would help us figure out the issue if you can email us a sample.
     
  14. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    I didn't have the time to investigate it myself, but my colleagues are telling me that the InitializeWithMatrix4x4Array version of Crowd is not gameobject-less as it is supposed to be according to the gameobject-less pipeline. At a given point it uses the gameobject for the line:

    GPUISkinnedMeshData smd = prototype.animationData.GetSkinnedMeshDataByName(renderer.rendererRef.gameObject.name);

    Can this be fixed?

    Is it also possible to add the equivalent of ClonePrototypeAtRuntime for the Crowd plugin too?
     
  15. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there. The reference is not to the instance prefabs, but the prefab asset on the project window that is used as the prototype definition. Similar to my answer in this forum post.

    As for a crowd version of the clone API method, we will look into adding this.
     
  16. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    thank you, so actually this is what I thought, this method should be called to create the first prototype, but our problem is now to create cloned prototypes after the first one is created, so we can release the GO.

    Can you suggest some quick code to do the clone?
     
  17. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    Some comments from my colleague who is investigating the problem:

    "We want to create prototypes at runtime by loading GameObjects as addressable assets (using animation data baked in-editor using a proxy-manager) and then releasing the GameObjects after the prototypes are created, a workflow that works for the normal version GPUInstancer. However, the function GPUICrowdUtility.SetAppendBuffers() has a reliance on the GPUICrowdRuntimeData having a live reference to the original GameObject - this function is called, due to the override of GPUICrowdRuntimeData.InitializeData() from the base class, as a direct result of GPUInstancerAPI.InitializeWithMatrix4x4Array which is supposed to be of the no-GameObject workflow. It seems like this is an unnecessary dependency when the data could be cached when the prototype is created."

    So apparently it's not just about cloning, but InitializeWithMatrix4x4Array also relies on the gameobject being existent.
     
  18. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Ok I understand the issue now. We will make the changes for the next update so that the SetAppendBuffers uses the cached data. Then you would only need the GO reference during first initialization and subsequent InitializeWithMatrix4x4Array calls will not require this reference.

    For cloning you can use a similar approach as exemplified at this post.
     
    sebas77 likes this.
  19. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Hey. As much as I hate to ask, could you point me towards the right direction in how to go about this?
    Basically I've got quite some NPCs and want to use the texture variation component to create a good visual difference between them to show more variety etc.

    However, as you can see, the models end up very bright, colors are in the wrong spots etc compared to when I use the standard shader.

    Now I don't know much about shaders, but I assume I have to fix this by editing the shader and thus add whatever it is missing compared to the standard shader.

    I am currently using the crowd animator and although my programming knowledge isn't exactly up there yet, I'd have to say it's going well so far, however shaders are something I keep struggling with.
     

    Attached Files:

  20. GurhanH

    GurhanH

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

    I have attached a unity package with the Texture Variation supported version of the Standard shader. You can use it the same way that is exemplified in the TextureVariationsDemo.

    1- First import the package to your project (If you moved GPUInstancer-CrowdAnimations folder to some other path than the Assets folder, you will need to move these files also).
    2- Select the "GPUInstancer/CrowdAnimations/Standard Texture Variation" shader on your character material.

    If you implemented your texture variation same way with the TextureVariationsDemo, this should be enough.
     

    Attached Files:

    SOSolacex likes this.
  21. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    Hi,

    I have more feedback on the new version of Crowd, I hope you don't mind it:

    - in our Gameobject less pipeline, we don't need to have a manager on the scene and we can create it programmatically. This works fine with GPUI, but with Crowd we must have an out-of-the-scene prefab that we use to bake the animation and serialize the animation data. We don't mind this process, but would you consider it ok for the future?

    - in GPUICrowdUtility, I have noticed you changed this code

    Code (CSharp):
    1.   foreach (GPUIAnimationClipData clipData in prototype.animationData.clipDataList)
    2.                     runtimeData.animationClipDataDict.Add(clipData.animationClip.GetHashCode(), clipData);
    3.  
    into:

    Code (CSharp):
    1. for (int i = 0; i < prototype.animationData.clipDataList.Count; i++)
    2.                     runtimeData.animationClipDataDict.Add(prototype.clipList[i].GetHashCode(), prototype.animationData.clipDataList[i]);
    this code is now crashing to us, because clipList is null. I am not sure why it's null yet, but this code assumes that is not null and I am not sure that this assumption is indeed valid. The previous code seemed to not have the same assumption.

    From the inspector I can see the clip list is not null though:

    upload_2021-6-23_11-27-29.png

    After further investigation:

    var prefabPrototype =
    GPUICrowdAPI.DefineGameObjectAsCrowdPrototypeAtRuntime(crowdManager, gameObject, animationData);

    with a valid animation data

    upload_2021-6-23_12-51-58.png

    is returned a prototype without clip:

    upload_2021-6-23_12-52-34.png

    although animationData is still valid. Still trying to figure it out...

    ...the seems to assume that clipList is always serialised, but this is not the case for dynamically created prototypes. At this point I think you missed this, but I am also not sure how to generate the clipList from the animation data clip list as well.

    this seems to work as workaround at the moment:

    Code (CSharp):
    1. prefabPrototype.clipList =
    2.                 (prefabObject.GetComponent<GPUICrowdPrefab>().prefabPrototype as GPUICrowdPrototype).clipList;
    I have also a question about this option:

    upload_2021-6-23_11-20-16.png

    I didn't notice this before and surprised me. I thought Crowd was just about GPU baked animation. Is the Mecanim option about sending mecanim data from the CPU to the GPU and would it work with IK too? If so, will crowd still be faster in case there aren't many instances? (From what we understand it sends only blending and animation time parameters)
     
    Last edited: Jun 23, 2021
  22. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Thanks a bunch! Much appreciated.
     
  23. LouskRad

    LouskRad

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

    On the issue with the missing animation clip lists on the prototype: Your workaround for this would work fine. We will look into this and make a fix.

    As for the Mecanim Animator, it is one of the two workflows supported by the Crowd Manager. You can take a look at the details of how this works in this wiki article. Both workflows require baking, but basically, their difference lies in how you handle animation states (using Mecanim vs your own solution).
     
  24. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Hi, after updating to the latest version, it seems (a)synchronous bone updates no longer works. It turns itself off after clicking playmode in editor.
     
  25. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    You need to select the bones you wish to be updated. If no bones are selected, it will turn itself off.
     
  26. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    I have, it even says 3 bones are selected.
    Also I was wondering, how do I properly add animation events that act upon a script on the instance playing the animation?
    For example, if instance plays frame 7 from anim -> play sound
    I figured using the actual prefab reference would work, but it doesn't seem like it does.

    And lastly, clicking "is looping" doesn't do anything; the checkmark stays and cannot be removed whereas it worked before I updated to the latest version.

    Edit: Had to delete the prefabs from the crowd manager and then reimport them in there, allowed the bone updates to at least work to some extent, however now only one of the three bones actually works. (Still better than none but also still undesired) (hips & head doesn't work but right hand does)

    I didnt have these bone issues on the previous version.
     
    Last edited: Jun 28, 2021
  27. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    For animation events you can take a look at the AnimationEventsDemo. It uses the "Spit" method inside the AnimationEventsDemoSceneHandler script, which takes "GPUICrowdPrefab crowdInstance" as a parameter. You can use this parameter to play sounds for your instances. For example:
    crowdInstance.GetComponent<AudioSource>().Play(0);

    About the "Is Looping" issue, there seems to be an editor error. Thank you for reporting it and we will fix this in the next update. For now you can make the following change to fix the issue:

    GPUInstancer-CrowdAnimations/Scripts/Editor/GPUICrowdManagerEditor.cs
    Add the bold text at Line 596 as such:
    selectedClipData.isLoopDisabled = !EditorGUILayout.Toggle("Is Looping", !selectedClipData.isLoopDisabled);
    prototype.animationData.clipDataList[_crowdManager.selectedClipIndex] = selectedClipData;

    We were not able to reproduce the issue you mentioned about the bone updates. If you can email us a sample project we can investigate it.
     
  28. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Hey, thanks for your reply.
    I'll try to get a sample project later as it'll take quite some work to strip it down.

    I was wondering though, I'd like to use an animation event to activate a script method based on the animation that is playing.

    For example: AnimationEvent -> CastSpell.CS -> DelayedSpell(GPUICrowdPrefab crowdInstance, int spellNumber)
    {
    code
    }

    Another example would be passing an int through a method to spawn an object from a list on the crowdIinstance.

    However, unfortunately animation events don't show up or allow you to input the int in the crowdmanager game object.
    What would be the best approach for this?

    EDIT: I feel quite dumb, as my animation event isn't working
    script is correctly assigned in the animation event, same goes for the method
    Code (CSharp):
    1.  
    2.     public void PlaySound(GPUICrowdPrefab crowdInstance)
    3.     {
    4.         audioSource = crowdInstance.GetComponent<AudioSource>();
    5.         audioSource.PlayOneShot(characterAudio[0]);
    6.     }
     
    Last edited: Jun 28, 2021
  29. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    I dug further in the code to fix another bug and I found a working solution for this, it seems you may have thought about the problem already.
    if I use GenerateCrowdPrototype with the correct CopySettingFrom (the prototype from the original prefab), it copies the data.

    Edit: Something is still not right about the gameobjectless pipeline in crowd, please follow my reasoning:

    We had to give up trying to clone the prototype and using change material because cloning prototype doesn't exist in crowd and it's not as simple as the not crowd version. Besides, the
    ChangeMaterial method actually creates more temporary gameobjects that we would just cloning the original prefabs. Therefore we stuck with the idea to instantiate a new gameobject from the prefab and register it in GPUI, after the registration the idea is to destroy the cloned object to not keep it around. The code looks like this:

    Code (CSharp):
    1.  
    2.  
    3.        var clone =        GameObject.Instantiate(prefabObject);
    4.  
    5.            ApplyMaterialToGameObject(ref clone, materialId, isAnimated, isFlipped);
    6.  
    7.             var prefabScript = clone.GetComponent<GPUInstancerPrefab>();
    8.             if (prefabScript != null)
    9.                 Object.DestroyImmediate(prefabScript);
    10.  
    11.             var                    instancerPrefab = prefabObject.GetComponent<GPUInstancerPrefab>();
    12.             GPUICrowdAnimationData animationData   = (instancerPrefab.prefabPrototype as GPUICrowdPrototype).animationData;
    13.  
    14.             GPUICrowdPrototype newPrototype =
    15.                 crowdManager.DefineGameObjectAsCrowdPrototypeAtRuntime(clone, animationData, false, instancerPrefab.prefabPrototype as GPUICrowdPrototype);
    16.  
    17.             RegisterPrototype(prefabID, newPrototype);
    18.  
    19.             GPUInstancerAPI.InitializeGPUInstancer(crowdManager, newPrototype);
    20.  
    21.            GameObject.Destroy(clone);
    22.  
    This is already weird, because DefineGameObjectAsCrowdPrototypeAtRuntime wants animationData (it's not optional) but in reality it probably already would have came from prefabPrototype passed as copySettingsFrom.

    However our real problem is inside

    GPUICrowdUtility.GenerateCrowdPrototype(prototypeGameObject, false, attachScript, copySettingsFrom);

    because of this line:

    prototype.prefabObject = go;

    where go is going to be the clone that is going to be destroyed, which will cause the
    GPUInstancerRenderer rendererRef field to be invalid.

    Now we are stuck on this problem because if we use the copySettingFrom gameobject (which is the original prefab) instead than the go variable, it wouldn't crash, but it would not change the materials either. If we use go as it is, the GPUInstancerRenderer will use the new materials, but then during the redering will crash at this line:

    GPUISkinnedMeshData smd = prototype.animationData.GetSkinnedMeshDataByName(renderer.rendererRef.gameObject.name);

    because renderRef will be invalid. I actually think this is the only place where renderRef needs to be used during the rendering pipeline.

    We would suggest not to rely on the gameobject field of rendererRef, for example, you could store the name that you use most of the time just as a key in a separate field, but at the moment what we decided to do is to not destroy the clones and just set the to active false, but this is a workaround that we need to use only for crowd, as for GPUI we can instead destroy the cloned GOs.
     
    Last edited: Jun 29, 2021
  30. Draxi_

    Draxi_

    Joined:
    Sep 6, 2015
    Posts:
    7
    Hello,
    after the 1.0.0 update, I can't uncheck the Is Looping checkbox in Clip Settings.
    I tried making a new project and only importing the GPUI+Crowds assets and the model with animations that we use to see if that's our project's problem but that didn't help.
    Our animations are separate FBX files and it doesn't matter if they have loop time on or off.
    The rig has 65 bones.
     
  31. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121

     
    GurhanH likes this.
  32. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    You need to have the same parameters as in the Demo to use the event dynamically. Here is how you can accomplish this:

    1- Create a C# script and name it MySoundPlayer with a method PlaySound as such:
    Code (CSharp):
    1. using GPUInstancer.CrowdAnimations;
    2. using UnityEngine;
    3.  
    4. public class MySoundPlayer : MonoBehaviour
    5. {
    6.     public AudioClip[] characterAudio;
    7.  
    8.     public void PlaySound(GPUICrowdPrefab crowdInstance, float floatParam, int intParam, string stringParam)
    9.     {
    10.         AudioSource audioSource = crowdInstance.GetComponent<AudioSource>();
    11.         audioSource.PlayOneShot(characterAudio[intParam]);
    12.     }
    13. }
    14.  
    2- Right click on your Hierarchy window and select Create Empty. Rename it to "SoundPlayer"

    3- Add your new script to this GameObject:
    upload_2021-6-30_19-38-39.png

    4- Drag and drop this GameObject to the Object field on the Crowd Event as such:
    upload_2021-6-30_19-41-0.png

    5- Select your function from the drop down menu MySoundPlayer->PlaySound
    upload_2021-6-30_19-41-53.png

    If you did everything correctly, it should show as Dynamic.

    6- Now you can also use the "Int Parameter" on the editor, to play different sounds from the "characterAudio" array.
    upload_2021-6-30_19-45-35.png
     
  33. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Please update to the latest GPU Instancer (v1.5.2) and GPU Instancer - Crowd Animations (v1.0.1), which should solve the issue with the rendererRef reference.
     
    sebas77 likes this.
  34. GurhanH

    GurhanH

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

    We have released a fix for this error. You can download it from the asset store. Please make sure to update GPU Instancer first to the latest version (v1.5.2) and then update GPU Instancer - Crowd Animations to latest version (v1.0.1).
     
  35. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Done everything as asked, still doesn't work for some reason. Same for the bones still. I guess I'll have to just delete GPUInstancer and try importing it as a whole again. Just reimporting it at least fixed one bone, so maybe just deleting and refresh will fix more. Who knows. :confused:

    EDIT: It didn't
    EDIT 2: "I also keep getting GPU Instancer Shader Bindings Extension can not be found. ExtensionCode: CROWD_ANIM"

    It's getting quite annoying now. It gets fixed temporarily upon reimporting only for it to return later.
     
    Last edited: Jul 4, 2021
  36. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Thank you for the feedback. However as I mentioned previously: We were not able to reproduce the issue you mentioned. If you can email us a sample project we can investigate it.
     
  37. TheGamery

    TheGamery

    Joined:
    Oct 14, 2013
    Posts:
    94
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckWriteAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <37d72605af1844caa1a20afa6d236c19>:0)
    3. UnityEngine.Jobs.TransformAccessArray.GetTransformAccessArrayForSchedule () (at <37d72605af1844caa1a20afa6d236c19>:0)
    4. UnityEngine.Jobs.IJobParallelForTransformExtensions.Schedule[T] (T jobData, UnityEngine.Jobs.TransformAccessArray transforms, Unity.Jobs.JobHandle dependsOn) (at <37d72605af1844caa1a20afa6d236c19>:0)
    5. GPUInstancer.CrowdAnimations.GPUICrowdManager.Update () (at Assets/GPUInstancer-CrowdAnimations/Scripts/GPUICrowdManager.cs:174)
    I am getting this error in console after upgrading to latest GPUI versions and it's breaking my builds, any idea how to fix?

    (I deleted GPUI+Crowd before updating and after update I installed the HDRP patches).

    Using:

    latest version of GPU Instancer/Crowd Addon
    Unity 2021.1.9f1 (Windows DX11)
    HDRP 11,
    Burst 1.5.4,
    Jobs 0.8.0-preview.23
    COllections 0.17.0-preview.18

    Edit: If you find yourself in this position, remove all characters from the GPUI Crowd Manager script and re-add them, then rebake all, seems to have solved it #fingers crossed.

    Edit2:
    Seems the GPUICrowdManager script cannot be put on a prefab-ed gameobject or it keeps throwing errors every now and then.

    Edit3: The Graphics.CopyTexture error I was getting only seems to happen if you have the Game View & Scene view open at the same time.
     
    Last edited: Jul 22, 2021
  38. LouskRad

    LouskRad

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

    Managers cannot be made prefabs because they have references to scene objects. As for the Graphics.CopyTexture error - this is on Unity as it overrides the depth texture in the Scene View in HDRP (i.e. it is a Unity bug that the scene view is overriding the camera depth texture in HDRP). Since GPUI is depending on this depth texture for occlusion culling, any changes prematurely made to the texture is breaking its operation as you have mentioned.
     
  39. TheGamery

    TheGamery

    Joined:
    Oct 14, 2013
    Posts:
    94
    Thanks for explanation, hopefully Unity fix it eventually.
     
  40. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,643
    Hi,

    I realised that crowd animated meshes must be imported with the flag read/write. However, I do not think that Crowd really needs to read directly mesh buffers after the baking of the animations. Even if you need it, would it be possible to be a temporary step and then release anyway the CPU buffers to save memory?
     
  41. Simunek

    Simunek

    Joined:
    Jul 15, 2016
    Posts:
    49
    I followed the "Using a No-GameObject Workflow where Possible" tutorial. I am doing it with the crowd animator and I have a problem, that in playmode the characters are not moving. (But everything else is working fine).

    Thank you! :)
     
  42. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Thanks for the feedback. We will investigate a "temporary step" solution.


    When using a no game object flow with Crowd Animations, you also need to handle the animators. For an example of this, you can look at the NoGameObjectDemoSceneHandler class.
     
  43. 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.
     
  44. SOSolacex

    SOSolacex

    Joined:
    Jan 10, 2018
    Posts:
    121
    Im having an issue where adding the ability to remove/add instances during runtime can cause components of the objects to disappear.

    E.g. I have a character sitting at a table eating that disappears at night; upon getting reactivated, the texture variation is gone and so is the script that controls the starting animation using an enum. Causing the character to be the basic colour and to be standing instead of sitting/eating.

    How can I prevent this from happening?
     
  45. jjobby

    jjobby

    Joined:
    Nov 28, 2009
    Posts:
    161
    Hello, I'd like to have an option setting to disable or enable GPUI. Can I just active or inactive game object with GPUI manager on Awake?
     
  46. GurhanH

    GurhanH

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

    I just made a similar test with variations and it seems to work. Can you email us detailed information on how you are adding/removing instances and how did you implement the variations, so we can investigate?

    Hi there,
    You can enable/disable GPUI Managers at runtime. However with Crowd Animator workflow, when you disable GPUI the animator states will be reset.
     
  47. TheGamery

    TheGamery

    Joined:
    Oct 14, 2013
    Posts:
    94
    I am getting this error when enabling root motion on crowd characters?

    Any ideas how to fix?

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckWriteAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <37d72605af1844caa1a20afa6d236c19>:0)
    3. UnityEngine.Jobs.TransformAccessArray.GetTransformAccessArrayForSchedule () (at <37d72605af1844caa1a20afa6d236c19>:0)
    4. UnityEngine.Jobs.IJobParallelForTransformExtensions.Schedule[T] (T jobData, UnityEngine.Jobs.TransformAccessArray transforms, Unity.Jobs.JobHandle dependsOn) (at <37d72605af1844caa1a20afa6d236c19>:0)
    5. GPUInstancer.CrowdAnimations.GPUICrowdManager.Update () (at Assets/GPUInstancer-CrowdAnimations/Scripts/GPUICrowdManager.cs:166)
     
  48. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Hi there,
    thank you for the bug report. We fixed this issue with the latest update. Please upgrade GPU Instancer to v1.5.4 and Crowd Animations to v1.0.2. If you still see errors after the update please let us know.
     
    TheGamery likes this.
  49. TheGamery

    TheGamery

    Joined:
    Oct 14, 2013
    Posts:
    94
    This seems to have fixed it, thanks!
     
  50. TheGamery

    TheGamery

    Joined:
    Oct 14, 2013
    Posts:
    94
    I noticed that if I don't use a Mask map with the HDRP/Lit shader the Instanced version is really shiny even if I have Smoothness/Metallic/Normal set to 0.

    Is this fixable so I don't have to use a Mask map?