Search Unity

[RELEASED] GPU Instancer

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

  1. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    Last edited: Jul 30, 2019
  2. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    @LouskRad
    what is difference between GPUI lit shader and original HDRP lit shader??
    have to using GPUI lit shader against of original HDRP?
     
  3. LouskRad

    LouskRad

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

    The purpose of this method overload is to update the buffer partially. arrayStartIndex is the start index of the array that you supply to this method. bufferStartIndex is where you want to start when updating the buffer you've created with the InitializeWithMatrix4x4Array method for GPUI. count is how many of the matrix you wan to update, starting with the arrayStartIndex of your matrix array.

    For upgrading a single matrix, you can give its index in your matrix array, its index on the buffer and the count as 1. For example if you are using a matrixArray that you have initialized the manager with, and wish to update the 3rd matrix in the array, you can do:

    UpdateVisibilityBufferWithMatrix4x4Array(manager, prototype, matrixArray, 3, 3, 1);

    This override was designed in the spirit of Unity's ComputeBuffer.SetData method.
     
  4. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,
    Can you please contact us via support mail with your invoice so we can send you a fix.
     
  5. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,
    we are working on an option to increase the Occlusion Culling accuracy in the manager. This will be available in the next update.
     
    Hexer_ likes this.
  6. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,
    If you wish to manually handle the shaders that go in your builds, you can turn off the automatic handling of the shader variants collection from Edit -> Preferences-> GPUInstancer. You can turn off the Generate Shader Variant Collection option from there.
     
  7. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi,

    this problem is caused by the Book of the Dead project using an older, unsupported version of HDRP. You might try fixing the paths in the GPUI generated shaders, but please note that Tesselation is not supported with GPU Instancing in Unity.

    GPUI creates a version of the original shader that is setup to work with itself. These shaders always have the "_GPUI" suffix.
     
  8. Davood_Kharmanzar

    Davood_Kharmanzar

    Joined:
    Sep 20, 2017
    Posts:
    411
    in runtime or on adding prefabs?
     
  9. loliconest

    loliconest

    Joined:
    Sep 21, 2015
    Posts:
    31
    This asset looks amazing!

    I have one important question to ask: does this asset only work with prefabs? If I have a scene with 10k of the same GameObjects but none of them are prefab, will Frustum Culling and Occlusion Culling still work?
     
  10. Hexer_

    Hexer_

    Joined:
    Aug 25, 2016
    Posts:
    94
    That would be awesome! BTW did you check out the culling solution Unity used in their Book of the Dead?
    I tried it out yesterday and was very impressed by the level of detail and low on-screen triangles counts - 50-70K for a photorealistic environment. Maybe it could help you to achieve even further improvements! :)

    https://assetstore.unity.com/packag...-projects/book-of-the-dead-environment-121175
     
  11. shamsfk

    shamsfk

    Joined:
    Nov 21, 2014
    Posts:
    307
    Hello! I'm currently prototyping a space game with LOTS of units and TONS of bullets) I'm using ECS to calculate AI and movement and collisions and stuff, and it is working nicely, but how do I approach rendering entities using GPUI? Can you give a tip or a mini-guide maybe?
     
  12. Alex3333

    Alex3333

    Joined:
    Dec 29, 2014
    Posts:
    342
    I wrote to you in the mail.
     
  13. egable

    egable

    Joined:
    May 21, 2014
    Posts:
    23
    When I try to add the prefab manager to my scene, I get this error:

    Instance of GPUInstancerPrefabManagerEditor couldn't be created. The script class needs to derive from ScriptableObject and be placed in the Assets/Editor folder.

    Not sure why I'm getting this or how I should resolve it. This is Unity 2019.1.12f1 and the latest available GPU Instancer from the asset store.
     
  14. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    on adding prefabs.
     
  15. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Thanks!

    Out of the box, GPUI is designed for use with prefabs that you have instances of in the scene, but there are API methods for other options for runtime created GOs or a no-GO workflow. However, GPUI also comes with a tool that you can replace your scene GOs as the instances of a prefab.
     
  16. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi there,
    we have plans to add a demo scene or a tutorial that shows how you can use GPUI with ECS/Job system, but at this point I cannot provide an ETA for this.
     
    pal_trefall and Razmot like this.
  17. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    This might happen when you move GPUI folders into different assemblies (using ASMDEFs), and/or when you move some GPUI files into or out of special Unity folders, such as "/Plugins" or "/Editor". Can you please check if you set your assemblies correctly in your project?
     
  18. LouskRad

    LouskRad

    Joined:
    Feb 18, 2014
    Posts:
    904
    Hi everyone,

    I just wanted to let you know that the GPU Instancer team will be on a summer break until August 31st. We will be answering all the questions and support requests after the break.
     
  19. Sam512

    Sam512

    Joined:
    Jan 13, 2019
    Posts:
    178
    Tree disapeared when I use Vegetation Studio? What should I do?
     
  20. zen_potato

    zen_potato

    Joined:
    Jul 6, 2019
    Posts:
    3
    Hello,
    how can I update the Tree Manager on runtime? I would need to be able to create and remove tree instances. I couldn't find solution from the demos or the wiki.
     
    MaddGameStudio likes this.
  21. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    Hey i have a small issue with the GPU instancing. When i add it to my scene it removes most of my grass when viewed from the camera but it also gives me this "missing" shader error:

    upload_2019-8-5_21-29-40.png

    Can you help?

    It is worth mentioning im using unity 2019.1 and HDRP
     
  22. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    178
    Hi,

    Thank you for this great asset ! I bought gpui and crowd animations plugins. Both are simply a bless !!!

    There is a way to implement your ‘frustum occlusion algorithms’ with other game object in my game that not use gpui ? (Object with small count) if no, can you advise about other asset that I can use to achieve this ?

    Thank you so much and keep up the good work
     
  23. MorpheusXI

    MorpheusXI

    Joined:
    Jan 18, 2018
    Posts:
    75
    +1 for SECTR integration / 5* as of today >= 233
     
  24. yinch

    yinch

    Joined:
    Jun 18, 2016
    Posts:
    6
    Hi,

    Has anyone run the GPUI or GPUI Animation system using Unity 2019.2?

    Thanks!

    yinch
     
  25. Darkmatter520

    Darkmatter520

    Joined:
    May 12, 2014
    Posts:
    12
    Hello, I recently purchased your GPU instancing asset and so far it seems pretty good. I have however been having a few problems with instancing SpeedTree terrain trees. After adding the Tree Manager and running the game, it seems that the generated billboards pop and flicker when moving the camera. They seem to be generating views where the leaves are not shown, or just the branches and no leaves.

    Here is an image of the generated billboard atlas, as you can see two of the eight frames are glitched.
    Tree_2_MediumTree_BillboardAlbedo.png
    Help would be appreciated, thanks!
     
  26. hellstorm

    hellstorm

    Joined:
    Jun 29, 2015
    Posts:
    41
    Greetings!
    using the
    oculus player controller
    and vr occlusion culling,
    and activating "Use Fixed Update For Tracking" on the OVR Camera Rig causes culling to flash as soon as input is detected. close up crossquads are not effected

    some maybe be mistaking this for other culling bugs
     
  27. daisySa

    daisySa

    Joined:
    Dec 29, 2011
    Posts:
    341
    I'm seeing Performance Reporting log the following error a lot recently (e.g. for 59 unique players on Steam over the last 12 hours or so):

    ArgumentException: Kernel 'CSInstancedRenderingVisibilityKernelLOD0' not found.
    GPUInstancer.GPUInstancerManager.Awake () (at <00000000000000000000000000000000>:0)


    This message is also reported at the time of the crash:

    Kernel 'CSInstancedComputeBufferSetDataPartialKernel' not found

    I'm also seeing a lot of warnings like the one below. However, when I check each game object, there are no missing components:

    The referenced script on this Behaviour (Game Object 'paper_4') is missing!

    Any ideas as to what is causing this? The build is 2018.4.5f1 on Windows 10.
     
  28. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    Hi, while profiling, I found this. I'm using the latest GPUI and 2019.1.13
    GPUI is taking about 30% of the whole CPU cycles.
    I have very simple GPUI setup and GPUI shouldn't be too taxing.
    Could you please explain what "Semaphore.WaitingForSignal" is doing here?
    Thanks.

    upload_2019-8-12_21-0-6.png
    upload_2019-8-12_21-0-21.png
     
  29. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    315
    Getting a crash when adding GPUI Tree Manager()

    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:1436)
    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:1343)
    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:1320)
    GPUInstancer.GPUInstancerTreeManager.GeneratePrototypes (System.Boolean forceNew) (at Assets/GPUInstancer/Scripts/GPUInstancerTreeManager.cs:48)
    GPUInstancer.GPUInstancerTerrainManager.SetupManagerWithTerrain (UnityEngine.Terrain terrain) (at Assets/GPUInstancer/Scripts/Core/Contract/GPUInstancerTerrainManager.cs:114)
    GPUInstancer.GPUInstancerEditorConstants.ToolbarAddTreeManager () (at Assets/GPUInstancer/Scripts/Editor/GPUInstancerEditorConstants.cs:627)

    Name Value Type
    ◢ prototype.prefabObject.GetComponent<LODGroup>().GetLODs()[0].renderers[0].sharedMaterials UnityEngine.Material[1] UnityEngine.Material[]
    [0] null UnityEngine.Material

    Fix:
    if (prototype.prefabObject.GetComponent<LODGroup>().GetLODs()[0].renderers[0].sharedMaterials[0] == null)
    {
    prototype.treeType = GPUInstancerTreeType.None;
    return;
    }
     
  30. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    315
    Another issue, occurs after adding GPUI Tree Manager()

    Shader error in 'GPUInstancer/Nature/SPDTree': undeclared identifier '_DitherMaskLOD2D' at Assets/GPUInstancer/Shaders/Include/GPUInstancerInclude.cginc(59) (on d3d11)

    Compiling Vertex program with UNITY_PASS_DEFERRED LIGHTPROBE_SH UNITY_HDR_ON LOD_FADE_CROSSFADE PROCEDURAL_INSTANCING_ON LOD_FADE_PERCENTAGE EFFECT_BUMP EFFECT_HUE_VARIATION GEOM_TYPE_LEAF
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR

    UNITY_VERSION needs to be updated? This was mentioned months ago in another post but I'm on the latest version
     
  31. hongtm

    hongtm

    Joined:
    May 22, 2018
    Posts:
    20
    I have the problem with Speedtree 8 and Unity 2019.2.1f1.

    upload_2019-8-20_11-44-31.png

    upload_2019-8-20_11-43-45.png
     
  32. UnityRocksAlt

    UnityRocksAlt

    Joined:
    Dec 28, 2015
    Posts:
    157
    I would like to ask a generalized question, how is GPU Utilization and GPU Instance related? Please let me know, in some scenes, there is 35% GPU utilization, and in some scenes there is 43%. In most games 43% is norm, so I am not bothered but still I would like to know why do much difference.
     
  33. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    @LouskRad : I'm getting an error. I'm on 2019.2.1f1

    Code (CSharp):
    1. Shader error in 'GPUInstancer/Nature/SPDTree8': undeclared identifier '_DitherMaskLOD2D' at Assets/GPUInstancer/Shaders/Include/GPUInstancerInclude.cginc(59) (on d3d11)
    Edit: Which makes my trees do this for some reason.

    upload_2019-8-20_9-58-27.png
     
    Last edited: Aug 20, 2019
  34. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    I fixed the issue simply by commenting out

    Code (CSharp):
    1. //#ifndef LOD_FADE_CROSSFADE
    2.     uniform sampler2D _DitherMaskLOD2D;
    3. //#endif // LOD_FADE_CROSSFADE
    Not sure if this has any unintended side effects. But it appears to be running now.

    Not sure if it's related to commenting the two lines above, but my SetPass calls skyrocket to 814 which is killing performance. Normally it's at roughly 140 setpass calls.

    [Edit]
    oh wait, thought I should mention - i'm doing the Map Magic Integration. Not sure if this could be causing these issues.
     
    Last edited: Aug 20, 2019
  35. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Turns out this is facing the same exact issue as Voxel Land.
    The problem is coming directly from this - Gfx.WaitForPresentOnGfxThread.

    Averaging around 50-60 ms per frame, but as high as 250+ at the beginning of each spike.
     
  36. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    @N1warhead did you fix the issue with the Gpuinstancer/HDRP/Lit shader? if so how did you manage?
     
  37. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Unfortunately not.

    I literally just reformatted my computer to a clean windows install hoping it was old conflicted AMD Drivers or something, but that sadly didn't help so I'm back to square one.

    I was posting a lot in this last night - created a thread based on Gfx.WaitForPresentGfxThread as that's the issue.

    I show what's going on with the CPU and GPU between GPU Instancer and Voxeland. As both have this same issue.
    https://forum.unity.com/threads/gfx-waitforpresentongfxthread.731327/#post-4878530


    Are you having the same problem?

    Or were you in reference to the shader line comments I was talking about? if so that did make it work, but not sure if there was any unintended side effects by doing so.

    [Edit]
    I realized you said HDRP. I'm using the standard pipeline.
     
    Last edited: Aug 21, 2019
  38. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    I do have the same problem. The thing is a single variable in one of the shaders that basically doesnt seem to compile. :(
     
  39. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Just do this.. Double click the error. When it opens up the shader code simply look for (right above it)
    Just comment out the ifndef and endif lines like I put below.

    Code (CSharp):
    1. //#ifndef LOD_FADE_CROSSFADE
    2.     uniform sampler2D _DitherMaskLOD2D;
    3. //#endif // LOD_FADE_CROSSFADE
     
  40. Gerard_Slee

    Gerard_Slee

    Joined:
    Apr 3, 2017
    Posts:
    11
    Hello There.

    I have implemented this in a vr prototype, and it works gloriously, the player has a virtual digital camera that also shows the instances, however when capturing screenshots from this camera the instances are not visible on the resulting Texture2D.

    Any ideas how I can save a screenshot from a specific camera at runtime with all effects and gpunstances?

    Thanks!
     
  41. awesomedata

    awesomedata

    Joined:
    Oct 8, 2014
    Posts:
    1,419
    RenderTexture possibly? -- I'm actually not sure if this is before or after the blit operation.
     
  42. txarly

    txarly

    Joined:
    Apr 27, 2016
    Posts:
    197
    hi, i am geting this shader error with tree manager,

    Unity version:2019.2.0f1

    Snap 2019-08-25 at 10.36.25.jpg Snap 2019-08-25 at 10.37.40.jpg

    Any idea?thanks
     
  43. E_Urban

    E_Urban

    Joined:
    Sep 16, 2014
    Posts:
    8
    Is there any way to implement a max distance falloff for occlusion? I'm making long fields of grass and wanted to try to blend the far edge to a lower detail density. Thanks!
     
  44. Alex3333

    Alex3333

    Joined:
    Dec 29, 2014
    Posts:
    342
    I have a problem. the player takes the shadows of other objects that are listed in the manager. how to solve it? That is, the player runs next to the object and the shadow of this object moves with the player. and sometimes instead of a player’s shadow on the ground, the shadow of a given object that moves with the player.
     
  45. markashburner

    markashburner

    Joined:
    Aug 14, 2015
    Posts:
    212
    Hi
    I am using a pooling system where instead of destroying prefabs...I just deactivate them and then activate them again essentially just recycling prefabs instead of destroying them.
    I notice that when a prefab is deactivated and then reactivated again...it doesn't register with the GPU Instancer Prefab manager...

    So my question is how do I register a prefab again with the prefab manager after it has been reactivated?

    Thanks
     
  46. asdzxcv777

    asdzxcv777

    Joined:
    Jul 17, 2017
    Posts:
    29
    hello ...
    I am using gpu instancer in non gameobject mode.
    I request you to add more tutorials where prefab in prefab manager can be set by api.
    Also maybe you can add a parameter where we can select on which layer rendering is happening.

    public static void DrawMeshInstancedIndirect(Mesh mesh, int submeshIndex, Material material, Bounds bounds, ComputeBuffer bufferWithArgs, int argsOffset = 0, MaterialPropertyBlock properties = null, Rendering.ShadowCastingMode castShadows = ShadowCastingMode.On, bool receiveShadows = true, int layer = 0, Camera camera = null, Rendering.LightProbeUsage lightProbeUsage = LightProbeUsage.BlendProbes, LightProbeProxyVolume lightProbeProxyVolume= null);

    By layer I mean the bold part.
     
    Last edited: Aug 29, 2019
  47. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    Hello :)

    is it possible to use amplify imposter with the GPU Instancer?
     
  48. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
  49. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
  50. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    I keep getting this error. No idea what is causing it, or how to stop it.

    Code (CSharp):
    1. Compute shader (CSTextureUtils): Property (source) at kernel index (0) has mismatching texture dimension (expected 2, got 5)
    2. UnityEngine.ComputeShader:Dispatch(Int32, Int32, Int32, Int32)
    3. GPUInstancer.GPUInstancerUtility:CopyTextureWithComputeShader(Texture, Texture, Int32, Int32, Int32, Boolean) (at Assets/InitialStuff/GPUInstancer/Scripts/Core/Static/GPUInstancerUtility.cs:3207)
    4. GPUInstancer.GPUInstancerHiZOcclusionGenerator:UpdateTextureWithComputeShader(Int32) (at Assets/InitialStuff/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:232)
    5. GPUInstancer.GPUInstancerHiZOcclusionGenerator:OnEndCameraRendering(Camera) (at Assets/InitialStuff/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:221)
    6. GPUInstancer.GPUInstancerHiZOcclusionGenerator:OnEndCameraRenderingSRP(ScriptableRenderContext, Camera) (at Assets/InitialStuff/GPUInstancer/Scripts/GPUInstancerHiZOcclusionGenerator.cs:187)