Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. 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. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    151
    Hi thanks for the response, but using Impostor only as a billboard doesnt work either. Its just not rendered at all.

    upload_2021-3-9_18-6-1.png

    upload_2021-3-9_18-6-6.png

    upload_2021-3-9_18-6-11.png
     
  2. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    151
    Btw in editor in latest hdrp the grass....is not rendered in editor mode :p

    upload_2021-3-9_18-38-54.png

    Strange, ingame it looks ok

    upload_2021-3-9_18-40-33.png

    Btw to this and above issue, just want to reitrate i am on HDRP 10.3.2 and Unity 2020.2 so i am aware there may be bugs :)
     
    Last edited: Mar 9, 2021
  3. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    878
    If you can email us a sample project showing this, we can investigate the issue.

    As for HDRP grass, Unity still doesn't have an HDRP grass shader, so it's normal and not GPUI related. You can, however, use GPUI to simulate your details in the editor by using "Simulate at Scene Camera" from the detail manager.
     
  4. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    151
    Thanks for response.

    Will try to cook an example project later after work, sadly the test project is 25 gigs so... :).
     
  5. Rastapastor

    Rastapastor

    Joined:
    Jan 12, 2013
    Posts:
    151
    I give up with Unity xD

    I started to prepare the test scene for You and guess what. It works, both cases. LOD 1 impostor + Custom billboard and only as a custom billboard. This is magic.

    Update
    Turned out I was not supposed to install Shader option GPUI for The Vegetation Engine. So thats the tip for ppl using GPUI + TVE :).

    Install only HDRP package for GPUI, HDRP support for Amplify Impostors, HDRP support for TVE and HDRP support for TVE Amplify Impostors. Dont touch the SHader hub in TVE.

    DO NOT TOUCH THIS

    upload_2021-3-10_16-7-9.png
     
    Last edited: Mar 10, 2021
    LouskRad and ftejada like this.
  6. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,804
    @LouskRad I don't believe the 1.4.4 update fixed my Graphics Copy error mate.
    I just finally got around to actually trying it. Going to AppData and deleting the entire folder for GPUI.

    Delete GPUI from project as well as MM integrations.
    Go to package manager and press refresh, re-download GPUI, import said files.
    Then go to MM2 Integration and import that and Shadergraph package. (for HDRP).

    Click on Tools > GPU Instancer > Integration > Add MM2 integration.
    Import only trees, not grass as I'm handling that elsewhere.

    Pres play and get this.. (unless this is a new error).


    Code (CSharp):
    1. Graphics.CopyTexture called for entire mipmaps with different memory size (source (Depth) is 1060332 bytes and destination (R32 SFloat) is 2120664 bytes)
    2. 0x00007ff78cc644ec (Unity) StackWalker::GetCurrentCallstack
    3. 0x00007ff78cc6c8c9 (Unity) StackWalker::ShowCallstack
    4. 0x00007ff78e13c75c (Unity) GetStacktrace
    5. 0x00007ff78f2258b3 (Unity) DebugStringToFile
    6. 0x00007ff78bfd8bd1 (Unity) CheckCopyTextureMipMemorySize
    7. 0x00007ff78bfd9c34 (Unity) CopyTexture
    8. 0x00007ff78cdb5394 (Unity) Graphics_CUSTOM_CopyTexture_Slice
    9. 0x0000025b4540084e (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Graphics:CopyTexture_Slice (UnityEngine.Texture,int,int,UnityEngine.Texture,int,int)
    10. 0x0000025b4540078b (Mono JIT Code) UnityEngine.Graphics:CopyTexture (UnityEngine.Texture,int,int,UnityEngine.Texture,int,int)
    11. 0x0000025b4a32248b (Mono JIT Code) [GPUInstancerHiZOcclusionGenerator.cs:262] GPUInstancer.GPUInstancerHiZOcclusionGenerator:UpdateTextureWithComputeShader (int)
    12. 0x0000025b4a20796b (Mono JIT Code) [GPUInstancerHiZOcclusionGenerator.cs:252] GPUInstancer.GPUInstancerHiZOcclusionGenerator:OnEndCameraRendering (UnityEngine.Camera)
    13. 0x0000025b4a2075f3 (Mono JIT Code) [GPUInstancerHiZOcclusionGenerator.cs:197] GPUInstancer.GPUInstancerHiZOcclusionGenerator:OnEndCameraRenderingSRP (UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Camera)
    14. 0x0000025b4a2075ad (Mono JIT Code) UnityEngine.Rendering.RenderPipelineManager:EndCameraRendering (UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Camera)
    15. 0x0000025b4a207523 (Mono JIT Code) UnityEngine.Rendering.RenderPipeline:EndCameraRendering (UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Camera)
    16. 0x0000025b454659cb (Mono JIT Code) [HDRenderPipeline.cs:2249] UnityEngine.Rendering.HighDefinition.HDRenderPipeline:Render (UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Camera[])
    17. 0x0000025b45459af9 (Mono JIT Code) UnityEngine.Rendering.RenderPipeline:InternalRender (UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Camera[])
    18. 0x0000025b453ec2cb (Mono JIT Code) UnityEngine.Rendering.RenderPipelineManager:DoRenderLoop_Internal (UnityEngine.Rendering.RenderPipelineAsset,intptr,System.Collections.Generic.List`1<UnityEngine.Camera/RenderRequest>,Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle)
    19. 0x0000025b453ec490 (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_object_intptr_object_AtomicSafetyHandle (object,intptr,intptr,intptr)
    20. 0x00007ffc7381e480 (mono-2.0-bdwgc) [mini-runtime.c:2812] mono_jit_runtime_invoke
    21. 0x00007ffc737a2902 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke
    22. 0x00007ffc737ab95f (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke
    23. 0x00007ff78cae0d64 (Unity) scripting_method_invoke
    24. 0x00007ff78cad96e5 (Unity) ScriptingInvocation::Invoke
    25. 0x00007ff78c261759 (Unity) ScriptableRenderContext::ExtractAndExecuteRenderPipeline
    26. 0x00007ff78bd7901f (Unity) RenderManager::RenderCamerasWithScriptableRenderLoop
    27. 0x00007ff78bd787d6 (Unity) RenderManager::RenderCameras
    28. 0x00007ff78d5f9722 (Unity) RepaintController::RenderPlayModeViewCameras
    29. 0x00007ff78df89fce (Unity) EditorGUIUtility::RenderPlayModeViewCamerasInternal
    30. 0x00007ff78e84f9e9 (Unity) EditorGUIUtility_CUSTOM_RenderPlayModeViewCamerasInternal_Injected
    31. 0x0000025b453eacb7 (Mono JIT Code) (wrapper managed-to-native) UnityEditor.EditorGUIUtility:RenderPlayModeViewCamerasInternal_Injected (UnityEngine.RenderTexture,int,UnityEngine.Vector2&,bool,bool)
    32. 0x0000025b453eabf3 (Mono JIT Code) UnityEditor.EditorGUIUtility:RenderPlayModeViewCamerasInternal (UnityEngine.RenderTexture,int,UnityEngine.Vector2,bool,bool)
    33. 0x0000025b453e9933 (Mono JIT Code) UnityEditor.PlayModeView:RenderView (UnityEngine.Vector2,bool)
    34. 0x0000025b4430190b (Mono JIT Code) UnityEditor.GameView:OnGUI ()
    35. 0x0000025b442ef523 (Mono JIT Code) UnityEditor.HostView:InvokeOnGUI (UnityEngine.Rect,UnityEngine.Rect)
    36. 0x0000025b442ef2f3 (Mono JIT Code) UnityEditor.DockArea:DrawView (UnityEngine.Rect,UnityEngine.Rect)
    37. 0x0000025b442f4633 (Mono JIT Code) UnityEditor.DockArea:OldOnGUI ()
    38. 0x0000025b442d8a20 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:DoOnGUI (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,bool,UnityEngine.Rect,System.Action,bool)
    39. 0x0000025b442d7ceb (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:HandleIMGUIEvent (UnityEngine.Event,UnityEngine.Matrix4x4,UnityEngine.Rect,System.Action,bool)
    40. 0x0000025b44439f73 (Mono JIT Code) UnityEngine.UIElements.IMGUIContainer:DoIMGUIRepaint ()
    41. 0x0000025b4443753b (Mono JIT Code) UnityEngine.UIElements.UIR.RenderChainCommand:ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams,single,System.Exception&)
    42. 0x0000025b44435a6b (Mono JIT Code) UnityEngine.UIElements.UIR.UIRenderDevice:EvaluateChain (UnityEngine.UIElements.UIR.RenderChainCommand,UnityEngine.Material,UnityEngine.Material,UnityEngine.Texture,UnityEngine.Texture,UnityEngine.Texture,single,Unity.Collections.NativeSlice`1<UnityEngine.UIElements.UIR.Transform3x4>,Unity.Collections.NativeSlice`1<UnityEngine.Vector4>,UnityEngine.MaterialPropertyBlock,bool,System.Exception&)
    43. 0x0000025b44432913 (Mono JIT Code) UnityEngine.UIElements.UIR.RenderChain:Render ()
    44. 0x0000025b443e0de3 (Mono JIT Code) UnityEngine.UIElements.UIRRepaintUpdater:Update ()
    45. 0x0000025b442b8f7e (Mono JIT Code) UnityEngine.UIElements.VisualTreeUpdater:UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase)
    46. 0x0000025b443e05bb (Mono JIT Code) UnityEngine.UIElements.Panel:UpdateForRepaint ()
    47. 0x0000025b443e0223 (Mono JIT Code) UnityEngine.UIElements.Panel:Repaint (UnityEngine.Event)
    48. 0x0000025b442b8847 (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel)
    49. 0x0000025b442b859b (Mono JIT Code) UnityEngine.UIElements.UIElementsUtility:UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (int,intptr,bool&)
    50. 0x0000025b442b839f (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration:processEvent (int,intptr)
    51. 0x0000025b442b82db (Mono JIT Code) UnityEngine.UIElements.UIEventRegistration/<>c:<.cctor>b__1_2 (int,intptr)
    52. 0x0000025b442b813d (Mono JIT Code) UnityEngine.GUIUtility:processEvent (int,intptr,bool&)
    53. 0x0000025b442b81ee (Mono JIT Code) (wrapper runtime-invoke) <Module>:runtime_invoke_void_int_intptr_intptr& (object,intptr,intptr,intptr)
    54. 0x00007ffc7381e480 (mono-2.0-bdwgc) [mini-runtime.c:2812] mono_jit_runtime_invoke
    55. 0x00007ffc737a2902 (mono-2.0-bdwgc) [object.c:2921] do_runtime_invoke
    56. 0x00007ffc737ab95f (mono-2.0-bdwgc) [object.c:2968] mono_runtime_invoke
    57. 0x00007ff78cae0d64 (Unity) scripting_method_invoke
    58. 0x00007ff78cad96e5 (Unity) ScriptingInvocation::Invoke
    59. 0x00007ff78cad25e5 (Unity) ScriptingInvocation::Invoke<void>
    60. 0x00007ff78b1a1b0d (Unity) Scripting::UnityEngine::GUIUtilityProxy::processEvent
    61. 0x00007ff78d6faf46 (Unity) GUIView::processRetainedMode
    62. 0x00007ff78e17e4de (Unity) GUIView::OnInputEvent
    63. 0x00007ff78d6fae38 (Unity) GUIView::processInputEvent
    64. 0x00007ff78e1752c2 (Unity) GUIView::DoPaint
    65. 0x00007ff78e1814fd (Unity) GUIView::RepaintAll
    66. 0x00007ff78d7e1231 (Unity) PlayerLoopController::UpdateScene
    67. 0x00007ff78d7decd6 (Unity) Application::TickTimer
    68. 0x00007ff78e145f51 (Unity) MainMessageLoop
    69. 0x00007ff78e14a001 (Unity) WinMain
    70. 0x00007ff78ffb9576 (Unity) __scrt_common_main_seh
    71. 0x00007ffcf70f7034 (KERNEL32) BaseThreadInitThunk
    72. 0x00007ffcf7982651 (ntdll) RtlUserThreadStart
     
  7. Mojo-Game-Studio

    Mojo-Game-Studio

    Joined:
    Sep 18, 2015
    Posts:
    103
    Hiya,any idea why I get this error when playing the app in the editor, also no instanced prefabs display

    NullReferenceException: Object reference not set to an instance of an object
    GPUInstancer.GPUInstancerUtility.DispatchCSInstancedVisibilityCalculation[T] (UnityEngine.ComputeShader visibilityComputeShader, System.Int32 instanceVisibilityComputeKernelId, T runtimeData, System.Boolean isShadow, System.Int32 lodShift, System.Int32 lodAppendIndex) (at Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:559)
    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:360)
    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:319)
    GPUInstancer.GPUInstancerManager.UpdateBuffers (GPUInstancer.GPUInstancerCameraData renderingCameraData) (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:556)
    GPUInstancer.GPUInstancerManager.LateUpdate () (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerManager.cs:265)
     
  8. LouskRad

    LouskRad

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

    if you are sure that you could update to 1.4.4 (which you can verify by checking the version on the manager), than this indeed should not happen. If you can send us a sample project showing this, we can look into it and help further.

    Hi there,

    This error message does not tell a lot unfortunately. I would need more information on how you are using GPUI when you get this error. You can send us a sample project using this guide and we can look into it.
     
  9. nitoh

    nitoh

    Joined:
    Mar 20, 2014
    Posts:
    29
    Hi,

    Is there a chance to get a callback or get status from an Instancer Prefab (or instanced prefab) if it is culled or not?

    My goal is to implement an object pooling solution with the help of the GPUI occlusion culling solution. I instance high number of low detail prefabs with gui, and want to object pool high detailed models on top if the not culled gpui prefabs.

    Thank you very much.
     
    StellarVeil likes this.
  10. Streamfall

    Streamfall

    Joined:
    Aug 8, 2011
    Posts:
    39
    Hi! Great product. I made a change to the code in order to get GPUI working with MM2's Biomes.
    GPUInstancerMapMagic2Integration.cs has :
    Code (CSharp):
    1. if (generator is IBiome)
    2.                 {
    3.                     IBiome biome = (IBiome)generator;
    4.                     FillListsWithGeneratorsAsset(biome.SubGraph);
    5.                 }
    I have made the addition :
    Code (CSharp):
    1.   if (generator is BiomesSet200)
    2.                 {
    3.                     BiomesSet200 b = (BiomesSet200) generator;
    4.                     foreach (var biomeLayer in b.layers)
    5.                     {
    6.                         IBiome biome = (IBiome)biomeLayer;
    7.                         FillListsWithGeneratorsAsset(biome.SubGraph);
    8.                     }
    9.                 }
    10.                
    11.                 // biome
    12.                 else if (generator is IBiome)
    13.                 {
    14.                     IBiome biome = (IBiome)generator;
    15.                     FillListsWithGeneratorsAsset(biome.SubGraph);
    16.                 }
     
  11. RatBytes

    RatBytes

    Joined:
    Nov 10, 2018
    Posts:
    43
    Hi @LouskRad

    I have a Dungeon in the scene whose prefabs are registered in the GPUI Prefab Manager.
    At runtime I clone the dugeon, so that I can run multiple instance of the dungeon.
    But in the cloned Dungeon the prefabs are not rendered ( are invisble)

    I followed the wiki article.
    "Please keep in mind that the Add/Remove Instances At Runtime option should be enabled in the prototype definition for this API methods to work. Also, Extra Buffer Size should have a high enough number to add all the prefab instances generated at runtime."

    But the new instanced prefabs are not rendered.
    Could you help on that ?
     
    Last edited: Mar 20, 2021
  12. LouskRad

    LouskRad

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

    Since the culling operations are executed in the GPU, it would require a readback to determine if specific instances are culled. This would cause a major slowdown, so it is not provided as an API method.

    If all you need is to show close-by prefabs in high detail, I would suggest using an LOD Group for them.

    Hi,
    and thanks.

    However, we will fix an issue related to the MM2 in the next update - which is based on this forum post. In our tests, it has fixed all the issues related to the new biome changes in MM2. However, if the package in that post does not work for you, please send us the graph that you are using this with so we can identify the issue.

    Hi there, it is indeed the correct wiki article on this subject. The issue you are having might be related to the way that you are cloning this dungeon. If you send us a simple sample project showing this issue, we can help you identify the problem.
     
    StellarVeil likes this.
  13. CyberneticWalrus

    CyberneticWalrus

    Joined:
    Jun 19, 2019
    Posts:
    2
    Hi,

    When building for ps4 I get a number of shader errors, all in the same style:

    Shader error in 'CSRuntimeModification': Program 'CSRemoveInsideBounds', 'NUM_THREADS' attribute is expected for the entry point at kernel CSRemoveInsideBounds at CSRuntimeModification.compute(30) (on ps4)
    (same error happens for number of different shaders and programs)
    Is there any setting I forgot about? I am on Unity 2020.2.3, hdrp 10

    And a small secondary question, I just noticed the DeterminePlatform function and it does not contain a case for PS5. Will this cause an issue if I would try top build for PS5 later?

    Thanks
    Pieter
     
  14. wechat_os_Qy0989W4msb7Ot5jx6_iGbPvk

    wechat_os_Qy0989W4msb7Ot5jx6_iGbPvk

    Joined:
    Nov 3, 2020
    Posts:
    6
    I used GPUI and Gaia pro in my project.There is a big problem in my project.I add GPUI Tree Manager in every scene,but when loading the next scene,the trees float off the ground.If anyone could solve my problem,reply me please.Tanks!
     
  15. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,167
    What scripts do you have added to the trees?
     
  16. LouskRad

    LouskRad

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

    This might be because of a change in Unity's PS4 build pipeline.
    If so, it is possible that the keyword "NUM_THREADS" is being internally used somewhere in the pipeline.

    We will investigate the issue. However, for now, you might try mass replacing all the "NUM_THREADS" keywords in all the files under /GPUInstancer to "GPUI_THREADS" and see if it helps the build issue.

    As for the PS5 case, GPUI will default to the general settings and it should build fine as PS5 does not need special treatment as far as we know now.

    It sounds like a floating origin issue. If you need to define a floating origin, you can enable the Use Floating Origin option in the manager.

    If that does not help, please send us a support request using the guidelines here.
     
  17. wechat_os_Qy0989W4msb7Ot5jx6_iGbPvk

    wechat_os_Qy0989W4msb7Ot5jx6_iGbPvk

    Joined:
    Nov 3, 2020
    Posts:
    6
    I did not add script to it.The prefab only has LOD, Capsule Collider and Transform.
     
    julianr likes this.
  18. CyberneticWalrus

    CyberneticWalrus

    Joined:
    Jun 19, 2019
    Posts:
    2
    Replacing the kewords seems to have done the trick!
    Thanks!
     
    LouskRad likes this.
  19. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,167
    difficult to say what it could be, might be worth checking the positioning of your LODs, if it's nothing related to this asset. If you have rigid bodies on, or its a billboard issue. Worth following up with support as previously posted in the event you can't think of anything else that could cause it.
     
  20. SinDeSiecle

    SinDeSiecle

    Joined:
    Sep 30, 2017
    Posts:
    66
    Hi, I started to get this error:

    CSTextureUtils.compute: Kernel at index (0) is invalid
    UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)
    GPUInstancer.GPUInstancerUtility:CopyTextureWithComputeShader(Texture, Texture, Int32, Int32, Int32, Boolean) (at Catastrophe - Multiplayer - SgtSetup/Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:3398)

    index 0 and 1 alternatively gives this error. Then, I have some errors added to this:

    CSInstancedCameraCalculationKernel.compute: Kernel at index (0) is invalid
    UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)
    GPUInstancer.GPUInstancerUtility:DispatchCSInstancedCameraCalculation(ComputeShader, Int32[], GPUInstancerRuntimeData, GPUInstancerCameraData, Boolean, Boolean, Boolean) (at Catastrophe - Multiplayer - SgtSetup/Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:526

    CSTextureUtils.compute: Kernel at index (1) is invalid
    UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)
    GPUInstancer.GPUInstancerUtility:ReduceTextureWithComputeShader(Texture, Texture, Int32) (at Catastrophe - Multiplayer - SgtSetup/Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:3416)

    CSInstancedRenderingVisibilityKernel.compute: Kernel at index (0) is invalid
    UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)
    GPUInstancer.GPUInstancerUtility:DispatchCSInstancedVisibilityCalculation(ComputeShader, Int32, GPUInstancerRuntimeData, Boolean, Int32, Int32) (at Catastrophe - Multiplayer - SgtSetup/Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:564

    All of these come in runtime and repeatedly.

    Unity 2020.1.4, HDRP 8.2.0

    EDIT: I am on windows... Sorry for smileys, forum page did it. Now, i see that 3 of the .compute files in GPUInstancer/Resources/ folder can't include Include/PlatformDefines.compute file. So, whatever the problem is related to PlatformDefines.compute file. Hope this helps in identifying the problem.

    EDIT2: I checked the compute folder on the second project I posted for down, it didn't have any issues. It is a unity 2020.2.2 HDPR 10 project. Thinking that this project's compute folder files are corrupted, I copied the entire Compute folder of that project to this project which is HDRP 8. Errors have gone. Performance seems to be good. That project (below) continues to generate that error, though. But, this project is clean now. However, I am not sure I have done the right thing or the safe thing.
     
    Last edited: Apr 8, 2021
  21. SinDeSiecle

    SinDeSiecle

    Joined:
    Sep 30, 2017
    Posts:
    66
    Also in another project I started to get

    Graphics.CopyTexture called for entire mipmaps with different memory size (source (R32 SFloat) is 5977272 bytes and destination (Depth) is 2988636 bytes)
    UnityEngine.Graphics:CopyTexture (UnityEngine.Texture,int,int,UnityEngine.Texture,int,int)
    GPUInstancer.GPUInstancerHiZOcclusionGenerator:UpdateTextureWithComputeShader (int) (at Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:273)

    on windows. On mac it seems fine. This project is on Unity 2020.2.2, HPRP 10.2.2. Also, this is reducing editor performance.
     
  22. craigbriggs

    craigbriggs

    Joined:
    Nov 21, 2019
    Posts:
    1
    Hi,

    I accidentally clicked on "Generate Prototypes" in the Tree Manager and now only about half the trees in the current scene are listed. I am using version 1.4.4.

    I am also getting the following error message (not sure if it is related)

    NullReferenceException: Object reference not set to an instance of an object
    GPUInstancer.GPUInstancerUtility.DetermineTreePrototypeType (GPUInstancer.GPUInstancerPrototype prototype) (at Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:1516)
    GPUInstancer.GPUInstancerUtility.AddTreeInstancePrototypeFromTerrainPrototype (UnityEngine.GameObject gameObject, System.Collections.Generic.List`1[T] treeInstancePrototypes, UnityEngine.TreePrototype terrainTreePrototype, System.Int32 treeIndex, GPUInstancer.GPUInstancerTerrainSettings terrainSettings) (at Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:1426)
    GPUInstancer.GPUInstancerUtility.SetTreeInstancePrototypes (UnityEngine.GameObject gameObject, System.Collections.Generic.List`1[T] treeIntancePrototypes, UnityEngine.TreePrototype[] treePrototypes, GPUInstancer.GPUInstancerTerrainSettings terrainSettings, System.Boolean forceNew) (at Assets/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:1403)
    GPUInstancer.GPUInstancerTreeManager.GeneratePrototypes (System.Boolean forceNew) (at Assets/GPUInstancer/Scripts/GPUInstancerTreeManager.cs:64)
    GPUInstancer.GPUInstancerTreeManagerEditor.<DrawPrototypeBoxButtons>b__15_0 () (at Assets/GPUInstancer/Scripts/Editor/GPUInstancerTreeManagerEditor.cs:351)
    GPUInstancer.GPUInstancerEditorConstants.DrawColoredButton (UnityEngine.GUIContent guiContent, UnityEngine.Color backgroundColor, UnityEngine.Color textColor, UnityEngine.FontStyle fontStyle, UnityEngine.Rect buttonRect, UnityEngine.Events.UnityAction clickAction, System.Boolean isRichText, System.Boolean dragDropEnabled, UnityEngine.Events.UnityAction`1[T0] dropAction, UnityEngine.GUIStyle style) (at Assets/GPUInstancer/Scripts/Editor/GPUInstancerEditorConstants.cs:530)
    GPUInstancer.GPUInstancerTreeManagerEditor.DrawPrototypeBoxButtons () (at Assets/GPUInstancer/Scripts/Editor/GPUInstancerTreeManagerEditor.cs:346)
    GPUInstancer.GPUInstancerManagerEditor.DrawGPUInstancerPrototypesBox () (at Assets/GPUInstancer/Scripts/Editor/GPUInstancerManagerEditor.cs:358)
    GPUInstancer.GPUInstancerTreeManagerEditor.OnInspectorGUI () (at Assets/GPUInstancer/Scripts/Editor/GPUInstancerTreeManagerEditor.cs:66)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <2f1c602eae0d45c293fff3e3aef759fa>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    Cheers,

    Craig
     
  23. eggsamurai

    eggsamurai

    Joined:
    Oct 10, 2015
    Posts:
    15
    Any plans for motion vector support on crowd animation?
     
  24. Leniaal

    Leniaal

    Joined:
    Nov 7, 2012
    Posts:
    103
    Hi there,

    I'm having an issue after upgrading from 2019.3 to 2020.3.3 All looks fine but there is an issue with the Graphics.CopyTexture API used for the culling.

    Stacktrace:
    Code (CSharp):
    1. Graphics.CopyTexture called for entire mipmaps with different memory size (source (Depth) is 4147200 bytes and destination (R32 SFloat) is 8294400 bytes)
    2. UnityEngine.Graphics:CopyTexture (UnityEngine.Texture,int,int,UnityEngine.Texture,int,int)
    3. GPUInstancer.GPUInstancerHiZOcclusionGenerator:UpdateTextureWithComputeShader (int) (at Assets/Third Party Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:261)
    4. GPUInstancer.GPUInstancerHiZOcclusionGenerator:OnEndCameraRendering (UnityEngine.Camera) (at Assets/Third Party Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:248)
    5. GPUInstancer.GPUInstancerHiZOcclusionGenerator:OnEndCameraRenderingSRP (UnityEngine.Rendering.ScriptableRenderContext,UnityEngine.Camera) (at Assets/Third Party Assets/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:196)
    6. UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
    Version:
    upload_2021-4-9_17-55-15.png

    Unfortunately the project is too large to share. Any idea where to look?
     
  25. LouskRad

    LouskRad

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

    the compute shader folder would not change based on the HDRP version, so it should be safe. However, simply re-importing this folder would probably solve the issue if copying it worked.



    This is solved in a recent version of GPUI. Updating GPUI from the Asset Store to the latest version should fix the issue.

    We haven't yet tested CA with motion vectors, and this currently is not in our roadmap.

    Hi there,

    this seems to be because you have updated your Unity version, but not your HDRP version. Switching to the latest supported HDRP version should fix the issue.
     
  26. Leniaal

    Leniaal

    Joined:
    Nov 7, 2012
    Posts:
    103
    Hi,

    Is that even possible? I believe Unity updates it automatically in any case.

    Anyhow, i double checked and we are on the latest version.

    upload_2021-4-11_18-32-38.png

    Regards,

    Lenne
     
  27. Skaltum

    Skaltum

    Joined:
    Nov 1, 2013
    Posts:
    16
    Hello,

    First of all, great product! I've made massive performance improvements using it to render large fields of solar panels.

    I'm trying to take screenshots of the game using
    Code (CSharp):
    1. ScreenCapture.CaptureScreenshotAsTexture
    .
    When I set the supersize parameter to higher than 1, the instanced objects are not rendered in the screenshot.

    Here is some reproduction code:

    Code (CSharp):
    1. using UnityEngine;
    2.  
    3. public class TestScreenshot : MonoBehaviour
    4. {
    5.     [SerializeField]
    6.     private Texture2D _screenshotWithoutSuperSize;
    7.     [SerializeField]
    8.     private Texture2D _screenshotWithSuperSize;
    9.    
    10.     void Update()
    11.     {
    12.        
    13.         if (Input.GetKeyDown(KeyCode.Space))
    14.         {
    15.             //works
    16.             _screenshotWithoutSuperSize = ScreenCapture.CaptureScreenshotAsTexture(1);
    17.             //missing rendered instances
    18.             _screenshotWithSuperSize = ScreenCapture.CaptureScreenshotAsTexture(2);
    19.         }
    20.            
    21.     }
    22. }
    You can put it on a gameobject in an example scene, play, press space. In the inspector, the screenshot without supersize will be accurate. The screenshot with supersize will be missing the instanced objects.

    Is there a workaround / fix for this?

    Thanks in advance.
     
  28. GurhanH

    GurhanH

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

    The documentation of CaptureScreenshotAsTexture recommends to use this method after frame rendering has ended:
    To get a reliable output from this method you must make sure it is called once the frame rendering has ended, and not during the rendering process. A simple way of ensuring this is to call it from a coroutine that yields on WaitForEndOfFrame. If you call this method during the rendering process you will get unpredictable and undefined results.

    When I tried this way it worked fine. Here is the example:

    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3.  
    4. public class TestScreenshot : MonoBehaviour
    5. {
    6.     [SerializeField]
    7.     private Texture2D _screenshotWithoutSuperSize;
    8.     [SerializeField]
    9.     private Texture2D _screenshotWithSuperSize;
    10.  
    11.     void Update()
    12.     {
    13.         if (Input.GetKeyDown(KeyCode.Space))
    14.         {
    15.             StartCoroutine(RecordFrame());
    16.         }
    17.     }
    18.  
    19.     IEnumerator RecordFrame()
    20.     {
    21.         yield return new WaitForEndOfFrame();
    22.  
    23.         //works
    24.         _screenshotWithoutSuperSize = ScreenCapture.CaptureScreenshotAsTexture(1);
    25.         //missing rendered instances
    26.         _screenshotWithSuperSize = ScreenCapture.CaptureScreenshotAsTexture(2);
    27.     }
    28. }
     
    Skaltum likes this.
  29. eggsamurai

    eggsamurai

    Joined:
    Oct 10, 2015
    Posts:
    15
    Motion vector is very very very import for taa and postprocess effects... i have to diy
     
  30. d11javierv

    d11javierv

    Joined:
    Nov 17, 2020
    Posts:
    1
    Hello!
    First off, thank you for supplying this product. It has been very useful.

    I have been reading this thread looking for information about changing instances' layer, and I didn't find anything but a post from 31th August 2019.

    I need to apply different screen space effects to different instances, such as highlights, outlines and so on. I was thinking of using different URP render features in order to achieve this, depending on the layers. It works well but my main problem now is to be able to change the instances' layer at run time.

    Do you have any advice or any feature to achieve this?
     
  31. athert

    athert

    Joined:
    Dec 31, 2012
    Posts:
    24
    Helloo.
    Im not sure if this question was asked before but i have bad experience with frustum culling. Everytime i move with camera a little more faster, it just didnt catch and you can see that objects are "behind" with render. I tried to change "Frustum Offset" but it didnt help at all at any value. Is there any other option how to fix this issue?
    Another question is if all changes in runtime are instant or you need to restart game mode.
     
  32. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    878
    Hey there, and thanks.

    Since GPUI uses the DrawMeshInstancedIndirect API under the hood, the drawcall that is made for all the instances uses the same layer - so it is inherently not supported to have different layers on different instances of the same prototype.

    If the instances you want to use in a different layer are not many in numbers, one way to go about this would be to turn off instancing for the select instances from the GPUInstacer API and set their layers after. You can turn instancing back on after you set them to the original layer.

    Can you please try increasing the Occlusion Cull Offset value of the prototype settings on the manager to a very small number (such as 0.001 - 0.01) and see if this fixes the issue?
     
  33. Alex1337rus

    Alex1337rus

    Joined:
    Mar 30, 2016
    Posts:
    32
    Hello! I really like your asset, but i have probably stupid question.
    As I understand, you use frustum culling for absolutely all objects on the scene. Wouldn't that be a problem for the big scene? Is it possible to divide the scene into sectors and first cull the sectors and then cull objects inside these sectors? It seems like how vegetation studio works.
     
unityunity