Search Unity

Question Batching divided

Discussion in 'General Graphics' started by HugPila, Jan 13, 2023.

  1. HugPila

    HugPila

    Joined:
    Jun 26, 2019
    Posts:
    11
    Hi! I am trying to figure out and benefit from instancing in order to batch my draw calls and gain performance.
    I have a scene with 100 torsos and 100 legs. All torsos sharing one material and all legs sharing another, both with GPU instancing enabled.
    If I render just 100 torsos, they all group in 1 draw call. Same for the legs.
    But when rendering both for some unknown-to-me reason, it divides the batching in:
    - some bodies
    - some legs
    - some more bodies
    - some more legs
    Making 4 draw calls instead of 1.
    I think is due to the cameras position and the depth passes. Because when I do it with the camera form the top, it batches them fine (like 100 bodies, 100 legs).
    What is the reason for this, and how can I fix it to group them all independently of the cameras position?
    Thank you. upload_2023-1-13_21-22-29.png upload_2023-1-13_21-22-29.png
     
  2. joshuacwilde

    joshuacwilde

    Joined:
    Feb 4, 2018
    Posts:
    731
  3. HugPila

    HugPila

    Joined:
    Jun 26, 2019
    Posts:
    11
    Thank you! Changing the render queues of the material worked having now all RenderForward grouped (4 calls).
    Nevertheless, the DepthPassJobs are still the same. Are those unavoidable?

    (in the picture below I have also helmets and head objects, thus 4 calls and not 2)
    upload_2023-1-16_13-49-38.png