Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

[RELEASED] GPU Instancer

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

  1. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Hi, so we build our scenes in 1 project and add the prefabs to gpuinstancer, then create an asset bundle of the scene for playing in another project. When the scene is created GPUInstancer has all the registered instances and pressing play in on the editor confirms this. But when we build a scene to an asset bundle and then run it in the other project the GPUInstancePrefabManager says No registered prefabs, but has all the prototypes correctly displayed. Any ideas?
     
  2. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Any chance we can specify where GPUInstancer puts the SO's (maybe next update), we have tons of golf courses, we really only work on a few scenes at once and archive off any others from our project once complete, It would just become hugely bloated otherwise. The issue I have is that all the SO's are under GPUInstancer->PrototypeData. This will cause us problems as we keep all scene/course prefabs/data etc within a specific folder (usually named after the course) so that we can easily archive and restore courses into the project.
     
  3. GurhanH

    GurhanH

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

    HDRP does not have the "Shadow with Original Shader" option, because there is not a Shadows Only shader for HDRP so by default always the original shader is used. If the shadows are not showing, the shadow pass of the shader you are using might be missing instancing setup (e.g. UNITY_SETUP_INSTANCE_ID). You can find detailed information about how to setup shaders for GPUI here.

    If the issue persist, you can e-mail us a sample project showing the problem and we can investigate.

    Hi there,

    Prefab Manager keeps references for registered instances within the scene file. It sounds like somehow these references are lost, but I can not tell why since it depends on how you create/load your bundle. However you also have the option to register the instances at runtime using the API or by enabling Auto. Add Remove Instances option.

    Thank you for the feedback, we will look into making the path editable. However for now you can simply move the prototype files where you wish after they are created under the PrototypeData. The references to prototype data are not path dependent, so they can be safely moved to different folders.
     
    Mojo-Game-Studio likes this.
  4. newguy123

    newguy123

    Joined:
    Aug 22, 2018
    Posts:
    1,248
    I'm using a regular HDRP/Lit shader
    Using the GPUI/HDRP?Lit shader/ didnt make a difference either

    Cant it auto correct the bits needed?

    I'm on 2021.2.0b13 HDRP 12 with Raytracing
     
  5. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    111
    Enabling the Auto.AddRemoveInstances still gives the same issue when streaming from the asset bundle, the prototypes are there in the GPUInst manager but the instances get lost. Is there a command or API call something like GetPrefabInstanceList? I figure if I store this list somewhere in the source project and iterate through it adding them back when the scene opens from the asset bundle it should solve the issue...?


    As a side not I'm also getting the same issue as @newguy123 regards the shadows not displaying in builds or during runtime (oddly in the editor they are fine), I'm using nature renderer shaders for foliage set to be compatible with GPUInstancer also in HDRP. I haven't checked yet the shader code, so it could be missing some references as per the docs. Shadows for other items using the hdrp/lit shader works fine tho, so I suspect max at nature renderer may not be up to date with his integration with your asset, just a FYI.

    Using 2020.3.5 and hdrp 10.4 and std hdrp/lit shader works
     
    newguy123 likes this.
  6. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Lit shader wouldn't have an instancing setup issue, so the issue is not related to shader then.

    GPUI does not support Alpha and Beta version of Unity since they usually have issues that needs to be resolved by Unity. I recommend to use a LTS version for stable development environment.
    As for raytracing, it is also an incomplete "preview" feature which already has limitations for shadows and it's documentation says that it does not support Graphics.DrawMesh commands. So it wouldn't work with GPUI.

    You can access the registered instances from GPUInstancerPrefabManager.registeredPrefabs. But if the Auto Add Remove did not work, there might be an issue with initialization. Make sure the manager is loaded and initialized before adding instances.
    I didn't use the nature renderer before but since it is also a rendering system, it's shaders are probably designed for their own system. Also from their asset description it does not look like they have an integration with GPUI.
     
  7. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    Hello, I have a question for the Dev:

    So I've been profiling my game and found that GPUI appears to introduce a 79ms delay on the main thread, causing a Gfx.WaitForPresentOnGfxThread / Semaphore.WaitForSignal to appear in the profiler's timeline. It may not seem like much, but I have 100k+ units on my screen right now and my AI code (for all of them) is taking less time per CPU cycle than the Gfx.WaitForPresentOnGfxThread / Semaphore.WaitForSignal delay.

    To mitigate some of that that I wanted to try running GPUInstancerAPI.UpdateVisibilityBufferWithNativeArray from an IJob, so that It won't slow down the main thread, but the problem is that you can't have reference types in a struct. It would be very useful to have a method that either schedules it for us or doesn't require those references.

    Basically the issue is that GPUIPrefabManager and GPUInstancerPrefabPrototype are classes. I will dig through your code deeper this week, but it would definitely help to have your help with this. Maybe we can come up with a method that can be called with the value types directly?

    Also, do you know why GPUI causes this to happens? Any other idea on how to speed this up?

    FYI I have 100k units rendered, but they are sprites so only 2 triangles each, and I'm sending updates only for 1000 units per frame to GPUI at the moment.

    Here is what it looks like:
    upload_2021-10-4_5-48-28.png
     
    Last edited: Oct 4, 2021
    PutridEx likes this.
  8. GurhanH

    GurhanH

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

    "Gfx.WaitForPresentOnGfxThread" means that your application is GPU-bound. The main thread is waiting for the GPU to finish its operations. So it won't help you to optimize the main thread. If you want to see which operation is taking time, you can use a graphics debugger such as RenderDoc.

    For example (this is usually the case) you might have a complex shader that takes time to complete the rendering process. You can test the same units with a simple shader and see if it makes much difference and than try to optimize the shader.
    Related to GPUI, if the culling operations on the GPU is taking considerable time, you can try to lower the instance count by making some of the easy/obvious culling operations on the CPU side. Or you might be using Occlusion culling, which requires depth texture, and the gain from the culling might be less than the time it takes to process the depth texture. In which case you might have better performance without occlusion culling.
     
    FlightOfOne likes this.
  9. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    504
    GPU bound with 200k triangle on a Vega64?

    Also, what is weird is that every few frames there is no Gfx.WaitForPresentOnGfxThread delay.

    I tried disabling all culling in GPUI, but it didn't affect the performance at all.

    Edit: So I just ran a test with the same material and mesh via DrawMeshInstancedIndirect and the delay is gone, and I gained 500fps. Plus, on that test, I have an extra compute shader that is moving EVERY single units. Every frame. While on the previous test with GPUI I was not updating their position. I am very confused here. With all culling disabled I was expecting similar performance. Not almost twice as fast. I can literally draw 1 million moving instances with DrawMeshInstancedIndirect vs 100k on GPUI for the same perf. There has to be something going on here.
     
    Last edited: Oct 5, 2021
  10. daedal

    daedal

    Joined:
    Dec 19, 2013
    Posts:
    31
    I'm considering using GPUI and I have some questions about a specific use case of mine. I need to be able to adjust the properties of my grass shader in specific areas for a short duration. This would be done in response to environmental effects like fire, wetness, and frost. Just adjusting the color tint alone would go a long way toward achieving the desired effect.

    Would editing grass shader properties with a MaterialPropertyBlock be compatible with GPUI? Or would another approach be best like adding some logic to the shader to sample the color tint for that location off of a texture? Any thoughts on getting this use case to work in a performant manner?

    Thanks!

    Edit: Looks like TVE can get the job done. I should be good here.
     
    Last edited: Oct 8, 2021
  11. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    I'm using GPUI with TVE (for the trees' materials) and Gaia (for placement/spawning). Despite having random height/rotation set to 'on' on every toggle I can find across all these managers and on the terrains themselves, my trees al have the same height and the same rotation. How do I fix this?
     
  12. FlightOfOne

    FlightOfOne

    Joined:
    Aug 1, 2014
    Posts:
    668
    Hi,

    World it make a difference (performance wise) when using GPUI, to have 1000 trees as prefabs in the hierarchy versus having the same 1000 trees (or even grass quads?) painted using Unity terrain system?

    Thanks.
     
  13. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,778
    I am looking to replace my very simple GPU instancing system and came across your asset. I would like to add 100,000's of objects to the scene and render them using instancing but I dont want to add them as gameobjects which I think is what your system does as I dont want the memory overhead etc that goes with that, can your system just take an array of Matrix4x4's and use that to render a mesh to the scene? I dont need to move the objects, collide etc. If it can do that is there the option to make use of the frustum and occlusion culling with that as well.
    If it cant do that is there a big overhead in having 100,000's of cluttering up the hierarchy other than memory use.
     
  14. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    I am not sure what is causing the delay here. If you can email us a sample project showing this issue we can investigate.

    Hi there,
    Happy to hear you found a solution. For future reference: MaterialPropertyBlocks are not compatible with GPUI. However you can implement variations within your grass shader using textures as you suggested, or if you need something more precise you can use GPUI's material variations feature.

    GPUI gets the rotation value for trees from the terrain. So if you are seeing that the trees are not rotated, it is probably because rotation values on the terrain is zero. Which might be related to the spawning tool you are using.

    If you wish, you can edit the code to make GPUI use a random rotation instead of the terrain value by editing
    GPUInstancerTreeManager.cs line 197
    from this:
    Code (CSharp):
    1. treeInstance.rotation,
    to this:
    Code (CSharp):
    1. UnityEngine.Random.Range(0f, 360f),
    Hi there,

    Rendering performance would not change since both Prefab Manager and Tree/Detail Manager uses the same rendering system. The main difference would be on the memory usage. Using prefabs will use up more memory.

    Hi there,
    GPUI has a No-GameObject workflow which allows you to use Matrix4x4 arrays to render your instances and also use the frustum and occlusion culling features. There is a demo scene called PrefabsWithoutGameObjects within the asset that exemplifies this. You can also read detailed explanation from our Best Practices documentation here.
     
    Last edited: Oct 8, 2021
    FlightOfOne likes this.
  15. kvelertak

    kvelertak

    Joined:
    Nov 11, 2020
    Posts:
    6
    Hi,

    I'm thinking to purchase this asset, but I'm not sure if it will work on my game. I have an open world made with Gaia 2 and I need to interact with the trees (chop and so on), is it possible with GPUI?

    thanks in advance!
     
  16. aaronmichaelfrost

    aaronmichaelfrost

    Joined:
    Feb 4, 2021
    Posts:
    39
    Hey there, quick question:

    Is there a good way to store matrices / detail data in a prefab?

    I currently have a script that does this by storing a Matrix[] in a component, which then are initialized at runtime by combining matrix arrays with existing ones when a tile is loaded. This is awfully complicated for one, and also doesn't work with floating origin.

    Thanks.
     
  17. daedal

    daedal

    Joined:
    Dec 19, 2013
    Posts:
    31
    Hey, I'm using multiple small terrains with a detail manager for each one. The detail managers are not consolidating the draw calls for the same terrain details, resulting in a large performance hit. Disabling all but one detail manager brings my FPS from 60 to 120.

    I'm seeing that you do this consolidation for the tree manager? Is that not the case for the detail manager?

    I'm using Staggart's Vegetation Spawner to spawn my details across the multiple terrains. Adding prefabs to that spawner automatically generates the prototypes for each detail manager. Could that be part of the issue?

    Thanks!
     
  18. ksicotte

    ksicotte

    Joined:
    Apr 26, 2021
    Posts:
    4
    Hi, I need to have a prototype that is a billboard. It's a column of smoke and it is not an imposter, but really just a mesh that rotates toward the camera at all time. However, it doesn't seem to billboard at all when it's instantiated by GPUI.

    Are simple billboards supported by GPUI? I tried with and without the use the custom billboard option and it doesn't work.
     
  19. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Hi there,
    There are couple of different ways with GPUI how you can approach this. The most straight forward way would be to have your tree objects as prefabs and use the Prefab Manager. Then enable Auto. Add/Remove Instances option to automatically remove trees when the prefab is destroyed.

    Hi there,
    There is the Serialize Registered Instances option under the advanced settings which saves the matrix data to a text file. But I am not sure if this is what you are looking for. You might need to implement a custom No-GO workflow depending on your needs.

    I can not tell for sure without seeing the profiler data. But in general Detail Manager does not perform very well with many small terrains. If you wish, you can email us a sample project and we can investigate where the bottleneck occurs.

    If you are rotating the mesh through its transform with a script you can enable Auto. Update Transform Data option so that GPUI makes updates automatically.

    When your original object is a billboard, you do not need to add a custom billboard. That option is there to add an extra LOD to work as a billboard at a specified distance.

    If this does not help, send us the details of your billboard implementation so we can guide you how to integrate it with GPUI.
     
  20. PaulDyatlov

    PaulDyatlov

    Joined:
    Jul 6, 2019
    Posts:
    25
    Hello! After the update to the latest Unity version (2021.2.0f1) I'm having this:

    Code (CSharp):
    1. Texture creation failed. 'None' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support.
    2. UnityEngine.RenderTexture:.ctor (int,int,int,UnityEngine.Experimental.Rendering.GraphicsFormat)
    3. GPUInstancer.GPUInstancerHiZOcclusionGenerator:OnEndCameraRendering (UnityEngine.Camera) (at Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:158)
    4. GPUInstancer.GPUInstancerHiZOcclusionGenerator:OnEndCameraRenderingSRP (UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Camera) (at Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:126)
    5. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    6.  
    and this:

    Code (CSharp):
    1. NullReferenceException
    2. GPUInstancer.GPUInstancerHiZOcclusionGenerator.OnEndCameraRendering (UnityEngine.Camera camera) (at Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:159)
    3. GPUInstancer.GPUInstancerHiZOcclusionGenerator.OnEndCameraRenderingSRP (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) (at Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:126)
    4. UnityEngine.Rendering.RenderPipelineManager.EndCameraRendering (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) (at <de62ab64366d4d29973fce8773660238>:0)
    5. UnityEngine.Rendering.RenderPipeline.EndCameraRendering (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) (at <de62ab64366d4d29973fce8773660238>:0)
    6. UnityEngine.Rendering.HighDefinition.HDRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List`1[T] cameras) (at Library/PackageCache/com.unity.render-pipelines.high-definition@12.1.0/Runtime/RenderPipeline/HDRenderPipeline.cs:1841)
    7. UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List`1[T] cameras) (at <de62ab64366d4d29973fce8773660238>:0)
    8. UnityEngine.Rendering.RenderPipelineManager.DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset pipe, System.IntPtr loopPtr, System.Collections.Generic.List`1[T] renderRequests, Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle safety) (at <de62ab64366d4d29973fce8773660238>:0)
    9. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    10.  
    Any ideas how to fix this?
    Thanks!
     
  21. daedal

    daedal

    Joined:
    Dec 19, 2013
    Posts:
    31
    I ran into the same null reference that rjohnson06 pointed out with GPUInstancer.GPUInstancerUtility.DispatchCSInstancedCameraCalculation. The cameraComputeKernelIDs is null in this case. This is occurring for me on the latest LTS version and with URP after compiling any code changes.

    I found out that GPUInstancerManager.Awake is not getting called in this case so many variables are not getting initialized. Seems to be an issue related to this class executing code in the editor outside of play mode.

    Adding this hacky solution to the top of GPUInstancerManager.Start fixed the issue for me.
    Code (CSharp):
    1.            
    2. if (_cameraComputeKernelIDs == null)
    3. {
    4.    Awake();
    5. }

    Maybe you can find a cleaner solution!
     
  22. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,644
    I am baffled but I may be just confused as my memory doesn't always serve me right. I thought I knew very well GPUI code at this point, but to my surprise, there is still code that doesn't check out for me.
    Why is the prototype distance culling not taking into consideration the bounding? I guess it's an early check before the actual frustum one which I assume/think also check the far plane.
    Why isn't the code checking if the far plane linked to the prototype is beyond the camera far plane and in this case use the camera far plane?
     
  23. GurhanH

    GurhanH

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

    Looks like the error is caused by the occlusion culling, but I have made tests using 2021.2.0f1 with both HDRP and URP and did not see this error. Can you email us a sample project or details about your project setup, and especially include your SRP settings and your camera settings so we can try and recreate the issue?

    Thanks for the feedback. Looks like Unity might have made changes on script executions on editor mode. We will add a precautionary measure to prevent this on the next update.

    Distance culling is what the name suggests, culling objects that are farther or closer than a specified distance value. It is like the Detail or Tree Distance settings on the Unity Terrain. Camera far plane is something different, it is more related to frustum culling instead of distance culling.
     
  24. daedal

    daedal

    Joined:
    Dec 19, 2013
    Posts:
    31
    I ran into another issue that's only affecting VR (single+multipass, multiple devices). The frustum culling is apparently inverted. So objects rendered with the prefab manager are not visible when the camera was centered on them. However, you are able to see them on the edges of the camera view. This issue was persistent until I tried toggling frustum culling off and then back on.

    Unfortunately this solution is only temporary. The issue pops back up occasionally upon entering play mode so I keep having to do that toggling.

    (I also haven't seen this happen in a proper build so it's not a critical issue)
     
    Last edited: Oct 29, 2021
  25. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,644
    Thanks for the reply, you didn't specify if the distance culling is from the centre of the object (I can figure it out). If so the distance culling is not what I need (and I am not sure what it should be useful for, culling without the extents of the bounding box is such a weird concept), the question is, how do I set the far plane for the frustum culling and why is it not read (apparently) from the camera?

    Edit: I checked and the frustum culling seems to be done in clip space using the actual camera projection matrix and the object bounding box.
     
    Last edited: Nov 2, 2021
  26. Cery_

    Cery_

    Joined:
    Aug 17, 2012
    Posts:
    48
    Hi so far i really like the GPU Instancer,
    we are using it in an AR Application. The Problem we faced was that you support a floating origin with changing position but not changing rotation. The instances we are rendering are attached to a surface that is managed by the AR system. Unfortunately this can change during the session. The perception of the device might relocate and rotate the surface depending of the sensor data of the device in unity world coordinates.

    We were able to overcome this by modifying the floating origin handler and runtimeModification system.
    It would be great for this to be a default supported feature so we can update and don't worry about testing etc.

    Maybe there is already such a feature and we just missed it?
    If you are interested i can share the code with you. -Just didn't want to upload it here since it contains part of your source code.
     
  27. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Sounds like the camera projection matrix is incorrect. If you wish to debug, GPU Instancer retrieves the projection matrix inside GPUInstancerCameraData.cs at line 45 "mainCamera.GetStereoProjectionMatrix".

    Please make sure that you are using the latest version of GPU Instancer, we made some improvements/fixes related to this a while back.
    We also saw that some Unity versions have bugs while retrieving projection matrices on VR especially on SRP. I recommend to use the latest LTS version to be safe.

    If these does not help, please email us detailed information following this guide so we can investigate the issue.

    Hi there,
    and thank you for your kind words and the feedback.

    We did not consider this usage while implementing the floating origin feature since it was mainly requested for Unity Terrains. We will look into adding support for rotation and scale changes in the future updates.
    You are always welcome to send your suggestions for code changes to our support email.
     
  28. kvelertak

    kvelertak

    Joined:
    Nov 11, 2020
    Posts:
    6
    Hi there,

    I have a big issue with this asset... it does not get a better performance when is enabled, for example, with a custom terrain with some random grass I get aprox 150 FPS, but if I enable GPUInstancer I get 90 FPS.

    To discart that I'm doing something wrong I've checked too the demo scene DetailInstancing that comes with the package. I get similar results, without GPUI it works well, with GPUI the performance fall even down 40 FPS.

    I'm not using prefabs, just using the GPUI detail manager, I've checked it with Unity 2021.1.19f1, 2020.3.1f1 and 2019.4.16f1 and in all I get similar results.

    I've checked too compiling these scenes to see if the problem is in the Unity editor, but again I get better results without GPUI.

    If I run the PrefabInstancing demo it works great! but I need this asset to be used with terrain (grass, trees and so on).

    If I run AddModifyTerrainsRuntimeDemo I get 80-90 FPS with all terrains, but if I disable GPUI the GPU instancer detail manager script I get 350 FPS, it seems that something happens with GPUI and the terrain stuff.

    If I run TreeInstancing demo I get 180 FPS with GPUI enabled and 90 FPS disabled, the expected behavior.

    With some custom tests with a terrain generated by Gaia I get another annoying issue, if I generate terrain trees, the editor is stuck with the message Application.UpdateScene... I have to kill the process to enter again.

    Finally, if I run the demo GPUInstancerDemo_v0.8.2b1_Win it works great, even with 200k asteroids, if I activate GPUI I get 200-300 FPS and if I disable it I get 30 FPS, this is the expected behaviour.

    Any idea?
     
    hippocoder likes this.
  29. pierre92nicot

    pierre92nicot

    Joined:
    Aug 21, 2018
    Posts:
    57
    Hello!
    It looks likes occlusion culling isn't right in VR (single pass instanced, URP, 2020.3.21 LTS).
    It works perfectly fine if I close the right eye but with both eyes opened I can see the instances poping in and out.
     
  30. WeltenbauerRenn

    WeltenbauerRenn

    Joined:
    Jun 20, 2017
    Posts:
    40
    Hi, we had error spamming on PS5.
    After some emails with Unity. They found out that the PS5 requires all buffers to be set. To fix this we needed to add
    the instaceLODDataBuffer to the shadow casting material property block. This fixes our issues.

    Code (CSharp):
    1.  renderer.shadowMPB.SetFloat(GPUInstancerConstants.VisibilityKernelPoperties.BUFFER_PARAMETER_LOD_LEVEL, -1);
    2. +renderer.shadowMPB.SetBuffer(GPUInstancerConstants.VisibilityKernelPoperties.INSTANCE_LOD_BUFFER, runtimeData.instanceLODDataBuffer);
    3.                      }
     
    GurhanH likes this.
  31. GurhanH

    GurhanH

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

    Can you please send us an email with the requested information in this guide? Please make sure to check if you are getting any console errors and also include in the email your hardware specs where you make these tests. It would also help if we can see the Profiler data for these results both with GPUI enabled and disabled.

    Hi, is the Test Both Eyes for VR Occ. Culling option enabled in your project's GPU Instancer Preferences? If it is already enabled, can you please email us a short video of this issue and also include which VR hardware and also which VR specific software (if any) you are using?

    Hi there,
    and many thanks for informing us. We will add the necessary changes on the next update.
     
  32. pierre92nicot

    pierre92nicot

    Joined:
    Aug 21, 2018
    Posts:
    57
    Hi again, it looks like I can't enable it.
    Using a 2080 and SteamVR.
     

    Attached Files:

  33. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    There were issues with projection matrices provided by Unity on both URP and HDRP. Looks like Unity provided a fix for URP 12.0.X:
    I don't know if they will backport it to 2020.3 LTS. But we will test it on URP 12 and see if any changes are required on our side.

    SRP is still problematic with VR, hopefully Unity will fix the issues instead of adding half-baked features.
     
    pierre92nicot likes this.
  34. GurhanH

    GurhanH

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

    GPUI v1.6.0 is now available on the Asset Store.

    It adds one of the frequently requested features: Material Variations support on Android.

    I want to point out one important change that can make a difference on shader performance and also required for Android if you are using material variations with a custom shader. To lower the number of buffer accesses and to be able to use variations on Android, we set gpui_InstanceID inside the instancing setup function. When you are implementing a custom shader with material variations, make sure to use gpui_InstanceID instead of gpuiTransformationMatrix[unity_InstanceID]. Included shaders have already been modified and you can see the recommended usage from this documentation.

    This update also includes various other improvements and fixes. Here is the full changelog:

    New: Material Variations support on Android
    New: Option to apply rotation and scale changes for Floating Origin feature

    Changed: Pre-set gpui_InstanceID inside shader setup function for better performance while using material variations
    Changed: Added progress bar and cancel button to Prefab Replacer
    Changed: Occlusion Culling on HDRP now gets the depth from the texture array directly instead of copying it to a temporary texture

    Fixed: Detail Manager simulator still runs after the manager is disabled when keep simulator live option is active
    Fixed: Material variations does not effect shadow passes
    Fixed: Compute shader method typo
    Fixed: Sometimes Managers Awake method is not being called at Editor Mode causing null reference errors
    Fixed: GLES3 compute shader maximum UAV warning
    Fixed: GLES3 incorrect shadow instance count calculation
    Fixed: GLES3 shadows only shader not working
    Fixed: SPDTree shader duplicate instancing pragma warning
    Fixed: PS5 invalid compute buffer handle error
    Fixed: HDRP Occlusion Culling error "Texture creation failed. 'None' is not supported"
     
    PutridEx likes this.
  35. daedal

    daedal

    Joined:
    Dec 19, 2013
    Posts:
    31
    I'm getting the following error after updating to v1.6.0:

    Code (CSharp):
    1. IndexOutOfRangeException: Index was outside the bounds of the array.
    2. 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/Plugins/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:374)
    Having prototypes with four LOD groups seems to be what's setting this off. There are only 3 values in the instanceVisibilityComputeKernelIDs array and the COMPUTE_MAX_LOD_BUFFER is set to 4, thus causing the out of index issue.
     
  36. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Thank you for reporting the error. COMPUTE_MAX_LOD_BUFFER value should be 3 instead of 4.
    GPUInstancerConstants.cs line 39:
    Code (CSharp):
    1. public static int COMPUTE_MAX_LOD_BUFFER = 3;
    I will submit a fix soon to resolve the issue.

    Edit: Fix is now available. You can update and re-import from Package Manager.
     
    Last edited: Nov 9, 2021
  37. kvelertak

    kvelertak

    Joined:
    Nov 11, 2020
    Posts:
    6
    Hi guys,

    I'm trying to use some trees from Custom Tree Importer (CTI), and it seems that this shader not use a mesh for the billboard LOD, then GPUI don't render it. I'm trying to use the GPUI buld-in billboard generator, but I get this message:

    "Generated billboards are currently not supported in SRP. You can assign custom billboard balbla".

    I'm using URP, then this feature is disabled here?

    In other hand, I'm trying to assign a custom billboard mesh and a material, if I use a quad mesh I cannot see the results, but if I use a cube I see the billboard (but not as I want).

    Any idea? The ideal thing is to use the billboard generator.

    Thanks in advance

    BR

    Joaquín
     
  38. GurhanH

    GurhanH

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

    GPUI currently supports billboard generation only on Standard pipeline. We are working on billboard generation for URP and HDRP but I can not tell when it will be available at the moment. For now you either need to use a third party system like Amplify Impostors or implement your own mesh and material for billboards.
     
  39. JesterGameCraft

    JesterGameCraft

    Joined:
    Feb 26, 2013
    Posts:
    452
    Hi,

    I'm considering purchasing this asset but wanted to know if it was tried on iPhone 5s (Metal). Also, do you have an evaluation version I could try out to see if it work for my use case? Regards.
     
  40. XJDHDR

    XJDHDR

    Joined:
    Mar 31, 2020
    Posts:
    27
    Sorry if this has already been answered elsewhere but does this support Entities/DOTS?
     
    lclemens likes this.
  41. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Hi there,
    GPU Instancer supports Metal API but we have not tested iPhone 5s specifically. We also recommend GPUI to be used with high-end mobile devices, because with old mobile devices its use will be limited.
    GPU Instancer does not have an evaluation version. You can try the demo builds to see it in action.

    Hi there,
    We recommend to use No-GameObject workflow with DOTS, where you can provide an array of matrices to render instances without GameObjects. There is also a demo scene within the package that exemplifies this.
     
  42. michailhabun

    michailhabun

    Joined:
    Nov 26, 2015
    Posts:
    2
    Hi,
    I have problem with current version of GPU Instancer and new Unity 2021.2.2f1.
    After I add the Prefab Manger and setup first prototype prefab - unity trying to update the scene on every action. So every time when i move mouse or try to click or something else it will show to me Hold On popup and that's all. Can you help me with that? Project created with
    URP last version.
    If I will revert the scene in git (prefab manager will be removed) - everything back to normal.

    UPDATE: problem fixed by adding gpu instancer setup node to shader graph shader
    + moved add prototype section to text mode and add prefab by button.
    upload_2021-11-18_15-24-25.png
     
    Last edited: Nov 18, 2021
  43. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Hi there,
    Good to hear that you found a solution. There have been another report of this issue on Unity 2021.2 which was solved by the user again. It is possibly a Unity bug. I tried to recreate the issue from your description but I was unsuccessful. There might be some other settings/third party code, that triggers this. If you find out how to recreate this error on a new project please let us know. Or if you can email us a sample project where we can see this error, it will be much appreciated.
     
  44. oprishka

    oprishka

    Joined:
    Feb 26, 2017
    Posts:
    5
    Hi. I have such a situation, I downloaded the demo build of the GPU instancer and tested all the demo scenes with asteroids .. But on each scene the result is the same that with the GPU turned off, so how can this be?
     
  45. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Hi there
    Your graphics card settings might be forcing V-Sync and it might be capped at your monitor's refresh rate (e.g 144Hz monitor and ~144 FPS). So you wont see see the results when it is over this max FPS.
     
  46. gewl

    gewl

    Joined:
    May 19, 2016
    Posts:
    95
    Is there a recommended or intended workflow for using GPUI tree manager(s) with terrains that each belong to individual scenes which are streamed at runtime, but which all share the same tree prototypes?
     
  47. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Hi there,
    You can have one Tree Manager with the initial terrain and add the additional terrains to this manager from the streaming scenes. You can read about how to do it on this wiki article.
     
    gewl likes this.
  48. GurhanH

    GurhanH

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

    GPU Instancer v1.7.0 is now available on the Asset Store.

    This version comes with 2D Billboard generator support for URP and HDRP. Please note that you will need URP/HDRP version 10.x and later to be able to use the billboard generator.

    We also addressed the "slow editor" or "stuck with Application.UpdateScene message" issues on HDRP, which were the result of running auto shader conversion on incompatible complex shaders (with tens of thousand of lines of code). With this update, the auto shader conversion will run much faster than before and GPUI will inform the process with progress bars and better messages.

    There are also improvements and fixes for VR Occlusion Culling. However please note that we assume that Unity provides correct camera projection matrices for VR. Some Unity/URP/HDRP versions provide false projection matrices which results in incorrect culling. E.g. URP has errors prior to version 12.x, HDRP currently has bugs on all versions.

    This update also includes various other improvements and fixes. Here is the full changelog:

    New: 2D Billboard generator support for URP and HDRP 10.x and later

    Changed: When a shader is missing GPUI instancing setup, an error shader will be used and an error will be shown on the console instead of a warning
    Changed: When Shader Graph shader is missing GPUI instancing setup, a link to the shader setup documentation will show on the prototype settings with an error message
    Changed: Prototype Billboard Settings can now be edited when multiple prototypes are selected
    Changed: Automatic shader conversion processes shader code much faster now

    Fixed: "Importer(NativeFormatImporter) generated inconsistent result for asset" warning when a prototype is removed from Tree/Detail Manager
    Fixed: Automatic shader conversion causing editor to stuck with message "Application.UpdateScene"
    Fixed: Missing Tree Proxy shader on SRP causing Argument null exception when using SpeedTree shader
    Fixed: SpeedTree prototypes does not take billboard distance setting into consideration
    Fixed: Test Both eyes for VR Occ. Culling not working on Single Pass Instanced rendering mode and on SRP with Multi Pass rendering mode
     
    Rewaken, pierre92nicot and PutridEx like this.
  49. Shii

    Shii

    Joined:
    Nov 23, 2014
    Posts:
    31
    Thanks for fixing VR Occlusion Culling.
    But I noticed that Frustum culling in VR mode is still too narrow: it not culling eyes separately resulting objects culling too early at left eye left screen edge and right eye right screen edge. And effect is different depending if Occlusion Culling enabled or not.
    With occlusion culling disabled both edges a culled wrong. With occlusion culling enabled only right screen edge culled wrong.
    Best test scene for this: DetailInstancing
     
  50. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Hi there,
    Make sure that you have Test Both Eyes for VR Occ. Culling option enabled under Edit -> Preferences -> GPU Instancer. If you have still issues after enabling this option, try the same scene with the latest Unity version (currently 2021.2.4). As I mentioned, some Unity versions have bugs that provide false camera projection matrices. If both of these does not change the result, please email us your VR and Render Pipeline settings so we can have a look.