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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

URP batching

Discussion in 'Universal Render Pipeline' started by JonasRara, Mar 14, 2022.

  1. JonasRara

    JonasRara

    Joined:
    Jul 3, 2021
    Posts:
    4


    I'm using an empty new URP (package version 12.1.4) project in Unity 2021.2.13f1. I'm spawning 10,000 cubes with the same material (URP/Lit). I'm trying to profile the rendering.

    First thing to note is that in URP enabling GPU instancing on the material has no effect on rendering. Neither CPU time nor render thread time change at all.

    On the built-in render pipeline the effect used to be dramatic. Both the CPU and render thread time got cut in half. Batches went from 20,000 to just 41.

    With URP that doesn't seem to be the case anymore, and if I understand correctly that is because of the SRP batcher. If I turn the SRP batcher off in the URP settings asset, then enabling GPU instancing has a similar effect to what it used to have. Batches go down from 20,000 to 88. CPU and render thread times go down, albeit not as much as before.



    I tried to profile the SRP batcher, but none of the batching numbers in the Rendering module of the Profiler window make any sense. I grabbed the SPRBatcherProfiler from GitHub but it reports all zero when the SRP batcher is enabled. Hilariously it reports non-zero on the Standard code path when the SRP batcher is disabled.

    What is going on?
    How does batching work in URP?
    How to profile batching in URP?
     
    ghostitos and elias_t like this.
  2. JonasRara

    JonasRara

    Joined:
    Jul 3, 2021
    Posts:
    4
    ghostitos and alexeyzakharov like this.
  3. alexeyzakharov

    alexeyzakharov

    Unity Technologies

    Joined:
    Jul 2, 2014
    Posts:
    507
    Thanks for investigating the batching stats @JonasRara !
    Could you please file a bug and reference it in this thread :)
     
  4. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    681
    SRP batcher, gpu instancing, and static batching each have their own benefits and downsides. We found that for stuff like grass, it makes a lot more sense to just manually mesh combine things into big groups and let the SRP batcher work on top of that. We were having issues with the internal srp batcher's cbuffer growing to enormous sizes haha. But after keeping the actual object count low we got really nice performance on quest 2 with tons of foliage.
     
  5. imranmohsin

    imranmohsin

    Joined:
    Jan 13, 2017
    Posts:
    1
    I'm also using URP in Unity 2019 LTS and Unity 2021.1.28. Tested on both.
    URP is made for faster performance but im not getting better performance then Build-in rendering pipeline.

    Issue 01:
    After switch to URP
    i got 3000+ warning ⚠️ for overlapping UVS.

    Issue 02:
    In URP im getting 30fps on editor and 26fps on mobile And 1 batching.
    SRP batching On
    GPU instancing On
    Static batching On
    All baked scene


    In Build-in rendering pipeline i getting 40 to 60+fps and 900 to 3000 batching.

    My Scene:
    I made building using same cube mesh + same material.


    I spend 2 days to convert project to urp and now i see performance.
    Im switching back build-in rendering pipeline.
    I tested in editor + Android.
     
    bajja and tmonestudio like this.