Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

[RELEASED] GPU Instancer

Discussion in 'Assets and Asset Store' started by LouskRad, May 3, 2018.

  1. madkevop7

    madkevop7

    Joined:
    Nov 11, 2021
    Posts:
    23
    Hi I think you misunderstood my question. I meant to begin the scene with a fresh GPUInstancerPrefabManager without any prototypes added. I have a list of gameObjects that are spawnable by players for placement and building houses, etc. I want to add these gameobjects in the list to GPUInstancerPrefabManager as prototypes during RUNTIME, then register them so players can Instantiate objects from that list and will be automatically instanced. How will I accomplish that?

    Also, the gameObjects in the list may not already have the GPUInstancerPrefab script, can I simply do object.AddComponent<GPUInstancerPrefab>() before passing it for protype and registration ?
     
    Last edited: Jul 7, 2022
  2. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    388
    Using the Tree Manager with Multiple Terrains
    Prefab Manager Runtime Settings
    API Documentation

    Please see: DefineGameObjectAsPrefabPrototypeAtRuntime
    There is also a demo scene in the package called AddRuntimeCreatedGameObjects.
     
  3. madkevop7

    madkevop7

    Joined:
    Nov 11, 2021
    Posts:
    23
    Got it thanks, would you suggest using the AddInstancesToPrefabPrototypeAtRuntime everytime the user instantiates, or queue them to a list and once the count reaches a certain number (ex. 100) then add that whole list to it. Which one is more performant?
     
  4. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    388
    It would be better to wait for a certain number. Having many prototypes with low instance counts will have an adverse effect on performance.
     
  5. jarrednorris

    jarrednorris

    Joined:
    Aug 8, 2020
    Posts:
    5
    We're having some issues getting our instanced foliage to get the correct shadowing. We assumed that the fix was to use the Shadow with Original Shader setting as outlined here.

    https://wiki.gurbu.com/index.php?ti...s_on_the_Prefab_Instances_Look_Blocky.2FWrong


    We've set this to true in the code for our prototypes but saw no difference in our visuals. So we then looked at the actual prototype settings in the inspector and found that the setting isnt appearing for our prototypes.


    We are using GPUI 1.7.3 and spawning our prefabs with a gameobjectless workflow. The project is HDRP 10.5 and Unity 2020.3
    Here is an example of what we expect to see with proper shadowing


    And here is what we are seeing when using GPU instancer


    Any ideas on why that setting might not be appearing or how we can get the shadowing working correctly?
     
  6. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    388
    Shadows are always rendered with the original shader in HDRP, that is why the "Shadow with Original Shader" option is not necessary.
    The issue is most probably caused by the shader's ShadowCaster pass. It might not be setup correctly for GPU Instancer, or the shader might be using a fallback shader for shadows that needs to be also setup for GPUI. You can test it by switching the material to HDRP/Lit shader and see if the shadows render. Please see the documentation about Shader Setup for more information.

    If this does not help, email us a bug report with an example project following this guide and we can investigate.
     
  7. Coreengage

    Coreengage

    Joined:
    Nov 25, 2020
    Posts:
    3
    Hi,

    My Prefab Mesh Renderer>Cast Shadows option is Shadows Only, but GPUI draw mesh and shadows on play, is it possible to draw only shadows with GPUI? Thanks
     
  8. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    388
    Hi there,
    Shadows Only mode is currently not supported. But we will include it in the next update. You can contact our support email with your invoice number to receive the required changes before the update.
     
  9. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    261
    I sent an e-mail to your support address and just wanted to make sure you received it. For some reason my e-mails often end up in spam.
     
  10. jarrednorris

    jarrednorris

    Joined:
    Aug 8, 2020
    Posts:
    5
    With raytracing enabled in our project, and screen space shadows enabled, there are no shadows on GPU Instanced geometry. This is expected as the documentation outlines that raytracing is unsupported. Is there however, a possible workaround/solution, whereby it is possible to have ray-tracing and screen-space shadows enabled for better graphical fidelity on non instanced gameobjects, while using a fallback for shadowing on the GPU instanced geometry in our project?

    We are using GPUI 1.7.3 and spawning our prefabs with a gameobjectless workflow. The project is HDRP 10.5 and Unity 2020.3
     
  11. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    388
    You can not have mixed shadows as far as I know. But you might get a more detailed answer and learn about what is supported in the HDRP forum.
     
  12. nrader95

    nrader95

    Joined:
    Aug 19, 2019
    Posts:
    19
    I'm getting weird build specific bug (with hdrp).
    Code (stacktrace):
    1. ArgumentNullException: Value cannot be null.
    2.  
    3. Parameter name: shader
    4.  
    5.   at (wrapper managed-to-native) UnityEngine.Material.CreateWithShader(UnityEngine.Material,UnityEngine.Shader)
    6.  
    7.   at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00008] in /home/bokken/buildslave/unity/build/Runtime/Export/Shaders/Material.bindings.cs:18
    8.  
    9.   at GPUInstancer.GPUInstancerShaderBindings.GetInstancedMaterial (UnityEngine.Material originalMaterial, System.String extensionCode) [0x000a3] in GPUInstancer/Scripts/Core/DataModel/GPUInstancerShaderBindings.cs:131
    10.  
    11.   at GPUInstancer.GPUInstancerRuntimeData.GenerateLODsFromLODGroup (GPUInstancer.GPUInstancerPrototype prototype) [0x00196] in GPUInstancer/Scripts/Core/DataModel/GPUInstancerRuntimeData.cs:314
    12.  
    13.   at GPUInstancer.GPUInstancerRuntimeData.CreateRenderersFromGameObject (GPUInstancer.GPUInstancerPrototype prototype) [0x00073] in GPUInstancer/Scripts/Core/DataModel/GPUInstancerRuntimeData.cs:255
    14.  
    15.   at GPUInstancer.GPUInstancerPrefabManager.InitializeRuntimeDataForPrefabPrototype (GPUInstancer.GPUInstancerPrefabPrototype p, System.Int32 additionalBufferSize) [0x00037] in GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:238
    16.  
    17.   at GPUInstancer.GPUInstancerPrefabManager.InitializeRuntimeDataRegisteredPrefabs (System.Int32 additionalBufferSize) [0x0004e] in GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:225
    18.  
    19.   at GPUInstancer.GPUInstancerPrefabManager.InitializeRuntimeDataAndBuffers (System.Boolean forceNew) [0x0016f] in GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:183
    20.  
    21.   at GPUInstancer.GPUInstancerPrefabRuntimeHandler.OnEnable () [0x00053] in GPUInstancerPrefabRuntimeHandler.cs:45
    22.  
    In the editor its fine.

    I'm on Unity 2021.3.0f1 with GPU v.1.7.2
    HDRP is ver.12.1.6

    Any ideas what is that?
     
    Last edited: Jul 24, 2022
  13. ocean_hscha

    ocean_hscha

    Joined:
    Jun 10, 2021
    Posts:
    5
    Does the GPUI not support layers during raycast checks?
    My tree has a collider and is set as the 'Default' layer. And I use Physics.Raycast() in the code to detect the ground.
    Code (CSharp):
    1. Physics.Raycast(teleportRay, out teleportHit, 100f, LayerMask.GetMask("Ground"), QueryTriggerInteraction.Ignore);
    I was hoping that the collision of trees would be ignored, but it wasn't.
     
  14. GurhanH

    GurhanH

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

    Looks like some GPUI shaders are not included in the build. Normally GPUI adds references to the used shader/shader variants in the Resources folder (GPUInstancer/Resources/Settings/GPUIShaderVariantCollection and GPUInstancer/Resources/Settings/GPUInstancerShaderBindings). But you might have special settings/scripts in your project that is preventing the shaders from being included in builds. I can not say what the specific reason is in your project. I also recommend updating to the latest Unity LTS and GPUI version, before trying any solution.

    GPUI does not change things about Physics/Colliders, they should work the same way with or without GPUI.
     
  15. ocean_hscha

    ocean_hscha

    Joined:
    Jun 10, 2021
    Posts:
    5
    Thank you, but I'm adding that there was a lack of my explanation.
    Raycast for trees typically placed in the scene works fine.
    Trees that set to the "Default" layer and normally placed in the scene did not hit the Raycast that has layer mask "Ground".
    But the same trees that placed by GPUI Tree Manager was hit the same above raycast.
     
  16. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    388
    If you are using the Unity terrain for trees, then the tree colliders and layers are handled by the terrain. So you would see the same Raycast results with or without GPUI also when using terrain trees.
    To use the layer of the prefabs for the terrain trees, you need to enable "Preserve Tree Prototype Layers" option on the Terrain settings, otherwise Unity will use the terrain gameobject's layer.
     
    ocean_hscha likes this.
  17. ocean_hscha

    ocean_hscha

    Joined:
    Jun 10, 2021
    Posts:
    5
    Thank you very much!
     
  18. leeharris_unity

    leeharris_unity

    Joined:
    Jan 12, 2020
    Posts:
    40
    In reference to defining prototypes at runtime and using AddInstancesToPrefabPrototypeAtRuntime(..) to add gameObject instances to the registered manager list, it seems to be much slower than if a prefab were added to the manager in the editor and with auto instance add/remove checked on. I start getting some real fps spikes when calling this to add an extra couple of hundred instances each time once the instance count is in the few thousand range. I presume this function is unavoidably re-allocating the buffer for that prototype on every call? Is AddPrefabInstance(..) not an option when DefineGameObjectAsPrefabPrototypeAtRuntime(..) is used to create a prototype at runtime ? Since this is being used as part of a custom terrain detail brush system, I'd like to be able to instantiate gameObjects as they're painted, and upgrade these to prototypes/prefab instances over time, say, within a co-routine in the background. The only reason I'm not just using prefabs created in the editor is because I need to set the layers of said prefabs after placement (which, yes, means I unfortunately end up with prototypes that are identical except for the layer they're assigned to, but I can't see another way to approach it).

    Edit: Ok, since posting this, I switched to a non-gameObject workflow, and I can confirm this is order of magnitude more appropriate for working with constant addition/removal, if you're willing to manage the buffers and only update what you need to. Thanks for a great asset so far!
     
    Last edited: Jul 27, 2022
    GurhanH likes this.
  19. Larsson24

    Larsson24

    Joined:
    Nov 2, 2020
    Posts:
    4
    Hi, what's the correct way of handling occlusion culling for non GPUI prototypes, i.e. objects that I don't have enough of to make a prototype? Can the GPUI occlusion culling solution be mixed with other occlusion culling solutions, e.g. Unities built in solution? Anything special I need to know or think about regarding this? :)
     
  20. reggie_sgs

    reggie_sgs

    Joined:
    Jun 29, 2014
    Posts:
    261
    I replied to your e-mail regarding the Playstation issue but never heard back. Did you get the e-mail?
     
  21. Crowsinger

    Crowsinger

    Joined:
    Apr 23, 2022
    Posts:
    17
    Hello. I was having FPS troubles on my Gaia Pro landscape, so yesterday I tried setting up GPU Instancer to see if it would help. It seems to have helped, though the fps keeps jumping around between 40-110 as I walk through a forest. I know that I can make adjustments and learn more about the tool.

    But there's an issue. I have been using R.A.M. 2019 for rivers and lakes. The big lake in the middle of my zone is complelely missing now. It's just a pit in the ground with lake houses floating where the surface of the water should be. The rivers are also missing.

    Did the R.A.M. 2019 stuff get caught up in GPUI somehow? Is there a way I can fix this? Thanks!
     
    Last edited: Jul 27, 2022
  22. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    388
    Hi there,
    GPUI's culling can not be used for objects that are not rendered by GPUI and you can not use other culling system for the objects that are rendered by GPUI. But you can use other culling solutions for non GPUI prototypes.

    Hi there,
    I can not say much without seeing the setup but you should check what you added to the Prefab Managers. There should only be prefabs with many instances that use the same mesh and material (not rivers or lakes). Please read the documentations (especially the Best Practices and Terminology) to learn about how to use GPU Instancer.
     
  23. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    388
    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.
     
  24. marckv

    marckv

    Joined:
    Sep 19, 2013
    Posts:
    56
    Is it possible to add functionality for lightmaps? Say for example if all the objects use the same lightmap?
     
  25. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    542
    I'm having a few issue with GPUI, while it drastically actually reduce drawcall we also get some strange stuttering and decrease in performance.

    What do you think could cause this issue?

    Tested on every possible platform included consoles (old and current gen).
     
  26. madkevop7

    madkevop7

    Joined:
    Nov 11, 2021
    Posts:
    23
    How do I enable auto. Add Remove instances through the API, there seem to be not an option for that?
     
  27. madkevop7

    madkevop7

    Joined:
    Nov 11, 2021
    Posts:
    23
    I'm struggling to remove a specific instance defined at runtime through DefineGameObjectAsPrefabPrototypeAtRuntime and AddInstancesToPrefabPrototypeAtRuntime. I tried RemovePrefabInstance and RemoveInsideCollider they don't work. Even when the object is destroyed the instance still renders. I have enabled runtime add remove instance and runtime modification in the prototype settings, however, there isn't an option to enable auto.Add Remove instance through the API. Because of that, I also looked at the demo AddRuntimeCreatedGameObjects, which doesn't show how to remove an instance it just removes the whole prototype. How do I remove an instance not the whole prototype?
     
  28. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,089
    GurhanH likes this.
  29. Frenzy34

    Frenzy34

    Joined:
    Jul 14, 2019
    Posts:
    16
    Hello,

    I'm seeing inconsistency in the Texture Mipmap levels of the instanced objects. Is this an expected move?

    Thank you.
     
  30. Djuan98

    Djuan98

    Joined:
    Sep 3, 2021
    Posts:
    12
    Hello,

    Quick question does your Crowd Animation addon on support Emerald AI? Just wanted to ask before I purchase it.
     
  31. focuslabstudios

    focuslabstudios

    Joined:
    Feb 23, 2018
    Posts:
    35
    Hi! I'm using GPU Instancer together with TVE and MapMagic 2. I've ran into an issue with it...
    Basically I'm using TVE for all my vegetation and TVE does not support 2d texture grass.. Since I'm generating grass based on microsplat output (to generate grass on a specific splat) I use the 2d grass map node. However since TVE does not support 2D Grass I'd like to generate grass prefabs instead but I find myself stuck on this part..

    How can I efficiently generate grass prefabs to fill up a specific texture map? When I used VSP before I simply outputted it to a VSP map and that fairly efficiently generated grass prefabs that filled up the given texture map.. I've scrapped VSP because of how slow it is to generate new tiles tho.. Is there a similar way to do this with GPUI instead?

    Has anyone had this issue before?


    ------------EDIT------------

    Solved it :)
     
    Last edited: Aug 31, 2022
  32. IgorAherneBusiness

    IgorAherneBusiness

    Joined:
    Apr 22, 2017
    Posts:
    4
    @GurhanH I know that GPUI Prefab Manager allows to click Disable Mesh Renderers button to speed up loading times.

    However, I'm using Crowd manager, and can't seem to find this button, experiencing long load times.
    Is there an easy way to do it? Currently have 4 prefab variants, each at 3k registered instances.
    Thank you
     
  33. richard-firehose

    richard-firehose

    Joined:
    May 31, 2019
    Posts:
    9
    Hi, I'm using the game object-less set up and I'm trying to make it so that the GPUI meshes still show up in Edit Mode. Could you potentially point me in the direction of what settings and things I need to be aware of to make this work? I poked around the documentation but didn't see anything for it. Thanks!
     
  34. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    388
    Hi there,
    Technically yes it is possible. But GPUI does not provide such functionality.

    This option modifies the prefab, so it is not possible to enable it at runtime. So you can not use it with runtime generated prototypes.

    These methods should work. Are you sure you are using them with the correct instance/collider?
    If there is an unexpected behavior, please make a bug report with a sample project following this guide.

    Hi there,
    I did not see an issue with mipmaps before. It might be a shader specific issue. If you are using a custom shader try using one of the defaults and see if it works. Otherwise if you can send us a sample project following this guide, we can investigate.

    Hi there,
    I did not use Emerald AI before so I can not say. But usually Mecanim Animator Workflow integrates to AI systems that uses the Mecanim Animator without issue. However you will need custom integrations for Crowd Animator Workflow.

    Thank you for the feedback. It is more complicated for the Crowd Manager since it also optimizes transform hierarchies in many cases. But we will look into adding a similar functionality for the Crowd Manager in a future update.

    Hi there,
    You can use the StartEditorSimulation API method to start rendering in edit mode. You need to first call StartEditorSimulation method to intialize the manager and then your game object-less set up code.
     
  35. IgorAherneBusiness

    IgorAherneBusiness

    Joined:
    Apr 22, 2017
    Posts:
    4
    Thank you @GurhanH, regarding the long loading time for Crowd-manager, is it possible for me to manually disable all renderers on human instances, so that there is no need to iterate and disable the renderer components during Start()? Or do you mean, something else happens during initialization, which I can't avoid at the moment?

    I'm using the CrowdAnimator, not mechanim, and have to set up animation events during Start(), for all the 10k instances, - maybe it's causing such a long load? Lasts about 1 minute
     
  36. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    866
    Hi,

    I just bought your GPU instancer for my Oculus VR game because your AD on the Unity play store said your product works in VR so i bought it because im doing a VR game.

    So what i did was use your "DetailInstancingDemo" in VR. I disabled the SceneController, spaceShip, Grassmower, and cameras, and put in the VR XR rig, then ran it on Oculus.

    I set the camera to use in your prefab to use the VR center camera in the XR rig.

    When i run it in oculus im only getting 11 fps. But in the editor (if i disable the XR rig) im getting over 200 fps.

    Also your component has an error message "The occlusion culling feature requires the Depth Texture option to be enabled in the URP pipeline setting...." I have it enabled in the pipeline but it still shows this message.

    Could you help me fix this, 11 fps is way too low.

    Thanks
     
    Last edited: Sep 3, 2022
  37. Crowsinger

    Crowsinger

    Joined:
    Apr 23, 2022
    Posts:
    17
    Hello. A tried GPU Instancer a while back, but I set it aside for a bit while I finished the scene I was working on. I remember that I couldn't see a lot of the plants in the scene before GPU Instancer showed the simulation.

    Now I'm trying this again, but something seems different. Instead of showing me a simulation now, the detail managers just say "preparing simulation" and it stays like that. Also I am no longer able to move around the scene view since I added the detail managers. Has something gone wrong? Thank you.
     
  38. Crowsinger

    Crowsinger

    Joined:
    Apr 23, 2022
    Posts:
    17
    Okay today I tried putting just the Tree Manager in the scene. I also did some testing today. I remove all trees and vegetation from the scene and hit play.

    CPU: 56%
    GPU: 86%
    FPS: 84-120.

    Then I added trees back into the scene. Just trees, no vegetation.
    CPU: 30%
    GPU: 64%
    FPS: 55-124

    The I added the Tree Manager and built another client.
    GPU: 100%
    FPS: 38

    Am I using this wrong? Thanks

    btw the trees are from Nature Manufacture.
     
  39. ocean_hscha

    ocean_hscha

    Joined:
    Jun 10, 2021
    Posts:
    5
    Hi. Can I toggle visibility of tree that is hit raycast?
    These trees placed by GPUI Tree Manager and I have some camera sequence for scene production. In some frames, tree blocks the camera. If a raycast from the camera detects a hit tree, can I hide it?
    I don't know what to do in a case like this. I'm looking for help. Thank you.
     
  40. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    388
    You can try manually disabling the renderers/animators/LOD Groups and then select the Prototype SO and enable the "Mesh Renderers Disabled" switch.
    upload_2022-9-6_10-39-51.png

    upload_2022-9-6_10-40-39.png

    This way the Crowd Manager will not search for components. But it will also not optimize the game objects, so I would also recommend to "Optimize Game Objects" from importer.

    upload_2022-9-6_10-46-29.png

    Hi there,
    Can you please email us detailed information following this guide so we can investigate the issue?

    Hi there,
    Can you please email us a sample project so we can make these tests on our side and investigate the issue?

    Hi there,
    To remove trees from the Tree Manager, you can use the RemoveInstancesInsideBounds or RemoveInstancesInsideCollider API methods. But this only remove them from rendering, you need to also remove the trees from the terrain to update colliders.
     
    IgorAherneBusiness likes this.
  41. ocean_hscha

    ocean_hscha

    Joined:
    Jun 10, 2021
    Posts:
    5
    Thank you. And can I restore the removed tree?
    I want to hide the tree only temporarily. After passing through the tree blocking the camera, I want to draw the tree again.
    I still don't know how to deal with these cases. I'd appreciate your help.
     
  42. focuslabstudios

    focuslabstudios

    Joined:
    Feb 23, 2018
    Posts:
    35
    Hi there we're converting to use GPU instancer together with Map Magic 2. The game is also multiplayer/ In the game we're using purely procedural generation for all our terrain and interactible objects. Because of this we very often have 3 versions of an object.
    1. Procedural version (barebones prefab with just a small interaction script + collider on it to make it collectible and LOD group)
    2. Multiplayer version (Photon Bolt prefab with all networking components to sync between players + rigidbody + collider)
    3. Equipped version (barebones prefab mostly with just LOD group and sometimes a custom use script)

    All these prefabs use the same model and because of this I'd really like if it was possible to make it so that I only have to manage the base model in the prefabs manager in order to consistently control the render settings of all related prefabs that use the exact same model..

    Right now I tried making one prefab with just the LOD groups and mesh renderers and then created prefab variants from that but it doesn't seem to work.

    Furthermore the Map Magic 2 prefab/detail importer/manager is so difficult to work with since the only thing it can do is import what is in the MM2 Graph.. How do I handle prefabs for example that are NOT procedural and part of the MM2 graph? For example I might have a flower in the MM2 Graph that is instanced but I also have an axe that is not procedurally generated but I still want it rendered using GPUI?

    Also beyond this it's impossible to setup the actually imported prefabs in the MM2 GPUI manager because everytime you press import (because maybe you added a new object to the graph) it overwrites all your previous configurations on your prototype data.

    Help would be greatly appreciated!

    All the best
     
  43. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    388
    There is no undo functionality for the tree removal or an add tree method. So you will need to reinitialize the Tree Manager to reset the trees.
    But if all you need is to hide the trees close to the camera, you might be better of with setting a Min. Distance under Culling settings.
    Or if you need to very often add/remove trees, it might be better to use Prefab Manager instead, which has various methods to do this.

    Hi there,
    First of all, you do not have to use the MM2 integration. It is there to quickly create managers/prototypes from your MM2 graphs (mainly for static terrain objects), but if you have other use cases (e.g. scripts that are modifying instances), it is better to create and setup the managers yourself instead.
    Form what I understand from your description, if you add a Prefab Manager and add the original prefab (not the variant) to the manager as a prototype and enable Auto. Add/Remove Instances and Auto. Update Transform Data options, it should work. You can also use the GPUI API to have finer control over the instances.
     
  44. Crowsinger

    Crowsinger

    Joined:
    Apr 23, 2022
    Posts:
    17
    Hello. I started from scratch, and it seems to be working now. Thank you.
     
  45. staringatlights

    staringatlights

    Joined:
    Sep 1, 2013
    Posts:
    25
    I am running into the same issue as post #2671,

    After compiling code, the first run inside the editor throws an error, but subsequent runs are fine:
    Code (csharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. GPUInstancer.GPUInstancerUtility.DispatchCSInstancedCameraCalculation[T] (UnityEngine.ComputeShader cameraComputeShader, System.Int32[] cameraComputeKernelIDs, T runtimeData, GPUInstancer.GPUInstancerCameraData cameraData, System.Boolean isManagerFrustumCulling, System.Boolean isManagerOcclusionCulling, System.Boolean isInitial) (at Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:482)
    3. GPUInstancer.GPUInstancerUtility.UpdateGPUBuffer[T] (UnityEngine.ComputeShader cameraComputeShader, System.Int32[] cameraComputeKernelIDs, UnityEngine.ComputeShader visibilityComputeShader, System.Int32[] instanceVisibilityComputeKernelIDs, T runtimeData, GPUInstancer.GPUInstancerCameraData cameraData, System.Boolean isManagerFrustumCulling, System.Boolean isManagerOcclusionCulling, System.Boolean showRenderedAmount, System.Boolean isInitial) (at Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:395)
    4. GPUInstancer.GPUInstancerUtility.UpdateGPUBuffers[T] (UnityEngine.ComputeShader cameraComputeShader, System.Int32[] cameraComputeKernelIDs, UnityEngine.ComputeShader visibilityComputeShader, System.Int32[] instanceVisibilityComputeKernelIDs, System.Collections.Generic.List`1[T] runtimeDataList, GPUInstancer.GPUInstancerCameraData cameraData, System.Boolean isManagerFrustumCulling, System.Boolean isManagerOcclusionCulling, System.Boolean showRenderedAmount, System.Boolean isInitial) (at Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:363)
    5. GPUInstancer.GPUInstancerManager.UpdateBuffers (GPUInstancer.GPUInstancerCameraData renderingCameraData) (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:589)
    6. GPUInstancer.GPUInstancerManager.LateUpdate () (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:267)
    7. GPUInstancer.GPUInstancerPrefabManager.LateUpdate () (at Assets/GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:81)
    8. GPUInstancer.CrowdAnimations.GPUICrowdManager.LateUpdate () (at Assets/GPUInstancer-CrowdAnimations/Scripts/GPUICrowdManager.cs:258)
    9.  
    Were any adjustments to the library made to fix this? I am using the no gameobject workflow and initializing GPU Instancer from within an ECS system. (Which works great by the way, other than this error)

    Unity 2021.3.9f1
    URP 12.1.7
    GPU Instancer 1.7.3
    Crowd Animations - 1.1.3

    Reload Domain and Reload Scene disabled, URP assets are selected properly under Project Settings -> Graphics and Project Settings -> Quality

    --

    Also, are there any plans to make this asset more DOTS accessible? It would be great if
    GPUICrowdAnimator's could be moved into an unmanaged format like an IComponentData we could write to in parallel jobs.
     
    Last edited: Sep 9, 2022
  46. vengefullfoot

    vengefullfoot

    Joined:
    Sep 24, 2018
    Posts:
    20
    Hello, I want to use GPU Instancer on a spherical terrain to manage the grass.
    I saw the demo video on that topic, but I cannot find the SphericalTerrainScene that is used for it. Is this scene available somewhere ? Thanks in advance
     
  47. abdul_ahmad

    abdul_ahmad

    Joined:
    Aug 12, 2021
    Posts:
    3
    hi. I'm using the built-in render pipeline and have been using GPUI but cross-fading doesnt seem to work for me. when add a prefab without GPUI the cross-fading works fine, but when i add the prefab to the GPUI manager, cross-fading stops working and the prefab pops into the scene when i get close enough, instead of fading in.

    i read an answer from 2 years ago in this thread that says cross-fading doesnt work with the HD render pipeline, is this also true for the built-in pipeline?
     
  48. Frenzy34

    Frenzy34

    Joined:
    Jul 14, 2019
    Posts:
    16
    Hello again.

    Unfortunately, I did not have the opportunity to prepare an exemplary scene. However, this error can be easily displayed. Only after activating "Texture Streaming" from the project settings, you can open "Streaming Mipmaps" from the texture settings of the object to be sampled in the scene. At runtime, you can observe that the quality of mipmaps on this object decreases, but does not increase it again. The version we are using is the Unity 2021.3.5 LTS HDRP project. GPU Instancer version 1.7.3.

    We thank you.
     
  49. Cover-Club-Media

    Cover-Club-Media

    Joined:
    Apr 30, 2015
    Posts:
    118
    I'm sad to see not a single update has been done to this asset since march. These errors are still present and I cannot update due to them. Do you have any insight yet? I would love to be able to use your new version as 1.5.4 seems really dated now when I look at your docs.

    Edit: apparently you have an update. I don't know why package manager did not show me the new update. Anyways, this update below was the same issue I had so the problem is now resolved with no errors :). I also noticed with 1.5.4 build fps was total arse. Went from a struggling 50FPS to 200FPS. I don't know what updates you've done in the past but they are GOOD! TY.
     
    Last edited: Sep 11, 2022
  50. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    388
    Hi there,
    and thank you for the feedback.
    The previous issue was solved, however it looks like Unity made another change in the newer versions that caused this. We will provide a solution with the next update.

    We are looking into adding documentation and examples for using Crowd Animator with DOTS. Short explanation:
    It is possible to use Jobs and Burst to edit animation states, however it requires some knowledge about how Crowd Animator works internally. There are two NativeArrays that are used for the animator: GPUICrowdRuntimeData.crowdAnimatorControllerData and GPUICrowdRuntimeData.animationData. To see how they are used please take a look at the BlendAnimations method inside GPUICrowdAnimator.cs.
    Using these two NativeArrays you can manage all animation states without using the GPUICrowdAnimator class.

    Hi there,
    This scene was made solely for the tutorial and it does not have any special features. It is simply a sphere mesh with prefab instances on it. In any case I checked some old files and found a version of this scene, you can find it in the attachment. Please note that it uses Standard Pipeline materials, if you are using another pipeline you need to change the shaders of the materials.

    Hi there,
    Currently all render pipelines support cross-fading. But some shaders use different methods for cross-fading which might not be compatible with GPUI. Please email us a sample project following this guide and we can investigate the issue.

    Thanks for the info, I will test it before the next release. However still please make a support request at least with some screenshots so we can keep track of the issue and use the visuals for comparison.
     

    Attached Files: