Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Batching not working with URP ?

Discussion in 'Universal Render Pipeline' started by educa, Sep 4, 2020.

  1. educa

    educa

    Joined:
    Mar 3, 2015
    Posts:
    14
    Hi,

    I have a very simple lightmapped scene in URP. The scene has 1 plane and 10 primitive objects.
    All lighting is baked, all lights have been set to baked and even disabled after the bake.
    All 11 object share the same urp material.
    All 11 objects are marked fully static and in the URP rendering asset I also checked the SRP batcher

    Still the stats show Batches 11 and Saved by batching: 0
    I do only have 1 SetPass call, but I don't get why the batches is still 11. If I disable the primitive objects 1 by one, then each disabled primitive reduces the Batches from 11 -> 10 -> 9 -> ... so each primitive is counted as 1.

    Shouldn't these all be counted as 1? Where could I find the reason for this ? It looks like this is not running optimized now ?

    I sincerely hope somebody knows what I could do to improve this ?

    Schermafbeelding 2020-09-04 om 13.34.15.png

    Kind regards,
    Bart
     
  2. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    637
    Look into using the built in Frame Debugger, this should display the list of batches as well as give you information on why certain things cannot be batched.
     
    Peter77 likes this.
  3. educa

    educa

    Joined:
    Mar 3, 2015
    Posts:
    14
    I did, but all I get is this (with 5 objects, not with 111).
    Would this mean that they are batched anyway ? I see 5 draw calls but it looks like probably this is already optimised ? Difficult to read. Maybe you can read this better than me

    Schermafbeelding 2020-09-04 om 22.12.04.png
     
  4. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,444
    I wouldn't trust the statistics window in the game view. It's broken with scriptable render pipeline since the beginning. It sometimes even displays a negative number of batches. Using the frame debugger is good advice.
     
  5. educa

    educa

    Joined:
    Mar 3, 2015
    Posts:
    14
    I have my frame debugger screenshot above. I "think" I read there that there are 2 calls. 1 is clearing the screen and the other one draws 5 drawcalls in 1 shot?

    Am I interpreting that right?

    Kind regards,
    Bart
     
  6. alexxUID

    alexxUID

    Joined:
    Jan 14, 2020
    Posts:
    48
    Sorry to hijack this thread @Peter77 -
    Are the negative numbers in the "Saved by batching" just a display bug or does that really mean that there are more calls used than before batching?
    Because I have exactely that being displayed: negative numbers.

    Also: is there a good resource to get to know the frame debugger? The unity manual is a bit low on information. I am struggling to understand all that is happening there as a solo indie dev (as @educa seems as well).

    Thanks

    Alex

    Edit: The negative saved batchings seem to be an display error in unity (2019.4.15), since it is happening with primitives in a new project.. puh.
    The question about the frame debugger reading resources is still active ;)
     
    Last edited: Jan 5, 2021
  7. Ziplock9000

    Ziplock9000

    Joined:
    Jan 26, 2016
    Posts:
    360
    Ah I see. Yes it does not agree with the Frame debugger at all when it comes to batches and "Saved by batching"
     
  8. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    226
    I came accross a thread where one of the Unity people confirm that before 2020.3 the stats window is broken regarding the batches. Now when I switched to 2020.3 there is no negative number on batches saved but it always stays on 0.


    and in the frame debugger the draw calls are the same number as the objects in the scene even though they share the same material and are marked as static.

    Soo confusing.
     
  9. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    226
    iSinner, ExulIkari and reinfeldx like this.