Search Unity

Dynamic Batching not working while mixing objects under 300 and over verts with the same material.

Discussion in 'General Graphics' started by EiknarF, Dec 18, 2020.

  1. EiknarF

    EiknarF

    Joined:
    Apr 28, 2011
    Posts:
    142
    I was wondering anyone could help me understand what's happening.

    I've got a scene with objects (cubes) under 300 verts. They all dynamically batch fine.
    upload_2020-12-18_17-0-58.png

    The scene also has objects (spheres) with a vert count over 300 and a different material, as expected they don't dynamic batch. However the cubes still remain as one batch.
    upload_2020-12-18_17-2-25.png

    However when I assign the cubes and the objects the same material, the batching breaks down. The spheres are still individual (as expected) but there are now several occurrences of "Draw Dynamic" each containing several groups of cubes.

    upload_2020-12-18_17-8-45.png

    Any ideas how I can get all the cubes batching?
     
  2. EiknarF

    EiknarF

    Joined:
    Apr 28, 2011
    Posts:
    142
    Sorry for the bump but wondering if anyone has any ideas. Could it be a bug?
     
  3. AlexTorbin

    AlexTorbin

    Joined:
    Dec 12, 2019
    Posts:
    48
    Just guessing, maybe its related to drawing order of objects in the same material pass? Seems like it doesn't analyze the entire scene before batching, but simply draws objects one by one. And if the object can be batched, it is added to the batch, and if not, then the batch breaks. Boxes and spheres in your scene have about the same depth, so probably they drawn in somewhat random order. Try to move spheres behind the boxes, a few units away from camera, and see what happens.
     
    Last edited: Dec 22, 2020
  4. EiknarF

    EiknarF

    Joined:
    Apr 28, 2011
    Posts:
    142
    Thanks for the reply. It must be that as you were right, it depends on the distance to camera.
    I'm going to go ahead and assign a different material to the objects <300 verts to help.