Search Unity

Setpass calls vs Drawcalls

Discussion in 'General Graphics' started by IgniteAVteam, Dec 15, 2017.

  1. IgniteAVteam

    IgniteAVteam

    Joined:
    Nov 26, 2013
    Posts:
    3
    What is the difference between set pass calls and draw calls.

    In the attachment, values are different for set pass calls and draw calls.
     

    Attached Files:

  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    SetPass refers to the material setup, and DrawCalls refer to each item submitted for rendering.

    When batching is enabled, Unity can perform a single SetPass call, and then submit multiple draw calls, re-using the same material state.
     
  3. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    Thanks for explaining that.
     
    richardkettlewell likes this.
  4. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    Oh hey. Could you help this guy out. He needs some help here.
    And unfortunately, I'm not an expert on networking. :p
    https://forum.unity.com/threads/game-crashes-out-of-gpu-memory.527805/#post-3472190


    And this poor guy too: https://forum.unity.com/threads/i-have-some-trouble-in-developing-a-music-game.512206/#post-3459055

    Thanks.
     
    Last edited: Apr 24, 2018
  5. Kvano

    Kvano

    Joined:
    Jan 15, 2015
    Posts:
    1
    Are you sure regarding this? I thought that Dynamic batching reduces Draw Calls, not Set Passes. It just combines multiple small meshes into one and performs a single Draw Call on it. This means that even in the case when batching is disabled Unity still "can perform a single SetPass call, and then submit multiple draw calls, re-using the same material state".
     
  6. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,342
    Dynamic batching does indeed merge several meshes into a single mesh, resulting in a single set pass and draw call per batch. Though dynamic batching may split up groups of meshes with the same material and not draw them as all a single mesh depending on things like lighting or sorting order requirements that prevent batching. This is why you might have a scene with several low poly meshes all using the same material that could get batched into a single dynamic batch, and still see more than one batch.

    Static batching also merges several meshes into a single mesh, but still renders each game object as a separate draw call by rendering only a range of vertices at a time. This allows for culling and toggling of mesh renderer visibility.
     
    jonkelling and iSinner like this.