Search Unity

HDRP - Batching does not work

Discussion in 'High Definition Render Pipeline' started by sergiusz308, Jun 23, 2019.

  1. sergiusz308

    sergiusz308

    Joined:
    Aug 23, 2016
    Posts:
    23
    Hello, trying to get batching to work with no results :(

    Have a simple scene with single prefab (mesh + material) being rendered with HDRP Lit material. Material is set to use GPU Instancing. Number of batches: 6

    Each time I duplicate prefab, number of batches goes up, and up, and up - by 6 each time.

    Material has one diffuse map and one emission map.

    No scripts, no custom shader, all standard stuff (apart from mesh and textures).

    Unity v. 2019.1.7f1, HDRP v. 5.16.1

    What am doing wrong?

    Screenshots:

    Two prefabs are there (one duplicated off another), second one is disabled:
    barching_not_working_1.png

    After enabling rendering for second one:
    barching_not_working_2.png

    Prefab setup:
    barching_not_working_3.png
     
  2. sergiusz308

    sergiusz308

    Joined:
    Aug 23, 2016
    Posts:
    23
    Bump - anyone? It seems that GPU instancing is not working here. I red through manual and tutorials on batching topic and everything is set up as it should be but still no result.

    No particular information can be found also in profiler or frame debugger.

    GPU Instancing works however in standard Unity rendering pipeline.

    What's happening?
     
  3. Gabriel_Alexandre

    Gabriel_Alexandre

    Joined:
    Nov 3, 2016
    Posts:
    5
    Also happening for me.
     
  4. sergiusz308

    sergiusz308

    Joined:
    Aug 23, 2016
    Posts:
    23
    OK, after more testing (because I have nothing more interesting to do than investigating what's wrong: Unity rendering or Unity documentation....) it seems that docs are not updated.

    Batching works, but:

    - when material is checked to use GPU Instancing and SRP Batcher is enabled there's no "draw instanced" calls in the frame debugger visible and Stats display batched calls with - sign

    - when material is checked to use GPU Instancing and SRP Batch is disabled, you can observe "draw instanced" calls in the frame debugger and Stats displays batched calls properly, as documented in the manual

    Anyone from Unity Dev team please comment on this - is my understanding is correct?
     
    Last edited: Aug 13, 2019
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    5,868
  6. arnaud-carre

    arnaud-carre

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    47
    Hi!

    Have to admit it's a bit confusing and we're working on improving that. First, the statistics window is not up to date when batcher is ON ( because some numbers have no meaning in batcher context, ie "saved by batcher" ). This is not ideal situation and we're working on refactoring that statistic window to provide good metrics (with certainly new names))

    Anyway if you really want to measure performance with and without batcher, I recommend you to use a small script ( SRPBatcherProfiler.cs ) . More details in that blogpost.

    Regarding automatic GPU instancing, we by pass it when SRP Batcher is ON ( because in real life scene, batcher is slightly faster ). Of course you still can use explicit GPU instancing via Graphics.DrawInstanced for dedicated things.
     
    sergiusz308 and hippocoder like this.