Search Unity

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

[RELEASED] GPU Instancer

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

  1. RakNet


    Oct 9, 2013
    Was GPU instance tested with Unity 2020.1.8f1? While paused, the same scene loaded in that version runs at < 1 FPS with all tabs closed except the scene view, where it runs at >30 FPS in Unity 2019.3.15f1.
  2. Steve2375


    Mar 28, 2015
    In my project, all unity flares don't show up as soon as the script GPUInstancerHiZOcclusionGenerator is attached to the camera. Is this a known problem and can we workaround it? What is this script doing?
  3. monda


    May 14, 2015
    Thanks for your help. Unfortunately the main (only) reason I've bought this was for Android, at the end I've just used the Unity "Standard" way to do GPU Instancing and the Shader works fine on Android.
  4. LouskRad


    Feb 18, 2014
    We haven't seen any problems with the 2020.1.8.f1 in our tests. I suggest you use the profiler to identify what is causing the performance hit.

    You can solve the issue as described in this F.A.Q.
    Steve2375 likes this.
  5. Hosnkobf


    Aug 23, 2016
    We use GPU Instancer in our project.

    For a simple billboard which moved around (a thought bubble above the head of a character), I created an own simple unlit shader (vertex / fragment) which uses Unitys instancing for a color property (MaterialPropertyBlock).

    I realized that the billboard sometimes disappears if GPU instancing is enabled in the material.
    I assume that it has something to do with your asset... Is this a known problem and is there a workaround for this?
  6. FrozenKiwi


    Mar 7, 2019

    First - incredible job on your support - amazing to see such responsiveness after so many years/pages :).

    I'm interested in using GPUI to handle GPU occlusion/frustum culling for my entire scene. We have lots of small meshes and a very high rate of occlusion. From what I understand, if you are doing culling on the GPU then you must also be doing all your actual draw calls on the GPU, is that correct? So there should be a single draw call to trigger drawing all meshes/instances that share a material?

    In this case, wouldn't it be -always- more efficient to render with GPUI? This doesn't seem true, because your docs state it is less efficient to use GPUI for low numbers of instances (and there are a few comments I read that noted multiple draw calls for different meshes). However, I'm trying to wrap my head around how you do occlusion culling without issuing the draw calls on the GPU.

    Apologies if this has already been asked, I tried to skim the pages but there is a lot of questions already
  7. SinDeSiecle


    Sep 30, 2017

    Ok, changing the original message, since I figured out what was wrong. But, I have a different problem, now.

    I am using runtime prototyping and instantiation. I needed a grass prefab to place on the surface by raycasting on ground, so I needed GPUInstancer to instance it after placement was done. I managed how to do this by the following code:

    public void GPUInstancingOperationInstant (GameObject anObject, bool makeRemovableByObjects = true) {
    // if prototyped previously, we keep the object name in list named "prototyped" to filter out further requests
    if (!prototyped.Contains ( {
    Debug.Log ("Object " + + " is not prototyped, will be runtime prototyped.");
    prototyped.Add (;

    GPUInstancerPrefabPrototype p = GPUInstancerAPI.DefineGameObjectAsPrefabPrototypeAtRuntime (prefabManager, anObject);
    p.isFrustumCulling = true;
    p.isOcclusionCulling = true;
    p.useOriginalShaderForShadow = true;
    p.enableRuntimeModifications = true;
    p.extraBufferSize = 50000;
    p.addRemoveInstancesAtRuntime = true;
    p.autoUpdateTransformData = true;
    p.addRuntimeHandlerScript = false;

    GPUInstancerAPI.AddInstancesToPrefabPrototypeAtRuntime (prefabManager, p, new GameObject[] { anObject });
    Debug.Log("Called GPU Instancer method");
    if (makeRemovableByObjects) {
    removablePrototypes.Add (p);


    if (!anObject.GetComponent<GPUInstancerPrefab> ()) {
    anObject.AddComponent<GPUInstancerPrefab> ();
    anObject.AddComponent<MYRemoveFromGPUInstancerOnDestroy> ();
    GPUInstancerAPI.AddPrefabInstance (prefabManager, anObject.GetComponent<GPUInstancerPrefab> ());

    The problem is: although the frame rates showing over 45 - 50 fps on editor, it plays like 1-2 fps short time after instancing. And there is an instance appearing in camera space just floating in the air and moving with the camera, but comes into view when I look back. No warnings, no errors in the console. Only 8000 instance was instanced. (I also have a increased max buffer size to a number like 500000 in GPUInstancer settings, but 8000 is way beyond that number).

    What am I doing wrong?

    Last edited: Oct 14, 2020
  8. LouskRad


    Feb 18, 2014
    Hi there,
    the "enable instancing" option on the materials does not effect the working of GPUI at all, since it uses its own rendering solution.

    If you are using GPUI with that billboard, please keep in mind that MaterialPropertyBlocks for instanced properties would not work with GPUI. Instead, you can take a look at this wiki article for material variations.

    Hi there,
    and thanks for your kind words.

    Yes that is correct; the culling features only work for the instances that are rendered by GPUI. But it wouldn't be always more efficient to use GPUI for everything just to have it cull them. The reason is simply because GPUI's culling, etc. operations use some small operation time in the GPU which is unnoticeable with high instance numbers because of the gain from draw calls, but would slow down the system if used for a lot of prototypes with low instance counts.

    The point about culling is, it is only good if the testing operations take less then the gain in rendering when some objects are culled. In the case of GPUI, this operation works on top of the instances for some extra benefit to indirect instancing. However, if the rendered objects are not benefiting from indirect instancing to begin with, than the culling operations are actually a hindrance - so it doesn't make sense.

    Instancing appearing on top of the camera are almost always because of a shader problem (which would slow down performance as well). You can take a look at this wiki F.A.Q for more information on the shader setup.
  9. LouskRad


    Feb 18, 2014
    Hi everyone,

    the GPU Instancer v1.4.3 update is live in the asset store. This version comes with a new demo scene that showcases how you can use material variations (in this case the UV) with shader graph. You can find this new demo scene inside the GPUI_ShaderGraph_v5.x_or_Later_Node package. So if you have been using the shader graph node, you need to re-extract the package to see the new demo.


    This version also fixes the issue with Map Magic 2 graphs that have biomes.

    You can see the full changelog for v1.4.3 below:

    New: Added a sub graph and a demo scene for material variations with Shader Graph

    Fixed: Instances are not rendered when editor is paused
    Fixed: Map Magic 2 integration can not import objects from graphs with biomes
    Fixed: Shadow distance is now correctly read from the Universal Render Pipeline Asset in URP.
    Fixed: XR and VR libraries are now checked for and the VR logic defaults to non-VR if both libraries are not present.