Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

[RELEASED] GPU Instancer

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

  1. alex_1302

    alex_1302

    Joined:
    Aug 20, 2019
    Posts:
    25
    Hi. i am using GPUI tree manager, and i am having problems with an post processing effect (bloom). the bloom effect is being drawn on top of the trees (like showed in the image). when i disable gpui tree manager. The effects works fine. i was try to fix the problem changing the shader in the red gameobject (the object with the effect) but it dont works . do you know how can i fix this ? Thanks in advance.

     
  2. VincentAbert

    VincentAbert

    Joined:
    May 2, 2020
    Posts:
    60
    Hello everyone !

    Terrific add-on, I really like it, especially since i fixed the LOD crossfade issue that didn't allow some trees to render. However I noticed a bit earlier that occlusion culing didn't work. I would include screenshots but it's as simple as everything rendering as if occlusion culling wasn't turned on. Anyone else with a similar issue (/fix) by any chance ? (I use HDRP)
     
  3. LouskRad

    LouskRad

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

    please update your GPUI package to the latest version from the Asset Store. If you still have this problem, please follow this guideline to make a bug report.
     
  4. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    GPUI simply uses the mesh and material in memory (otherwise used allocations are too small to be relevant); meaning its operations per se would not take up 10GB ram. However, if you have a lot of high resolution textures in your materials, they could add up to such a number. This number would be the same while rendering without GPUI. You can use the profiler to identify what is taking up that much memory.
     
  5. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there, and thanks.

    Occlusion culling does actually work, although in HDRP it can be tricky to verify it. Please take a look at this wiki article on the subject.
     
  6. ManaPotionStudios

    ManaPotionStudios

    Joined:
    Dec 26, 2016
    Posts:
    11
    GPUICrowdAnimator:ApplyTransition have a bug in it. In some situations lerp can be not finished and final wights will not be set. This can easily be fixed. Code:

    Code (CSharp):
    1. public bool ApplyTransition(GPUICrowdRuntimeData runtimeData)
    2.         {
    3.            
    4. bool ret = true;
    5.             int animationWeightIndex = transition.arrayIndex * 2 + 1;
    6.  
    7.             if (Time.time > transition.startTime + transition.totalTime)
    8.             {
    9.                 activeClipCount = transition.endActiveClipCount;
    10.                 isInTransition = false;
    11.                 currentAnimationClipDataWeights = transition.endWeights;
    12.                 ret = false;
    13.             }
    14.             else
    15.             {
    16.                 currentAnimationClipDataWeights = Vector4.Lerp(transition.startWeights, transition.endWeights, (Time.time - transition.startTime) / transition.totalTime);
    17.             }
    18.  
    19.             // set weights
    20.             runtimeData.animationData[animationWeightIndex] = currentAnimationClipDataWeights;
    21.  
    22.             // set data to buffers
    23.             runtimeData.animationDataBuffer.SetData(runtimeData.animationData, animationWeightIndex, animationWeightIndex, 1);
    24.             return ret;
    25.         }
     
    Last edited: May 27, 2020
  7. niscotine

    niscotine

    Joined:
    Jan 31, 2015
    Posts:
    3
    Hi i am getting the following error while using in URP..

    upload_2020-5-27_17-56-10.png
     
  8. oshoham

    oshoham

    Joined:
    Oct 12, 2017
    Posts:
    4
    Hi, I'm trying to get a scene with multiple cameras working following the "Use a Multiple Camera Setup" section of your documentation (one GPUInstancerPrefabManager per camera, each set up to only use that specific camera), and I'm only seeing instanced prefabs registered on one of my two prefab managers. Both of my prefab managers are set up to automatically add/remove prefab instances.

    After looking at the code for the GPUInstancerRuntimePrefabHandler component, it looks like the GetPrefabManager() method in that component is designed to only ever return a single prefab manager, so it seems that I can't use the "Automatically Add/Remove Instances" setting in conjunction with a multiple camera setup. If this is the case, it would be great if the documentation stated that somewhere.

    I also tried manually adding/removing prefab instances by calling the AddPrefabInstance() method on each of my prefab managers for each prefab instance that I wanted to instantiate. Unfortunately, this also didn't work - it looks like the AddPrefabInstance() method will prematurely return without doing anything if a prefab instance is already being instanced by another manager.

    I'm guessing that I could probably use the RegisterPrefabInstances() method to register a list of prefab instances on both of my prefab managers, but since I'm frequently adding and removing instances at runtime, this isn't feasible for performance reasons.

    Do you have any suggestions on how I can get around this problem?
     
  9. yyyttt120

    yyyttt120

    Joined:
    Jul 8, 2019
    Posts:
    1
    Screenshot_2020-06-01-10-06-03-352_com.Pathea.LiteGrassTest.png Screenshot_2020-06-01-10-06-20-637_com.Pathea.LiteGrassTest.png
    Hi,
    I got some problems while testing PrefabInstancingDemoMobile on android. Most asteroids became black triangles except the very close ones. It only happend when I used OpenGLES as the Graphics API in build setting. For vulkan, it worked well. I believe it's a common issue for Graphics.DrawMeshInstanced API since the same thing also happend when I was testing the codes from Unity's offical example.
    So, is there any way to make it work with OpenGLES, or Vulkun is my only option?
    Thanks!

    Test Device: Xiaomi 9, OS: 9.0, CPU: Snapdragon 855, GPU: Adreno640
    Unity Version: 2017.4.25f1, 2019.3.14f1, 2018.4.21f1
     
  10. ash4640

    ash4640

    Joined:
    Jan 19, 2018
    Posts:
    61
    Hi
    I'm using Polaris 2 for terrain generation and when I downloaded GPUI and tried adding a Tree instancer but the option is disabled infact for terrain instancing also pls see pic
    Also does it have any known limitations with bakery plugin
     

    Attached Files:

    Last edited: Jun 1, 2020
  11. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    388
    @LouskRad

    hi,
    is it possible to change density of GPUI terrain details instancing at Runtime?
    seems that is impossible :|
     
    Last edited: Jun 2, 2020
  12. katasteel

    katasteel

    Joined:
    Nov 21, 2014
    Posts:
    228
    Hello, I am trying to use your GPU Instancer tool for the first time.
    I am going though the video tutorials and the first is Detail manager.
    Here is a screenshot of my scene without GPU Instancer.
    BeforeGPUInstancer.JPG
    Then when I add GPU instancer I get this.
    AfterGPUInstancer1.JPG
    A lot of the grass is gone and the ones that are there are very bushy.
     

    Attached Files:

  13. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,
    and thank you for the feedback.

    We have made the required changes and will add them to the next update.
     
    ManaPotionStudios likes this.
  14. LouskRad

    LouskRad

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

    as the error message in the screenshot explains, you are using a built in shader and need to download it to your project from the Unity archives for GPUI to access its file. The button will take you to the download page.
     
  15. LouskRad

    LouskRad

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

    The Auto Add/Remove feature was designed based on a single manager use per prototype. You are right that this would not allow for two managers using the same prototypes. We will add this information to the documentation.

    Currently, you would need to manage your prototypes manually within a no game object workflow for this purpose. This does not mean that you cannot have game objects; but rather means that the Prefab Manager will not depend on the prefab instances in your scenes.
     
  16. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,
    GPUI relies on Compute Shaders for its operations, which are supported by GLES 3.1. You need to specify this in the build settings as mentioned in this F.A.Q wiki.
     
  17. LouskRad

    LouskRad

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

    The Detail and Terrain managers are designed for used with Unity Terrains. The menu items are disabled because there is no Unity Terrain in your scene. I'm not familiar with Polaris 2, but if you are using a mesh terrain, you can define your trees and vegetation to a Prefab Manager instead (this video shows an example).
     
    ash4640 likes this.
  18. LouskRad

    LouskRad

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

    it is possible only by re-initializing the manager. Please check this post for a similar answer.
     
  19. oshoham

    oshoham

    Joined:
    Oct 12, 2017
    Posts:
    4
    I see, thanks for clarifying that and for updating the documentation.

    I'm using GPU Instancer's material variations feature pretty heavily - if I had to switch to a no game object workflow, would I have to keep track of an index for each of my instances and switch to using the DefineAndAddVariationFromArray() and UpdateVariationFromArray() functions instead of the AddVariation() and UpdateVariation() functions?
     
  20. LouskRad

    LouskRad

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

    as opposed to the Unity Terrain rendering your mesh type detail prototypes with a Lambert shader, GPUI uses the same material on the Prefab of your prototypes.

    In the case of the bushy look, you can inspect your prefab in the scene and tweak its material properties. You can also can play with the manager settings; for example shadow casting is one which would make your vegetation look relatively different.

    For the case of the prototypes that do not show, the issue is most likely a shader problem. GPUI automatically handles shader setup in the background, but in some cases you might need to manually modify your shaders. Please check for any errors in the console window or the manager. If you can't see any errors, please take a look at this wiki for manually setting up your shaders for GPUI.

    Please note that texture type detail prototypes are rendered with the GPUI foliage shader (unless specified otherwise) and they would not need any shader setup.
     
  21. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Yes exactly.
     
    oshoham likes this.
  22. netpost

    netpost

    Joined:
    May 6, 2018
    Posts:
    244
    @LouskRad

    I am not sure I understand this message
    What I am trying to achieve is to use GPU Instancer on runtime generated prefabs. I tried using the asteroid generator to achieve this but my starfighter prefabs are randomize in orientation and size and it is a little hard for me to change the script since I am not a programmer. Is there a script in GPU Instancer to achieve a simple
    prefab spawn . At the moment I am using an asset to duplicate my starfighter prefab in a 3d grid but the generated prefabs can not be drag and used in your marvelous GPU Instancer.

    Any help would be greatly appreciated. Thank you.
     
  23. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    103
    Hi great product. Couple of questions.

    1) How is the map magic 2 integration coming along? Just curious if you have a timeline since we are looking at moving over to it for the project we are on Critter Cove.

    2) Not really related to you project directly but since I guess you work with a lot of third party stuff just wondering if you had any recommendations on terrain design products that would work well with GPUI. We have a large open world and need a tool that can help us hand place veg as well as procedurally place veg. I think Gena 2 and Map Magic 2 both seem like good choices but not sure what else is out there that might work well. We are currently using Veg Studio Pro but honestly, just cannot get it to perform the way we would like after spending a lot of time tweaking, was able to do a compare test using the same prefabs etc and GPUI performed far better, for us (not throwing shade, I am sure each project is different, just GPUI worked better for what we are doing). GPUI just hit the numbers we needed with very little work. It just lacks some of those design/generation elements that Veg Pro has so need to find a replacement.

    Thanks and great job.
     
  24. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    103
    *UPDATE* Tested getting rid of the root object and then the animation work (sort of, we use the root for a reason) so it does appear that animating/moving sub transforms via local position/rotation would not work? Thanks any info would be helpful.

    *UPDATE 2* Tried moving the animator to the root object and animating the sub (which is the more recommended way to do local position changes like this https://www.highwaynorth.com/blogs/bryan/relative-position-animation-in-unity). Still same results. Nothing happens.

    Another question related to animations not working on the GPUI prefab. I have set Enable Runtime Modification and Auto Update Transform, but no dice. My guess is its related to the structure of my prefab.

    So the root of the prefab is just a gameobject with a custom script on it and the GPU Instancer Prefab Script. Below that is the actual mesh renderer and animator. The animation just shakes the sub game object not effecting the parent. My guess is that the GPU Instanced Prefab does not work with child objects moving? Is that correct or something else going on here.

    Very simple setup so included it here. The parent resource_node_driftwood (1) only contains my custom script which just kicks of the animation on the sub that you see here and the GPU Instancer Script.

    upload_2020-6-6_7-55-48.png

    Here is the animation so you can see not doing anything special here.
    upload_2020-6-6_7-58-3.png
     
    Last edited: Jun 6, 2020
  25. InAngel

    InAngel

    Joined:
    Dec 30, 2017
    Posts:
    30
    HI,
    I recently bought gpu instancer and have a problem.
    In the example scene when i use unity terrain i get these stats:
    upload_2020-6-7_11-10-57.png
    And when i use the gpu i get almost the same (slightly less) fps
    upload_2020-6-7_11-10-14.png

    My question is why does this happen (even if the rendering is better).
    (btw the fps drop in urp is even bigger).
     

    Attached Files:

  26. Ardinius

    Ardinius

    Joined:
    Oct 4, 2015
    Posts:
    53
    Hi, possible bug report here, or i am doing something wrong...
    I have noticed that if i setup a prototype like so:
    upload_2020-6-7_23-3-54.png upload_2020-6-7_23-4-22.png
    When i Instantiate the prefab the GPUI prefab manager will report 0 instances:

    upload_2020-6-7_23-6-47.png instead of upload_2020-6-7_23-7-39.png
    The temp work around / solution i have found is to delete the GPUI prefab manager in the scene, and then add it again, and dragging the prefab into the prototype slot.But i have todo this every time i open UnityEdtior
    (Note the prefab i am spawning, has the prototype prefab object is a child of the prefab i am spawning).
    Unity 2019.1.0f2
     
    Last edited: Jun 8, 2020
  27. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    103
    *UPDATE* Ok so interesting. The bug is that we had mistakenly set the parent object containing these rocks scale Y value to a negative number -1.25 etc. This caused GPUI for some reason to invert the rock so it rendered inside out, which we did not see without GPUI on these rocks (guess Unity base ignores that value or just ignores the negative which is what it looks like.


    Another issue. These rocks are not rendering correctly. I can kind of see through them. The only thing I can think of is that these have been drastically scaled down. Granted we are going to just create non scaled rocks but figured I would post this to see if it might not be a bigger issues. Investigation to see if I can figure out what causes it to trigger.

    As you can see using a standard shader. These are grouped under a gameobject prefab (that is just a container).

    upload_2020-6-9_12-37-43.png
     
    Last edited: Jun 9, 2020
  28. chris_schubert

    chris_schubert

    Joined:
    Jan 8, 2019
    Posts:
    24
    Have you considered adding a distance falloff option? For example, with a prototype using min render distance of 0 and max of 100, a simple linear falloff would show 100% of the instances at 0m, 50% of the instances at 50m, and 1% of instances at 99m. Non-linear falloffs and configurable distances would be really nice.

    This can create a gradual fade-out of a prototype's instances instead of a hard-cut, and of course significantly decrease the geometry needed to render.
     
  29. Nihil688

    Nihil688

    Joined:
    Mar 12, 2013
    Posts:
    413
    Hey, it seems 2019.4 broke the plugin:

    Code (CSharp):
    1. Can't add renderer: mesh is null. Make sure that all the MeshFilters on the objects has a mesh assigned.
    2. UnityEngine.Debug:LogError(Object)
    3. GPUInstancer.GPUInstancerRuntimeData:AddRenderer(Int32, Mesh, List`1, Matrix4x4, MaterialPropertyBlock, Boolean, Int32, MaterialPropertyBlock, Renderer) (at Assets/Extra/GPUInstancer/Scripts/Core/DataModel/GPUInstancerRuntimeData.cs:149)
    4. GPUInstancer.GPUInstancerRuntimeData:CreateRenderersFromMeshRenderers(Int32, GPUInstancerPrototype) (at Assets/Extra/GPUInstancer/Scripts/Core/DataModel/GPUInstancerRuntimeData.cs:387)
    5. GPUInstancer.GPUInstancerRuntimeData:CreateRenderersFromGameObject(GPUInstancerPrototype) (at Assets/Extra/GPUInstancer/Scripts/Core/DataModel/GPUInstancerRuntimeData.cs:243)
    6. GPUInstancer.GPUInstancerPrefabManager:InitializeRuntimeDataForPrefabPrototype(GPUInstancerPrefabPrototype, Int32) (at Assets/Extra/GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:240)
    7. GPUInstancer.GPUInstancerPrefabManager:InitializeRuntimeDataRegisteredPrefabs(Int32) (at Assets/Extra/GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:227)
    8. GPUInstancer.GPUInstancerPrefabManager:InitializeRuntimeDataAndBuffers(Boolean) (at Assets/Extra/GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:183)
    9. GPUInstancer.GPUInstancerManager:OnEnable() (at Assets/Extra/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:204)
    What I'm doing is:
    Code (CSharp):
    1.  
    2.             m_PrefabManager = Object.Instantiate( Resources.Load<GPUInstancerPrefabManager>( "GPUI Prefab Manager" ) );
     
  30. Nihil688

    Nihil688

    Joined:
    Mar 12, 2013
    Posts:
    413
    I solved the above by reimporting the gpu instancer folder!
     
    LouskRad likes this.
  31. LouskRad

    LouskRad

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

    You can take a look at this wiki article to read about the difference between a user created prefab and a model prefab.

    Adding a spawner helper script would be out of the scope of GPUI since spawning is an issue that is too project specific to add as a simple script. One such simple script is actually the asteroid generator in the demo scene.

    There are various assets / scripts that do spawning. You can use one such solution and enable the "auto add remove instances" in the Prefab Manager for GPUI to render them.
     
  32. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there.

    Map Magic 2 integration will be available in the next update; which should be in the asset store next week.

    GPUI keeps track of transform changes in the instances of its defined prototype only. Any child transform changes in that instance would not be tracked by GPUI. That is, if you wish to have GPUI keep track of the transform changes of the child, you should add the child as a prototype and not the parent. This is because GPUI saves GPU memory by not using a buffer for every child but only one for the prototype itself.

    Yes, GPUI does not support negative scaling. This is one of the limitations.
     
  33. LouskRad

    LouskRad

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

    Using the detail manager, you can balance between visual quality and performance. Please take a look at this best practices article for further information. You can try various quality presets in the demo scene by using the F1-F4 keys. The biggest performance impact would be from shadows, which you can see without in the F2 mode.

    Please also note that GPU Instancer's performance will scale based on the power of the GPU it runs on.
     
  34. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there, the Unity version 2019.1.0 had various bugs related to the prefabs. I suggest first to upgrade your Unity editor. If you still have this issue after, please email us a video and/or sample project so we can investigate the issue.
     
  35. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    833
    Hi there,
    and thank you for the feedback.

    Implementing a generic fall off would not work for all use cases would not be ideal. There are too many parameters to consider; where a falloff logic would work for one object type it would not work for the other.

    However, this is one of the ways in which you could use the custom compute shader feature to implement your own logic depending on your scene and objects.
     
  36. ManaPotionStudios

    ManaPotionStudios

    Joined:
    Dec 26, 2016
    Posts:
    11
    Hello again! I am using unity deffault 3d renderer and post process package 2.3.0. And Ambient Occlusion from post process does not apply on grass. Any ideas why? Thanks alot!
     
  37. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    614
    Hi @LouskRad !!!

    Could you tell me if you have plans or your have made progress to fix the problem that LOD cross-fade feature doesn't work for HDRP.

    Cheers
     
  38. quarzwar

    quarzwar

    Joined:
    Jul 14, 2012
    Posts:
    13
    Hello,
    I am required to load in a large number of objects that exist both on a client and on a server.
    The server will not have a gpu, but must still load the objects in order to handle scripts placed on the game objects.
    Will the server be affected by not having a GPU?
     
  39. InAngel

    InAngel

    Joined:
    Dec 30, 2017
    Posts:
    30
    Even with F2 the difference is close.
    Another question why is the cpu higher in with the gpu instancer enabled?
     
  40. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,866
    Hi. @LouskRad

    Hi. I am having a little trouble trying to use non game object way. And I did manage to call InitializeWithMatrix4x4Array but it is doing nothing. The matrix array and its prototype seems to be good to me. Upon inspecting the manager, no prototype has been registered.

    I get no error... and the prototype did work with game object way before.

    Any idea on what I should look out for?

    My particular problem seems to be with registering the prototype with the manager... I don't have any prefabs in the scene to register with, but I have them in memory. So this is sort of how I did it :

    Code (CSharp):
    1.  GPUInstancerPrefabPrototype prefabPrototype = protoType.GetComponent<GPUInstancerPrefab>().prefabPrototype;
    2.                 GPUInstancerAPI.InitializeGPUInstancer(gpuInstancerPrefabManager, prefabPrototype);
    3.                 GPUInstancerAPI.InitializeGPUInstancer(gpuInstancerPrefabManager);
    4.  
    5.                 GPUInstancerAPI.InitializeWithMatrix4x4Array(gpuInstancerPrefabManager, prefabPrototype, ma);
    where protoType is prefab that is exist in the memory as reference ( not instanced in the scene ) and it has GPUInstancerPrefabPrototype component with it.

    I used different prefab manager in another scene to create protoType GameObject in editor time.

    I can't seem to get prefabmanager to register my prototype for some reason...

    My prefabmanager has no registered prototypes at all to begin with, because I need to do all of the registering during runtime as well.

    The included no gameobject example has manager already has the prototype registered to start with, so it does not exactly fit my workflow. I need to also register the prototype at runtime as well. ( with already created prototype in edit mode ) This is all because I am spawning prefab manager during run time as well, and they need to be empty because the same prefab can spawn multiple times for different levels that are generated during run time.

    Maybe I got this whole thing wrong, but I also could not find way to create prototype without registering them in the editor. But registering in the editor is no good for me, because it makes registering belong to specific manager only at edit time.
     
    Last edited: Jun 18, 2020
  41. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,866
    @LouskRad

    I was sort of able to register the prototype using :

    Code (CSharp):
    1. GPUInstancerPrefabPrototype prefabPrototype = GPUInstancerAPI.DefineGameObjectAsPrefabPrototypeAtRuntime(gpuInstancerPrefabManager, protoType.gameObject);
    2.                 GPUInstancerAPI.InitializeWithMatrix4x4Array(gpuInstancerPrefabManager, prefabPrototype, ma);
    But I am still unable to register instannces. the document says I should use AddInstancesToPrefabPrototypeAtRuntime

    But I can't because I need to do it by no gameobject way. Any idea?

    There seems to be no way of registering runtime prototype and then add instances using no gameobject way... I am stuck..
     
    Last edited: Jun 19, 2020
  42. mikerz1985

    mikerz1985

    Joined:
    Oct 23, 2014
    Posts:
    75
    Hello -- I've been using your asset for a while now and think it's really great.

    I have an immediate need to do culling/LOD with groups of indirect instanced meshes. Let's say I have 25,000 identical objects, and they are in groups of 200 in various unique formations. I want to do culling and LOD per group of instanced objects as opposed to per object. The overhead of frustum culling is much too high when doing it for the individual objects, and turning off culling is also not great.

    Do you have any recommendations for doing this in a performant way? The groups of objects don't move and their bounds are known ahead of time.
     
  43. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,866
    @LouskRad please comeback to the forum and respond to the support needs. I am really stuck, have already sent support request by your website and sent invoice number as well.
     
  44. mikerz1985

    mikerz1985

    Joined:
    Oct 23, 2014
    Posts:
    75
    I’ve noticed that in my project, GPUInstancer has terrible performance on forward lighting path but great on deferred. A matter of 40 FPS vs 200 FPS. This is on Windows with a gtx 1080 ti. The performance is the same if I don’t use gpuinstancer. Do you have any insight as to why this might be?
     
  45. Agatho_Kakological

    Agatho_Kakological

    Joined:
    Dec 27, 2019
    Posts:
    8
    Hii I generated a scene using gaia and then applied GPUI to the house prefabs on the scene, previously i was getting 27-35FPS but now after adding GPUI I'm getting 10 fps hardly, any solutions
     
  46. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,064
    Is there any way to inject a custom culler? In my case, I want to build my own culler that runs frustum culling in chunks as opposed to per instance. But it looks like everything is pretty much hardcoded...

    If this is not possible, are you planning on adding a form of chunked frustum culling? This allows for a middleground between frustum culling (calculate each individual foliage) and none (no frustum culling at all). In this form, the foliage is grouped into chunks, and if a chunk is visible in frustum, it renders all foliage in chunk. Otherwise, it hides all foliage in said chunk. The chunk size can be changed by the user, and would be dependent on how dense the foliage is.

    To increase performance, the chunk could also shrink depending on the actual bounds of all of the foliage in the chunk (max bounds calculated by the largest bounds LOD). Thus, if there's a single tree, then the chunk would shrink to the tree's bounds. If there are three trees, then it would shrink to encapsulate the three trees.

    I have the same issue, and above is a possible solution, although I think the developer would need to be willing to implement said feature, since there doesn't seem to be an easy way to inject custom culling calculations.
     
  47. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,220
    Hello,

    I have never totally been sure if I have to add the GPUIShaderVariantCollection here:

    upload_2020-6-25_9-50-31.png

    or somehow it's automatically injected when I build a new client.

    Second question:

    what is the number of these compute shaders calls depending on? My guess is that there are 4 for each prototype.

    upload_2020-6-26_8-45-2.png

    Could you explain to me what is the following for and why there are 3 running for each prototype? It seems LOD related, but we don't use LOD (except for trees)

    upload_2020-6-26_8-45-48.png
     
    Last edited: Jun 26, 2020
  48. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,866
    I wonder when author will come back to answer some questions. I sent the support email as well, but no answers.... :(
     
  49. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    103
    Anyone know a quick answer to this question. Basically want to know if there is any performance difference between using the Detail Manager to render prefab mesh ground cover (as opposed to just simple grass textures) or using game objects and/or non game object serialized option through the Prefab Manager. Basically underneath does the prefab manager and the detail manager do the same things when dealing with mesh objects, minus the overhead of the game object (which can be eliminated in the prefab manager by going with the non game object option). Do you gain anything other then convince with the detail manager, occlusion through the terrain etc anything.
     
  50. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,220
    hello @castor76, I hope the authors are on holiday, because we love this plugin and we want them keep on working on it, but for this question of yours, I can help.

    You have to ways to work with the no gameobject flow:

    A) you drag and drop the gameobjects in a GPUI manager inside your scene. The won't create any run time instance, it's just a sort of registration. This will automatically put the GPUI monobehaviours on your prefabs, that you can use to get the gpu instance prototype id from, that you can use it in this way:

    Code (CSharp):
    1. public IEnumerator RegisterPrefab(uint prefabId, string prefabName)
    2.         {
    3.             //careful, the resulting gameobject is actual the prefab, destroying it, would destroy the prefab
    4.             //on the hd!
    5.             AsyncOperationHandle<GameObject> loadAssetTask = Addressables.LoadAssetAsync<GameObject>(prefabName);
    6.  
    7.             while (loadAssetTask.IsDone == false)
    8.             {
    9.                 yield return Yield.It;
    10.             }
    11.  
    12.             GPUInstancerPrefab prototypePrefab;
    13.             if ((prototypePrefab = loadAssetTask.Result.GetComponent<GPUInstancerPrefab>()) != null)
    14.             {
    15.                 GPUInstancerAPI.InitializeGPUInstancer(prefabManager, prototypePrefab.prefabPrototype);
    16.             }
    17.             else
    18.             {
    19.                 throw new Exception($"invalid gameobject: {loadAssetTask.Result.name} has no GPUInstancerPrefab component");
    20.             }
    21.         }
    B) you create the manager at run time, this means you have to also register the prefabs at run time. To do so you can do t his:

    Code (CSharp):
    1. public void RegisterRuntimePrefabs(PrefabData[] prefabData, List<GameObject> prefabs)
    2.         {
    3.             for (var i = 0; i < prefabData.Length; i++)
    4.             {
    5.                 var prefabPrototype = GPUInstancerAPI.DefineGameObjectAsPrefabPrototypeAtRuntime(prefabManager, prefabs[i]);
    6.            
    7.                 GPUInstancerAPI.InitializeGPUInstancer(prefabManager, prefabPrototype);
    8.             }
    9.         }
    After you register and initialize, it's time to call

    GPUInstancerAPI.InitializeWithMatrix4x4Array(gpuInstancerPrefabManager, prototype, array);

    now you should start to see your staff on the screen!
     
unityunity