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
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

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:
    111
    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:
    111
    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. Dinamytes-Gabriel_Mota

    Dinamytes-Gabriel_Mota

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

    sergiusz308

    Joined:
    Aug 23, 2016
    Posts:
    111
    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:
    6,701
  6. arnaud-carre

    arnaud-carre

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    61
    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.
     
    andywatts, sergiusz308 and hippocoder like this.
  7. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    8,360
    Hi,

    I use the HDRP Lit shader and enabled GPU instancing for objects copied and scaled - rotated around, but the batches are still enormous (like 3000) and "saved by batching' metric reports a minus -2000, is this meaning the batching is working ?
     
  8. shredingskin

    shredingskin

    Joined:
    Nov 7, 2012
    Posts:
    219
    Does the documentation need to be updated ? I don't see an advanced options in the HDRP asset.
     
    EthanFischer likes this.
  9. sergiusz308

    sergiusz308

    Joined:
    Aug 23, 2016
    Posts:
    111
    In March 2020 I have no idea- that whole thing with SRP transitioning is a one huge mess, on unity side.

    Maybe some big customers with dedicated support from unity have any understanding of how to properly and efficiently use new rendering pipeline.

    Little guys like myself are left with nonexistent or outdated documentation, confusing blog posts and sponsor videos, completely unhelpful forum and bug report replies. It's hit and miss game.

    Great that there's raytracing tech you can show off, but not being able to properly investigate performance, without using some loose scripts, posted somewhere on the forums (because I have too much free time I can spend on hacking around instead of developing my game...) its just pathetic. And this is just a tip of the iceberg of missing or broken things in the new pipeline.

    I should have stayed with built in renderer. It's at least two years, if not more, before srp become ready to production use. I wish somebody would mentioned that in multiple blog posts and videos they advertised srp in.
     
    id0 and Dinamytes-Gabriel_Mota like this.
  10. Ultroman

    Ultroman

    Joined:
    Mar 10, 2014
    Posts:
    51
    Also still waiting on figuring out whether my batching works or not. It says 48 batches and -48 saved. Does that mean that I have successfully messed up every single instancing-attempt I have done, or does it mean that it works?

    I'm sorry, but I have to agree. It's impossible to do any real work here, without creating all the building blocks to fit into Unity to make it work. How is there not a single particle-shader for HDRP yet? Yes, I've tried the beta-package they made, but those don't support colors, so you have to write those yourself. That's such a weird choice to me.
     
  11. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    805
    I am using Unity 2019.37f1, HDRP.

    I still have this problem about batching, I have a lot of objects with the exact same material and texture on them, the are not marked as static batch since they are moving, and the material is mark to GPU Instance batch. Guess what? I get exactly the same result that you guys: A high number in "Batches" and a negative number as high in "Saved by batching".

    I don't find any place in Settings or HDRP asset to turn on/off SRP batching neither!

    Could someone from Unity shine a real light here? Please

    Regards,
    Carlos
     
  12. customphase

    customphase

    Joined:
    Aug 19, 2012
    Posts:
    185
    +1 to this. In frame debugger it shows that SRP Batcher works and batches things, however, if you try and use RenderDoc, you'll see that in fact absolutely nothing gets batched, even static stuff. Unity 2020.1b8, HDRP 8.1.0

    upload_2020-5-28_2-51-29.png

    upload_2020-5-28_2-51-1.png

    Making the boxes non static and enabling GPU instancing on their material does nothing as well. Theres still one drawcall per box.

    cc @arnaud-carre
     
unityunity