Search Unity

[RELEASED] GPU Instancer

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

  1. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    Hi,

    I have a small problem. My cactus is destroyable and has a billboard. The problem is that the billboard always shows the object in its original rotation. When my cactus was broken and lies on the ground, the billboard does not rotate with the object. Is there a way to fix that?

    https://imgur.com/HjGXsig

    thanks!
     
  2. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Hi there,
    Unfortunately billboards can only be rotated on the y axis. So it can not lie on the ground. You might need to remove the cactus instances that needs to rotate from GPUI, or use a custom billboard that supports 3d rotation instead of the built-in one.
     
    marcell123455 likes this.
  3. marcell123455

    marcell123455

    Joined:
    Jun 18, 2014
    Posts:
    275
    Hi Gurhan,

    Do you think it is possible to disable the billboard for specific objects if my destroyable cactus is "broken"?

    Thanks
     
  4. Marco-Playable

    Marco-Playable

    Joined:
    Nov 12, 2020
    Posts:
    53
    I was trying to follow this example to replace the costly ComputeBuffer.SetData() with BeginWrite/EndWrite when updating the transformationMatrixVisibilityBuffer :
    https://www.sebaslab.com/the-1milli...-a-freakload-of-cubes-on-windows-using-unity/

    Same as the article's author, I found that defining the buffer mode as SubUpdates works fine on Vulkan but fails on DirectX without any errors (it just looks like the Compute Buffer never makes it to the GPU even though the profiler shows time spent doing something). A commenter was saying DrawMeshInstancedIndirect is working on DX11 with BeginWrite but not when GPUInstancer is in the mix.

    Just wondering if you had investigated this scenario and had any thoughts on the matter.
     
  5. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    No unfortunately, there is no easy way to do it. I would recommend to simply use the RemovePrefabInstance API, and render it regularly.

    Hi there,
    We need to use Immutable mode because it allows for modifications on the Compute Shaders and it is faster to access on the GPU.
    SubUpdates mode will cause issues while reading/writing with Compute Shaders (e.g. CPU modified buffer indexes read as undefined on the GPU).
    I don't know why it works on Vulkan, possibly there are internal limitations and the buffer does not really work as dynamic.
    If you use DrawMeshInstancedIndirect without Compute Shaders, it would work. But with GPUI, Compute Shaders are not optional, so only Immutable mode is supported. Additionally, Dynamic buffers are slower to read on the GPU, which would also slow down GPUI's performance.
     
  6. SkandYxyz

    SkandYxyz

    Joined:
    Mar 13, 2015
    Posts:
    83
    Hi!

    I use GPUI Tree Manager with Vegetation Engine converted trees. It works well in runtime mode but i can't see the trees in editor mode. Same with adding tree in prefab manager. The only thing I see are the short LOD transitions. Even if I add the Tree prefab directly to scene, I cant see the tree. Trees that were not added to GPUI as prefab are visible. Adding them to GPUI seems to change the prefab so it is not rendering anymore even when removed from GPUI Prefab manager/tree manager. When I convert the prefab onc again with vegetation engine the tree renders again as expected. Is the mesh or material of the original tree prefab modified when converting to GPUI Prefab?
    Further testing shows that it has to do with material properties that are changed after returning to edit mode after play mode. It not seems to change the material with Prefab Manager but with Tree Manager.

    I found the issue. You have to disable the option Cross Fade / Animate Cross-Fading. It seems not to be compatble with Vegetation Engine.

    Another issue I found is that you have to tick draw trees each time you return to edit mode if you want to see trees in edit mode. This option is ticked off by GPUI each time switching to play mode.

    Kind Regards
     
    Last edited: Jun 11, 2022
  7. paezguerraalvaro

    paezguerraalvaro

    Joined:
    Oct 16, 2017
    Posts:
    9
    Hi, I'm currently delving into GPU Instancing for our app. We currently rely on the SRP batcher extensively, but it seems GPU instancing is still a better option whenever possible. I was considering trying out GPU Instancer, but it seems Oculus Quest is not supported (and we are targeting this device specifically). I haven't found any explanation on why this might be, though. Are those devices missing something this extension needs? Or is it simply a matter of not having enough manpower to support them?
    Thank you!
     
  8. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    281
    Hello @LouskRad
    I have a strange bug in unity 2022.1.4f1 HDRP.
    my gpui prefab suddenly can't be authorized any more, since it is always shown as culled in prefab mode.
    In play mode it is used normally without issue. I just can't make any further edit to it since I can't see it in prefab mode.
    This is them correctly rendered in play mode.
    upload_2022-6-13_12-56-54.png

    This is the LODGroup setting, nothing special going on.

    upload_2022-6-13_13-3-34.png
     
  9. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    281
    Also the Editor and Build shading is different, any insight why this happen ?
    Looks like the build does not use my TVE shaders anymore and fall back to some default shading.

    Editor


    Build
     
  10. GurhanH

    GurhanH

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

    Cross-fading issue would be related to the shader, so you might want to ask about this to TVE developer.
    As for the trees being disabled in edit mode, GPUI Tree Manager sets the Tree Distance to zero in play mode and it is not serialized. So it should be returning to its original value when you return to edit mode. If the "Draw" option is switched, that is probably form another code/plugin and not GPUI.
    In any case, if you are able to reproduce this issue in a sample project, please email it to us and we can investigate.

    Hi there,
    Please read this for information on this subject.

    Hi there,

    I am not sure if I understand the issue or if it is related to GPUI at all. If you are able to reproduce this issue in a sample project, please email it to us and we can investigate.

    There might be some shader variants that are not included in the build. GPUI keeps track of the used materials and creates a ShaderVariantCollection to avoid this issue. But if there are some runtime keyword modifications, they might have been missed. You can try adding the shader in question to the Always Included Shaders list under Graphics settings and see if it solves the issue.
     
  11. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    281
    Thanks for the lead,
    I tried placing GPUI shader variant collection in graphics setting and it still does not help.
    upload_2022-6-13_22-31-49.png

    Now I tried putting the two vegetation shaders into the always include and they generate tons of vp.
    leading to build time from 17 seconds to 37 minutes and counting.
    So this is not a feasible option since it make iteration suffer a lot.
    I'll report to you later if it can fix the issue though.
    However, do I have any other option ?

    upload_2022-6-13_22-32-50.png
     
  12. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    281
    When it reach 1 hour mark I can't do this anymore. So I have to cancel the process, and try change my prefab tree shaders to GPUI ones and the build works. Build time 30 secs.
    But this is not the normal workflow right ? I read the doc and do not see in Prefab Manager section that you should change your prefab's shaders to GPUI ones ? I thought GPUI will switch out the shaders automatically ?

    upload_2022-6-13_23-7-6.png
     
  13. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    It is not required to change to GPUI shaders, but it is a valid workflow and preferred by some. ShaderVariantCollection normally handles including the shader variants in builds. However sometimes Unity bugs (especially lately on tech releases because Unity is optimizing the build process) or some scripts that modify material keywords can cause this. So if switching to GPUI shader solved it, keep it that way, there is no harm in it.
     
  14. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    281
    Yea now that someone is including me. And to tell the truth this is not the first time I see a ShaderVariantCollection does not do it's job, to me it's a useless feature.

    However I'm happy that there is still an option to make it work out, thank you for your support!
     
  15. chingwa

    chingwa

    Joined:
    Dec 4, 2009
    Posts:
    3,790
    That script is a really nice productivity boost, only having to worry about one detail manager! However I would also love to see one detail Manager parse across multiple terrain, similar to the tree manager. Multiple detail managers seem to have a noticeable performance cost when you start dealing with a large number of individual terrains.

    Also I wanted to make you aware of a performance bottleneck when using GPUi and DX12. Unity's DX12 backend is not able to parse dispatches and draws efficiently (unlike DX11), which causes a large performance impact when trying to use GPUi to it's limits in DX12. You can read more info about this in the conversation at the link below, though I'm not sure it's something you're able to address, or if it's all on Unity to fix their DX12 implementation:
    https://forum.unity.com/threads/why-is-dx12-so-much-slower-than-dx11.841903/page-3#post-8202447
     
    GurhanH and marcell123455 like this.
  16. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    281
    @GurhanH for my other problem about "Prefab always culled, can't render without GPUI manager"
    When I register a prefab into GPUI Prefab Manager > enter play mode > then exit play mode > prefabs all become invisible.
    I've sent you an email with that same title, please check it out. I want to do a simple fps test with and without GPUI to show how good GPUI to my friends, but this problem won't let me.
    Thank you for your time.
     
    Last edited: Jun 14, 2022
  17. Oblord

    Oblord

    Joined:
    May 7, 2015
    Posts:
    4
    Whenever I am trying to use TreeManager, I am getting this error. Any insight on why this is happening?

    Unity 2021.3 lts HDRP. Using Naturemanufacturer trees.

    IndexOutOfRangeException: Index was outside the bounds of the array.
    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:416)
    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)
    GPUInstancer.GPUInstancerManager.UpdateBuffers (GPUInstancer.GPUInstancerCameraData renderingCameraData) (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:574)
    GPUInstancer.GPUInstancerManager.LateUpdate () (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:261)
     
  18. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Hi there,
    and thanks for the info, it is very helpful.

    We are aware of the shortcomings of the Detail Manager in big open world setups (e.g. multiple managers, memory cost, etc.). However our tests showed that simpler solutions like we did with the Tree Manager were not able to satisfy the need in this case and it required more fundamental changes. We are still testing possible solutions which do not impose new limitations.

    As for the DX12, in my opinion, it is still early to commit to any design decisions on a large scale, as Unity's implementation is changing too frequently.
    GPUI was first designed in 2017-8 and the core design did not change much afterwards. We mostly added new features to the system and adapted to the new Unity features. However, it is not always easy to adapt to new Unity features, especially when it requires a core change which affects every other system in place.
    That is why we are also working on a complete rewrite of GPUI, moving to a different design, using the latest tech and overcoming some known limitations of the current system. However this is a long process and it is too early in development currently to make any clear statements about it. But I can say that both having a much more optimized Detail Manager for big open worlds with many terrains, and batching/sorting Dispatch and Draw calls depending on what works best on the graphics api are taken into consideration in its design.
     
    chingwa and pierre92nicot like this.
  19. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Thank you for sending the sample. I will also write the cause of the problem and the solution here for others.

    As @SkandYxyz also found out the issue is caused by the LOD cross-fading. GPUI enables the "LOD_FADE_CROSSFADE" keyword on the material to enable the LOD cross-fading. However it is causing issues when the same material is used in edit mode with TVE shaders. You can disable the Use Original Material When Instanced option under Edit->Preferences->GPU Instancer, so that GPUI creates a copy of the material instead of using the original one.
    This should solve the issue, however we will also look for alternatives, to see if we can avoid a material copy in the future.
     
  20. GurhanH

    GurhanH

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

    I was able to recreate the issue. It looks like the error is produced when there is an LOD Group with 7 or more levels. We will provide a fix on the next update (or contact support with your invoice to get it earlier).
    However, I would also recommend not to use that many LODs if it is not necessary, because it will multiply the draw calls. Using fewer LODs were there is significant difference in vertex counts are usually more efficient.
     
  21. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    232
    upload_2022-6-17_12-11-9.png

    Hi,
    I've just purchased GPU Instancer and have had some troubles getting started. Im seeing a flood of errors and warnings in both my own scene and the demo scenes. Im using Unity 2022.1.4f1. Do you have any advice? Thanks!!

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. GPUInstancer.GPUInstancerHiZOcclusionGenerator.GetScreenSize () (at Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:223)
    3. GPUInstancer.GPUInstancerHiZOcclusionGenerator.CreateHiZDepthTexture () (at Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:230)
    4. GPUInstancer.GPUInstancerHiZOcclusionGenerator.OnEndCameraRendering (UnityEngine.Camera camera) (at Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:130)
    5. GPUInstancer.GPUInstancerHiZOcclusionGenerator.OnEndCameraRenderingSRP (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) (at Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:119)
    6. UnityEngine.Rendering.RenderPipelineManager.EndCameraRendering (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) (at <d8d38b92d94a4ff8a91e61d39c6d19cd>:0)
    7. UnityEngine.Rendering.RenderPipeline.EndCameraRendering (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera camera) (at <d8d38b92d94a4ff8a91e61d39c6d19cd>:0)
    8. UnityEngine.Rendering.Universal.UniversalRenderPipeline.RenderCameraStack (UnityEngine.Rendering.ScriptableRenderContext context, UnityEngine.Camera baseCamera) (at Library/PackageCache/com.unity.render-pipelines.universal@13.1.8/Runtime/UniversalRenderPipeline.cs:592)
    9. UnityEngine.Rendering.Universal.UniversalRenderPipeline.Render (UnityEngine.Rendering.ScriptableRenderContext renderContext, System.Collections.Generic.List`1[T] cameras) (at Library/PackageCache/com.unity.render-pipelines.universal@13.1.8/Runtime/UniversalRenderPipeline.cs:279)
    10. UnityEngine.Rendering.RenderPipeline.InternalRender (UnityEngine.Rendering.ScriptableRenderContext context, System.Collections.Generic.List`1[T] cameras) (at <d8d38b92d94a4ff8a91e61d39c6d19cd>:0)
    11. 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 <d8d38b92d94a4ff8a91e61d39c6d19cd>:0)
    12. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    13.  
    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:520)
    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:574)
    6. GPUInstancer.GPUInstancerManager.LateUpdate () (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:261)
    7.  
    Code (CSharp):
    1. XRSystem.ReleaseFrame() was not called!
    2. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    3.  
     
  22. GurhanH

    GurhanH

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

    From the error messages it looks like GPUI is set up for URP, however it can not find the render pipeline asset.

    If you are using URP, please make sure that render pipeline assets are assigned under Edit->Project Settings->Graphics and Edit->Project Settings->Quality settings.

    If you are not using URP, please remove the URP package from the Package Manager and then remove and reinstall GPU Instancer, so it will be set up for built-in render pipeline when installed.

    GPUI currently determines which render pipeline to use during initial setup depending on the packages in the project. We are looking into alternative solutions for the future, so that it is easier to switch between render pipelines.
     
  23. backwheelbates

    backwheelbates

    Joined:
    Jan 14, 2014
    Posts:
    232
    Ah ok great, thank you!
     
  24. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    281
    hi @GurhanH , After testing setting LODGroup.crossFadeAnimationDuration=0.15f; I think it have no effect. Can you expose an Api to change crossFadeAnimationDuration, since you do not use Unity's duration ?

    Still have problem with LOD cross fade.
    These picture taken while I'm using LOD cross fade no animation (by distance)
    GPUI LOD cross fade (mesh have dots) upload_2022-6-19_0-31-16.png

    Turn off GPUI (Unity LOD cross fade : no dots)
    upload_2022-6-19_0-31-51.png

    This shows GPUI LOD cross fade (calculate by distance) is different from Unity's.
    Pls help with this man.
     

    Attached Files:

    Last edited: Jun 18, 2022
  25. Mr-me-alexey

    Mr-me-alexey

    Joined:
    May 23, 2016
    Posts:
    1
    Hey! Bought GPU Instancer.. Using with HDRP. On Play getting black screen and those errors:

    NullReferenceException: Object reference not set to an instance of an object
    GPUInstancer.GPUInstancerHiZOcclusionGenerator.GetScreenSize () (at Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:223)
    GPUInstancer.GPUInstancerHiZOcclusionGenerator.CreateHiZDepthTexture () (at Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:230)
    GPUInstancer.GPUInstancerHiZOcclusionGenerator.Initialize (UnityEngine.Camera occlusionCamera) (at Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:107)
    GPUInstancer.GPUInstancerManager.SetupOcclusionCulling (GPUInstancer.GPUInstancerCameraData renderingCameraData) (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:526)
    GPUInstancer.GPUInstancerManager.Start () (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:184)

    Saw post above about wrong detection of render pipeline, but it didn`t help. Project is very large with content ( 25 gb ) to send as a sample to know whats wrong. What could be wrong?

    Edit: It recognized hdrp finally, but all the trees are culling randomly and dithering, so scene appears to be empty. Min-max cull distances are not changing much. Would be thankful for help.
     
    Last edited: Jun 19, 2022
  26. madkevop7

    madkevop7

    Joined:
    Nov 11, 2021
    Posts:
    23
    Hi I have a problem it keeps giving these errors even in edit more:
    ArgumentNullException: Value cannot be null.
    Parameter name: shader
    UnityEngine.Material..ctor (UnityEngine.Shader shader) (at <3be1a7ff939c43f181c0a10b5a0189ac>:0)
    GPUInstancer.GPUInstancerUtility.GetBillboardMaterial (GPUInstancer.GPUInstancerPrototype prototype) (at Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:2231)
    GPUInstancer.GPUInstancerUtility.GenerateInstancedShadersForGameObject (GPUInstancer.GPUInstancerPrototype prototype) (at Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:2651)
    GPUInstancer.GPUInstancerManager.CheckPrototypeChanges () (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:351)
    GPUInstancer.GPUInstancerPrefabManager.CheckPrototypeChanges () (at Assets/GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:124)
    GPUInstancer.GPUInstancerManager.LateUpdate () (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:254)
    GPUInstancer.GPUInstancerPrefabManager.LateUpdate () (at Assets/GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:81)

    I'm trying to instance a very dense forest with Trees, but since these trees are interactable they are placed as GameObject (prefab) and I'm using the Prefab Manager. So far it doesn't seem to be woking (no change on frame rate). Please help

    If it helps these trees are using Nature Shader's tree bark shaders. And currently for terrain I have Nature Render for optimizing the rest

    Edit:
    After disabling generate billboard, the editor error is gone but throws the following errors when playing still:

    ArgumentNullException: Value cannot be null.
    Parameter name: shader
    UnityEngine.Material..ctor (UnityEngine.Shader shader) (at <3be1a7ff939c43f181c0a10b5a0189ac>:0)
    GPUInstancer.GPUInstancerShaderBindings.GetInstancedMaterial (UnityEngine.Material originalMaterial, System.String extensionCode) (at Assets/GPUInstancer/Scripts/Core/DataModel/GPUInstancerShaderBindings.cs:131)
    GPUInstancer.GPUInstancerRuntimeData.CreateRenderersFromMeshRenderers (System.Int32 lod, GPUInstancer.GPUInstancerPrototype prototype) (at Assets/GPUInstancer/Scripts/Core/DataModel/GPUInstancerRuntimeData.cs:385)
    GPUInstancer.GPUInstancerRuntimeData.CreateRenderersFromGameObject (GPUInstancer.GPUInstancerPrototype prototype) (at Assets/GPUInstancer/Scripts/Core/DataModel/GPUInstancerRuntimeData.cs:260)
    GPUInstancer.GPUInstancerPrefabManager.InitializeRuntimeDataForPrefabPrototype (GPUInstancer.GPUInstancerPrefabPrototype p, System.Int32 additionalBufferSize) (at Assets/GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:238)
    GPUInstancer.GPUInstancerPrefabManager.InitializeRuntimeDataRegisteredPrefabs (System.Int32 additionalBufferSize) (at Assets/GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:225)
    GPUInstancer.GPUInstancerPrefabManager.InitializeRuntimeDataAndBuffers (System.Boolean forceNew) (at Assets/GPUInstancer/Scripts/GPUInstancerPrefabManager.cs:183)
    GPUInstancer.GPUInstancerManager.OnEnable () (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:219)
     

    Attached Files:

    Last edited: Jun 19, 2022
  27. Rodakai

    Rodakai

    Joined:
    Apr 3, 2014
    Posts:
    9
    Hi,

    I'm having issues with SpeedTree8 trees. I'm using Unity 2021.3.3f1 with the latest version of URP. It seems like the alpha for leaves isn't working. Having similar issues like this on all of my SpeedTree8 trees.

    upload_2022-6-19_20-12-56.png
     
  28. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    We do not want to add too many parameters to the compute shaders, it is detrimental to its performance. If you wish, you can change the duration by editing line 62 in GPUInstancer\Resources\Compute\Include\Camera.compute.

    As for the "dots", it might be caused by the "Culled" level of the LOD Group component. Instances also fade to culled instead of disappearing immediately. You can set the Culled level to 0 and/or have a lower "LOD Fade Transition Width" to avoid this.

    If there is another issue, please email us a bug report with a sample project., so we can investigate.

    Hi there,

    Looks like various GPUI shaders can not be found. Some files may be deleted or related files might be moved to different folders. So shaders are either not present or they have errors and not imported. You can first try reimporting the shader packages by selecting Tools -> GPU Instancer -> Reimport Packages. If it does not help, please try deleting and reinstalling GPU Instancer.

    Hi there,
    After some investigation, I found out that in the new SpeedTree8 shader, they defined the _ALPHATEST_ON keyword manually, and it is dependent on the order of the included files. So it is messing up with the auto. shader conversion. We might need to make an exception for this shader in the future. For now you can use the shader attached to this post where I reordered the includes. Simply switch the materials to use GPUInstancer/Universal Render Pipeline/Nature/SpeedTree8 Fixed shader after adding the shader to your project.
     

    Attached Files:

  29. nehvaleem

    nehvaleem

    Joined:
    Dec 13, 2012
    Posts:
    438
    Hi, I couldn't find this in the documentation or this thread so I thought I'll give good ol' asking a try.

    Does GPU Instancer handle motion vectors in HDRP? I am searching for the solution for the performant rendering of vegetation with the support for TAA and it requires motion vectors. If so - does it require some additional setup or something?
     
  30. madkevop7

    madkevop7

    Joined:
    Nov 11, 2021
    Posts:
    23
    Hi I have tried your solution and it did remove the error, but my fps now gets stuck at 1. Did I do something wrong? I'm trying to use instancing and occlusion culling for the 10000~ Unity Tree placed as GameObjects, but it seems like disabling the MeshRenderer is still rendering these Tree objects. The Tree is Unity Tree using Nature Renderer's Tree bark shader.
     

    Attached Files:

    Last edited: Jun 20, 2022
  31. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    281
    holy S*** 1fps. This is legendary.
     
  32. Spikebor

    Spikebor

    Joined:
    May 30, 2019
    Posts:
    281
    Thank you for your detailed answer!
     
  33. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Hi there,
    No unfortunately, HDRP motion vectors are not supported.

    Hi there,
    Yes it looks like the trees are still rendered by the MeshRenderer. Number of batches in the stats window should be very low when most of the objects are rendered with GPUI.
    My guess is, it is caused by another plugin you have, possibly one that is involved in culling or streaming. For example, after GPUI disables the renderers, another plugin might be re-enabling them. I suggest running tests by systematically disabling plugins or their features to find the culprit.
     
  34. madkevop7

    madkevop7

    Joined:
    Nov 11, 2021
    Posts:
    23
    Hi so I coded an object pooling system that allocates and extends the pool objects at runtime with Instantiate. Is there a way to have GPU Instancer instance these runtime instantiated objects? Since prefabutility doesn't exist in build my only option is to instantiate, would that work?
     
  35. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Hi there,
    You do not need to use the prefabutility at runtime, you can use the instantiate method. But you need to either enable the Auto. Add/Remove Instances option, or use the AddPrefabInstance API, to add instances at runtime.
     
  36. madkevop7

    madkevop7

    Joined:
    Nov 11, 2021
    Posts:
    23
    I don't know if I'm doing something wrong but my fps seems to be not improving at all with instancer, even though I can see in the inspector the thousands of instances have been reduced to just 2-5 draw calls. Could there be an overhead somewhere such as the culling duplicating with Unity's default automatic culling, or maybe a material is doing instancing on its own?
     
  37. madkevop7

    madkevop7

    Joined:
    Nov 11, 2021
    Posts:
    23
    So now suddently everything doesn't appear once I start playing, but show in the Game window when not playing. I also got errors, can you please look if my setup is wrong? My tree prefabs gameobjects are Vegetation Engines, and I've already in TVE directed to use GPUInstancer.
     

    Attached Files:

  38. madkevop7

    madkevop7

    Joined:
    Nov 11, 2021
    Posts:
    23
    I completely removed all the LOD on my tree gameobjects and wish to replace them with billboards. However the billboard doesn't seem to be working as trees just get culled, and the verts and tri count is higher than before for some reason, even though in both game and scene view only a few trees are being rendered. Completely disabling these objects will improve the count but why is Unity still counting the verts and tris even though they are not being rendered.

    EDIT:
    I checked and every object says "Instancing has not been initialized"
     

    Attached Files:

    Last edited: Jul 1, 2022
  39. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Seems like there are some setup issues and possible incompatibility with some additional tools you are using. If you can email us an example project with detailed description of how to reproduce the issues, we can investigate it.
     
  40. MaddGameStudio

    MaddGameStudio

    Joined:
    Sep 3, 2021
    Posts:
    13
    I have an issue when using Tree Manager, I have a script that allows me to chop the terrain trees, when ever I cut a tree it still remains and I have to manually disable then enable Tree Manager to get the tree to go away. How could I fix this?
     
  41. madkevop7

    madkevop7

    Joined:
    Nov 11, 2021
    Posts:
    23
    I'll try to figure out how to reproduce it first. Speaking of the billboard generation, how do I know if its working? Should I be able to visually see it from the Scene tab in Editor?
     
  42. shuskry

    shuskry

    Joined:
    Oct 10, 2015
    Posts:
    462
    Hello @GurhanH :D

    I am starting to use your asset ( semms to be incredible). But I would like to know something.

    I've already read the Wiki and I don't believe I've seen the answer. ( English not my main lmanguage sorry)

    If I have 10 prefabs ( 10 different mesh) with sharing the exact same material/texture/no variation ( Only different UVs).
    Is it normal to have 10 draw calls more?

    Have a nice day ! :)
     
    Last edited: Jul 1, 2022
  43. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Hi there,
    You can use the GPUI Instance Remover or the RemoveInstancesInsideBounds/RemoveInstancesInsideCollider API methods. Then you don't need to re-initialize the Tree Manager. However you should also keep the script that removes the trees from the terrain to update the colliders and also to make sure the trees does not re-appear when the Tree Manager is re-initialized for some reason.

    Yes, you should be able to see the LODs based on the game camera in scene view while the application is playing.
    upload_2022-7-2_13-6-30.png

    However if you pause, it will switch to scene camera.
    upload_2022-7-2_13-7-23.png

    Hi there,
    GPU instancing is based on mesh/material combinations, so different meshes mean different draw calls. If you have 10 different meshes, you will have 10 draw calls. You can get more info about different batching methods from our Terminology page.
    However if the meshes are the same and only their UVs are different, you can instead have one mesh and use material variations to edit the UVs inside a custom shader.
     
    shuskry likes this.
  44. MaddGameStudio

    MaddGameStudio

    Joined:
    Sep 3, 2021
    Posts:
    13
    Awesome adding RemoveInstancesInsideBounds worked great, greatly reduced the lag or disabling and enable the manager. Thank you so much.
     
  45. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,448
    btw. the store link in first post is broken
     
  46. darkriver41

    darkriver41

    Joined:
    May 5, 2019
    Posts:
    7
    Hello there,
    I am thinking of buying this asset and intend to mainly use it for grass and trees. I have a question though, i get it that we can disable the instancing within a collider bounds or by unregistering a prefab instance from the gpu instancer manager (That would remove all tree instances corresponding to that prefab reference am i right ?). But what if i want to remove only one tree instance after chopping it down ? Disabling the instancing with a collider may work but it can happen that 2 or more trees can be within its bounds, in that case all the trees within those bounds will disappear right ?
    Is there something i'm missing here or is it just not possible at all to achieve what i want with GPUI ?
    Another question maybe, how do we use the detail manager on multiple tiles terrain as in the wiki there is only the prefab manager that can take multiple terrains as reference. Should i use impostors and load each detail manager with the loading of the actual terrain or multiple detail managers can work together as when loading terrains i find myself with multiple tiles loaded at the same time so potentially that would mean multiple detail managers loaded at the same time as well ?
    PS: I really want to use this asset as it works with nature shaders from visual design cafe for grass interactions even if the grass is gpu instanced :D
    Thank you :)
     
    Last edited: Jul 3, 2022
  47. madkevop7

    madkevop7

    Joined:
    Nov 11, 2021
    Posts:
    23
    So I'm making a building placement system and there will be a lot of parts that players can place around the map. It would be inconvenient to manually add each prefab into the GPUInstancer Prefab manager, is there a function I can call to add the list of prefabs into GPUInstancer and register it?
     
  48. VRSkeleton

    VRSkeleton

    Joined:
    Nov 12, 2020
    Posts:
    1
    Hi, I am having an issue with a multiple-camera setup. When Display Camera Frustrum Cullings is enabled trees are not visible.

    Setup:
    VR: Single Pass Instanced
    VR is duplicated from Display as best practices say. Use Camera is assigned on Awake.
    upload_2022-7-4_11-56-39.png upload_2022-7-4_11-56-44.png
     
  49. GurhanH

    GurhanH

    Joined:
    Apr 24, 2017
    Posts:
    539
    Thanks for the heads up.

    Hi there,
    RemoveInstancesInsideBounds/Collider does not work by intersection, it checks the pivot points of instances to see if they are inside the bounds. So it can be precise, unless you have multiple instances at exactly the same position.
    Detail Manager works with a single terrain, and you can have multiple managers. So you can have a Detail Manager under each terrain and they will load/unload with the terrain.

    There is AddPrefabInstances method in the Prefab Manager that you can use with a list. Such as:
    myPrefabManager.AddPrefabInstances(myGPUInstancerPrefabList);

    Hi there,
    Can you please email us a bug report with an example project following this guide, so we can investigate?
     
  50. darkriver41

    darkriver41

    Joined:
    May 5, 2019
    Posts:
    7
    Hello @GurhanH thanks for your answer, in that case i'll buy it and experiment with it and maybe come back with other questions :p
    One last thing before i dive into this, Idk if you have any docs or tutorials on using GPUI in open world games where terrain streaming is commonly used, that would be great if you have any ?
    Thank you