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

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

  1. Lee1384

    Lee1384

    Joined:
    Jun 8, 2014
    Posts:
    3
    Hello.

    I want to make the grass grow back after a certain period of time after mowing it.

    The example of mowing grass worked great, but I don't know how to grow it back.

    Could you give me a hint on how I can make it? The grass was planted with prefab, not Unity Terrain.

    Thanks!
     
  2. Rail9

    Rail9

    Joined:
    Feb 21, 2020
    Posts:
    25
    Hello there.

    I have set an object that has LOD in GPU Instancer prefab Manager but it is not working.
    If I set the sphere and cubes to LOD as shown in the video, it works with GPU Instancer Prefab Manager, but not with other 3D models, etc.



    I don't think there is a problem with the LOD object because it works unless it is set in the GPU Instancer prefab Manager.

    I checked the videos and documentation to see if there is any setting I need to do, but it doesn't look like I need to do anything in particular.

    Are there any steps required other than setting the object to GPU Instancer prefab Manager?
    I am using Animate cross fading for the LOD of the object, so I checked LOD Cross Fade in the GPU Instancer prefab Manager and also checked Animate cross fading.

    Materials are Standerd shaders and Vegetation Engine with Enable GPU Instance checked.

    Thank you.
     
    Last edited: Feb 23, 2023
  3. Doomchecker

    Doomchecker

    Joined:
    Apr 5, 2021
    Posts:
    102
    Hello.

    I can't find a method that removes the instances from the scene after I spawned them.

    1)
    For the GameObject workflow I would simply destroy the underlying gameobject that is in the scene, right?

    2)
    For the No GameObject workflow, I don't know how do remove the instances from the scene without completely removing the prefab from the manager.

    Thanks for helping out!
     
  4. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    419
    Hi there,
    The Instance Remover can only be used for removing instances and it can not bring them back. If you need to add/remove instances, you can use the AddPrefabInstance/RemovePrefabInstance API methods instead.

    Hi there,
    Please make sure that the LOD Group component is at the parent GameObject on the prefab that is defined as prototype. GPUI will ignore LOD Groups on the child GameObjects.
    Also try disabling cross-fading and see if it works. Custom shaders might be incompatible with GPUIs cross-fading solution which can cause issues.
    If this does not help, please email us a bug report and specify what you mean by "not working" (are the objects not rendering at all, or the LODs not transitioning correctly?) and if possible include a sample project following this guide.

    Hi there,
    There are various methods that can be used for removing. Please see this F.A.Q. for different options when using GameObjects.
    For No-GameObjects, if you want to remove all instances and release the memory allocations, you can use the ReleaseInstanceBuffers API method. If you want to temporarily disable rendering, you can use the SetInstanceCount API method and set the value zero. If you want to remove instances on specific indexes on the array, you can set the values of those indexes to Matrix4x4.zero using UpdateVisibilityBuffer API.
     
  5. AuKtagon

    AuKtagon

    Joined:
    Aug 3, 2017
    Posts:
    6
    Hi there, I am fairly new to using GPU Instancer and loved it when first starting off. I am mostly using it for runtime instantiated prefabs. I opened the project one day and it just always says "The variable prefabPrototype of GPUInstancerPrefab doesn't exist anymore". I use the prefabPrototype variable to hold the 'GPUI Prefab Manager' that is in the scene. This was all working before but now whenever I run the scene it won't work and I get that error. No objects are working on the GPU but they are still instantiated on the CPU. Any help would be amazing!
     
  6. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    915
    Hi, is raytracing supported? I've seen in the past posts that it is not, and was wondering if it is now supported.
     
  7. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    419
    Hi there,
    Can you please email us a support request with detailed information following this guide? Please also make sure to include the stack trace of the error and a code sample of your implementation in your email so we can investigate.

    Hi there,
    No, raytracing is not supported.
     
  8. sh0v0r

    sh0v0r

    Joined:
    Nov 29, 2010
    Posts:
    302
    Just wanted to post and say thankyou for making this amazing system!

    Here's a video of it being put to good use in my procedural world generator with a custom quad tree terrain system that generates a 32x32 Kilometre world!

    Also features Enviro 3 and Crest Ocean.

     
    GurhanH and vertexx like this.
  9. iendsl

    iendsl

    Joined:
    Oct 17, 2013
    Posts:
    1
    I'm having an issue with addressables and runtime instances... It seems like an issue with the ScriptableObj being used as a key for adding prefab instances but the addressable Scriptable Object isn't matching the one being used as a key with the registered prefabs. Has anyone else experienced this? Is there a built in fix or workaround otherwise?
     
  10. Kasperrr

    Kasperrr

    Joined:
    Feb 23, 2019
    Posts:
    3
  11. Daezalus

    Daezalus

    Joined:
    May 16, 2020
    Posts:
    8
    New
    Hi there,

    I have a building with destructible walls in fragments (1000 - 2000 fragments total per wall). Would it be possible to GPUI the fragments of the wall, and have them -
    a) using GPUI, be multiple walls - with a quantity of fragments similar the asteroid demo - i.e, Hundreds of destructible walls with thousands of fragments
    b) utlilise gravity when 'activated' and can be destroyed? Perhaps with custom culling if needed

    Thanks in advance

    2021.3.18f1 Personal_ _DX11_ 28_02_2023 22_58_33.png
     
  12. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    419
    Hi there,
    I do not remember seeing an issue like this, so I can not say for sure. If you can email us a support request following this guide and include a detailed description of your setup, we can investigate.

    Hi there,
    No, GPUI does not use BatchRenderGroup API.

    Hi there,
    GPU instancing works by rendering the same mesh and material combination many times. From the image, it looks like you have different meshes for the fragments, so they will not be suitable for GPU instancing.
     
  13. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    210
    Hi @GurhanH, Im having an issue where auto generated billboards dont seem to be showing up. Are there any things I should investigate? When I click on Show Billboard, I can see it there correctly, just cant see it in the editor or in play mode. Thanks for any ideas!

    upload_2023-3-3_15-35-50.png
     
  14. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    419
    Hi there,
    Possibly the instances are culled before the billboard starts. You have a Max Distance limit set to 390.
    Since you are using the "Replace LOD Culled With Billboard" option, the Culled percentage on the LOD Group might be farther.
    Please also make sure that you have the correct Object Size by clicking on the Recalculate Bounds button on the LOD Group component on your tree prefab. If you have a different Object Size value than the real one, the LOD percentages will behave differently in GPUI.

    If this does not help, please email us a bug report with a sample project following this guide and we can investigate.
     
    backwheelbates likes this.
  15. unity_4EA6FC13EF4E95E76A1B

    unity_4EA6FC13EF4E95E76A1B

    Joined:
    Jan 18, 2023
    Posts:
    2
    How do I enable Transparency for the instantiated particles?
     
    Last edited: Mar 10, 2023
  16. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    221
    Hi, for terrain details I recently wrote my own system using Burst to setup instance positions/aggregate detail cell data, etc, and just using the prefab manager rather then using your compute shader stuff in the detail manager (mainly because I wanted tighter control on how everything works). However, I have noticed that I see weird results with animated LODs as I cross cell boundaries - meaning I will see a flash of a set of instances that will be outside of culling distance and they will quickly LOD fade out. This only happens for instances with animated LODs. I suspect this is because my matrix indices are not stable. I do not only upload changed matrices (meaning just unloaded/loaded cells) but rather I remerge all visible cells and then upload the total visible set of matrices. Since I do that, matrix indices will be unstable, so an instance in the process of fading in/out might have its matrix index moved during a cell transition. I assume that for animated LODs, in GPUI you have to store state somewhere for time, unlike non-animated which can be derived without persistent state.

    Does this sound accurate? Will I need to support stable matrix indices in order to make animated LODs work in this way?

    Below is a pic where you can see two examples of the artifact. You can see the normal GPUI culling distance by the vegetation line, and then those two blobs past that culling distance show up for a few hundred ms and fade out. I am going backwards when I took this. I'm pretty certain this is not a bug in my implementation (and this doesn't happen for non-LOD and non-animated LODs).

    upload_2023-3-11_11-5-2.png

    Edit: Note, I implemented a configuration using stable matrices, and it does seem to solve the issue.
     
    Last edited: Mar 13, 2023
  17. DirtyHippy

    DirtyHippy

    Joined:
    Jul 17, 2012
    Posts:
    221
    Also there is a minor bug in GPUInstancerManagerEditor.cs:368 (DrawGPUInstancerPrototypesBox) (this is in 1.7.5 - it might be fixed in 1.7.6).

    Code (CSharp):
    1. int prototypeRowCount = Mathf.FloorToInt((EditorGUIUtility.currentViewWidth - 30f) / (_manager.isPrototypeTextMode ? PROTOTYPE_TEXT_RECT_SIZE_X : PROTOTYPE_RECT_SIZE));
    will evaluate to 0 in some cases when the inspector pane width is very small, causing a divide by zero below that which will throw a bunch of exceptions.

    Adding a quick hack after this line will fix it.

    Code (CSharp):
    1.                 if (prototypeRowCount == 0)
    2.                 {
    3.                     EditorGUILayout.EndVertical();
    4.                     return;
    5.                 }
     
  18. kaliyo

    kaliyo

    Joined:
    Dec 8, 2015
    Posts:
    4
    Sadly doesn't seem to be compatible with 2022.2
    The scene view turns grey as soon as I add the detail manager and Unity crashes after 10~ seconds.
     
  19. windspiek

    windspiek

    Joined:
    Jun 17, 2018
    Posts:
    4
    Hey @GurhanH I am using GPUInstancer Trees and have the issue that the billboards generated, will have transparency in the part of the mesh that uses (opaque) alpha clipping.

    upload_2023-3-13_18-46-31.png

    This is using default settings with a tree without LoDs and two materials with the standard "FoliageURP_GPUI_SG" shader.

    Would love some support with this since, because editing the "BillboardURP_GPUI" shader to fix the issue has had no effect and presumably another shader is used for the billboards?
     
  20. mezzanine510

    mezzanine510

    Joined:
    Mar 7, 2018
    Posts:
    4
    I crash on 2022.2 as well. Any updates on this @GurhanH ?
     
  21. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    419
    Hi there,
    There is not an extra step to enabling transparency. If the transparency setting on the material is not working, there might be a shader issue. If you can email us a detailed description of the problem following this guide we can investigate.

    Hi there,
    GPUI stores a state for animating cross-fading and it is index based (since there are no GameObjects, index is the only reference). We will look into adding an API method to reset cross-fading states in a future update. For now you can set the "isInitial" field in the manager to true which should reset the states for the cross-fading. However "isInitial" is a protected field so you either need to change it to public or add a new method to the manager. (See GPUInstancerManager.cs line 93)

    Thanks for the feedback. We will look into it for the next update.

    Hi there,
    Please email us a bug report with sample project following this guide so we can investigate.

    Hi there
    Please make sure that you are not using the "Coverage Mode" for Detail Scatter Mode terrain setting. And if the issue continues, please email us a bug report with detailed description of how to reproduce the problem or a sample project following this guide so we can investigate.
     
  22. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    210
    Thank you, Ill give it a try!
     
  23. MarkE52x

    MarkE52x

    Joined:
    Sep 7, 2022
    Posts:
    1
    Hi,
    I'm currently rendering a sports crowd. I'm looking at basing it similarly on 'No Game Objects With Jobs Demo Scene' in GPUI animation package. Before I had built the crowd without the jobs system based off 'No Game Objects Demo Scene' (So not using jobs/burst). Using jobs and burst now has improved performance when switching animations but when I call animation changes now there doesn't seem to be an option to give transition time.

    Is anyone aware of a solution to this? When changing animation I can tell it doesn't transition immediately from one animation to another but it does instead smoothly transition though quite quickly. Is there a way i can slow this transition down? maybe a shader setting? Even if I have to slow it down for all animation changes that would be alright.

    Hope that makes sense to someone :)