Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

SRP Batcher ON/OFF?

Discussion in 'High Definition Render Pipeline' started by strongbox3d, Apr 24, 2020.

  1. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Hello,

    Could someone tell me where is the switch for SRP Batcher in the HDRP 7.1.6 and up? I am using Unity 2019.3.7f1. I can't find it in the place that the documentation says... and my "Saved by batching" is a negative number!

    Regards,
    Carlos
     
  2. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    You can toggle it only through scripting api now afaik. It's enabled by default.
     
  3. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Are you sure about that? Because I tried the sample code in the docs and nothing changed.
     
  4. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    Yes, it still works. You can put this script on your project to test it (use F9 to toggle it on and off):
    https://raw.githubusercontent.com/U...k/master/Assets/Scripts/SRPBatcherProfiler.cs
    Due to some namespace issues I needed to change line 26 to
    Code (CSharp):
    1.  public UnityEngine.Profiling.Recorder recorder;
    but other than that, script worked without issues even on latest wip HDRP straight from github (so it's safe to assume it's not gone anywhere):


     
    Last edited: Apr 27, 2020
  5. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Well thank you! I will give it a try. Because my stats in the game view it is giving me a negative number in the "Saved by batching" line, and a huge number in the "Batches" line, which is weird as hell!

    So I am trying to turn it off/on to see if I see any difference in those stats lines.
     
  6. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    BATCHER_ON_OFF_screenshot.jpg I just tried this script and indeed when SRP batcher is ON it reduces the amount of triangles rendered from millions to a few thousands and decreases the CPU rendering time a considerable amount, but interesting enough, it makes the "Saved by batching" a negative number. When is OFF the "Saved by batching" is possitive and bigger than the number of "Batches" which is what I expected with SRP batcher ON instead.

    Do you get this same results?
     
    Last edited: Apr 27, 2020
  7. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    195
    The stats window is outdated / not yet accomodating srp related things, so you should just ignore that number as it's simply wrong currently ;)
     
  8. strongbox3d

    strongbox3d

    Joined:
    May 8, 2012
    Posts:
    860
    Oh ok, that it good to know, I was very worry about those stats! Thank you Onat-H