Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question SRP Batcher & SpriteRenderer

Discussion in 'Graphics Dev Blitz Day 2023 - Q&A' started by peturdarri, May 25, 2023.

  1. peturdarri

    peturdarri

    Joined:
    Mar 19, 2016
    Posts:
    23
    The last time I tried migrating a project from the built-in render pipeline to URP about 6 months ago, I noticed that SpriteRenderers were contributing to way more draw calls than before. Upon closer inspection, it appeared to be related to SRP Batcher: it simply didn't support batching SpriteRenderers and refused to use dynamic batching to combine them.

    I've found this comment from 2019 where Arnaud said that SPR Batcher doesn't support SpriteRenderers, but they may look into it later. It seems this hasn't changed since then.

    Are there any plans to support SpriteRenderers in SRP Batcher? I only ask that it uses dynamic batching the same way the built-in RP does. SpriteRenderer is very useful in 3D and VR for drawing flat elements in world space without the overhead of a world-space Canvas and with better batching (when it works) and workflow when compared to MeshRenderer quads.
     
  2. arnaud-carre

    arnaud-carre

    Unity Technologies

    Joined:
    Jun 23, 2016
    Posts:
    99
    Hi!

    SRP Batcher 2D sprites support have been added in Unity 2023.1
     
  3. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    217
    Would SRP Batcher batch two SpriteRenderers with the same material but Sprites from different Atlases?
     
  4. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    Yes, it should. Do let us know if it is not the case!

    Here is a quick test of two different characters, Knight and Skeleton, with each using their own SpriteAtlas using the Sprite-Lit-Default material without 2D animation deformation for 2023.1.3f1.

    upload_2023-6-22_10-57-21.png
     
    Revolter likes this.
  5. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    217
    That's amazing, but kinda makes all my knowledge about optimizing draw calls obsolete now. Would there be some update to the documentation about optimizing draw calls/performance with SRP?
     
  6. Venkify

    Venkify

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    649
    For sprites with dense mesh or skinned, SRP-Batcher usually results in better performance as SRP-Batcher.

    For sprites that are full rect (quads) or with very few vertices, Dynamic-batching (disabling SRP-Batcher or disabling SRP-Batcher with a custom shader) is preferable.
     
    Silvestor likes this.