Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Dynamic batching is behaving odd

Discussion in 'General Graphics' started by BakeMyCake, Feb 4, 2019.

  1. BakeMyCake

    BakeMyCake

    Joined:
    May 8, 2017
    Posts:
    157
    People, I am confused.
    What does it mean in the frame debugger when you get unexpected extra events without an explanation as to why dynamic batching didn't mop them up?
    upload_2019-2-4_21-35-5.png
    As you can see from the image I have some straggler models not being drawn with the rest and it doesn't provide any info. They all share the same material but none of them offer a reason why they aren't batched.

    Should I interpret this as an indication that a batch reached it's maximum combined size? My scene is 5k vertices total shouldn't it fit into one batch? If the scene didn't fit into one batch shouldn't the rest be drawn in the second batch instead of being drawn separately, or does batching stop after the first batch is filled?

    What is quite strange is that I have 3 materials - a material for vertex-lit meshes, a material for unlit particles and a material for transparent effects. And they seem to batch together which makes no sense according to documentation. Shouldn't this break batching?
     
    Shorely likes this.
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,729
    This might be a side effect of particles currently being missing in the frame debugger. We have a fix coming very soon for it in 2018.3.. what version are you on?
     
    Shorely likes this.
  3. BakeMyCake

    BakeMyCake

    Joined:
    May 8, 2017
    Posts:
    157
    I'm on 2018.3.
    From my observations there are specific cases where if objects happen to align well everything batches together. Literally the frame debugger shows the entire scene(excluding post processing) with particles and transparent objects being rendered in the clear event. But most times some meshes end up left out of the batch. There might be good reasons for it, I just want to understand the system better.

    I still haven't got a clue how batching manages to draw transparent effects and opaque geometry at once. Or maybe it doesn't, but it makes it look that way?
     
    Shorely likes this.
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    1,729
    Yeah this bit sounds like the bug we are soon releasing a fix for. I think it could be causing the other side-effects you describe too, making the whole thing look quite confusing. I recommend rechecking it when this bugfix lands: https://issuetracker.unity3d.com/issues/frame-debugger-not-showing-draw-calls-from-particle-systems

    I am hoping it gets approved for 2018.3.6 or 2018.3.7 at the latest.
     
unityunity