Search Unity

Static Batching Worse Performance

Discussion in 'General Graphics' started by Ceylan12, Dec 9, 2020.

  1. Ceylan12

    Ceylan12

    Joined:
    Dec 24, 2016
    Posts:
    113
    I have a big scene. Static batching decrease draw call but I tested performance of batching at Android phone.
    With Batching: 30-34
    Without Batching: 40-42
    What can cause it? Should I dont use it at this game? Can it be related with this spesific test phone (Mi 5X)
     
  2. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    Static batching is not a silver bullet. It depends on the context wether or not you should use it. It generally is a good solution, but there can be certain situations when it's not quite applicable. Sometimes, if you want to draw a massive field of grass, for example, it may be better to use instancing or populate geometry manually via special shaders or per-tile on the CPU. Alternatively, static batching can perform quite bad if you want to crank as much geometry as possible into it with a special shader that does alpha-testing (and that one leads to performance issues with Z-Test).

    You're probably facing a situation when it's indeed not quite applicable.
     
    Ceylan12 likes this.
  3. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    What is in the scene? Lots of grass, bushes, trees?
     
  4. Ceylan12

    Ceylan12

    Joined:
    Dec 24, 2016
    Posts:
    113
    There are lots of buildings also there a lot of repeating mesh. No grass, bushes. There is tree but it is low poly and mesh.
     
  5. Kolyasisan

    Kolyasisan

    Joined:
    Feb 2, 2015
    Posts:
    397
    That is a concern for wether or not you are CPU bound. Unity's Static Batching, althogh helps CPU in the draw calls department on the render thread, does not help the CPU on the main thread where some operations are performed synchronously with wide jobs, so stuff like bound updates and culling are still performed per-renderer. Your performance could've dropped there.

    I suggest you to profile the game and compare your results (batching vs no batching) using Profile Analyzer.
     
    Ceylan12 likes this.
  6. BrandyStarbrite

    BrandyStarbrite

    Joined:
    Aug 4, 2013
    Posts:
    2,076
    Okay. Is it possible to show a wide screenshot of the scene, with the buildings and stuff in it?
     
  7. Ceylan12

    Ceylan12

    Joined:
    Dec 24, 2016
    Posts:
    113
    Of course, https://ibb.co/d7ZdYMK