How does batching work?

Hey, I really don’t know where to post this, so please don’t get mad at me if this is the wrong place :).

So, I am trying to make a scene that stays consistent at about 50 - 70 draw calls. The scene is massive, so I figured the only way to do this was a limited render system with fog. So my 6000 draw call scene got reduced to about 20, no matter where you go or look.

Next, I needed a light. So I made a point light. Well, the draw calls jumped massively. Like up to 40. still ok though.

Finally, I needed to add rocks, plants, trees, enemies, etc. to my world. This is where I get VERY confused. So, from my basic understanding, meshes with the same material are able to be “batched” together, reducing draw calls. This works great with basic unity meshes, like cubs, spheres, capsules… However, when I use blender models, things get a bit strange.

Lets say I create a rock. Ok, my draw calls went up one, makes sense. Now I duplicate the rock, and my draw calls don’t go up, and it says one item batched. So that works. BUT, if I do so much as move the duplicated rock 0.0000000001 meters, then it is no longer batched. That makes no sense at all.

So, basically, how do I make 100 plants or rock batch together? And also, any ideas for how to reduce draw calls? Thanks :slight_smile:

Your pointlight does a pass on all visible objects in the scene, that is in its range. For each object the light hits it adds a drawcall basically. its not a massive jump at all, its standard :stuck_out_tongue:

One way to reduce your drawcalls dramatically is to create a lightmap of your scene! 100% worth looking into it in your case.

also a texture atlas will reduce drawcalls and speed up performance.

What you will want for your rocks and plants (objects that will never move and are static) is static batching, look at the link above to see how it is done, it also gives a bit of info on both static and dynamic batching.

By the way dynamic batching is a PRO ONLY FEATURE. so if you dont have UNITY PRO you cant batch objects that move.

50-70 drawcalls is low, you can go higher with that if your aiming at mainstream mobile devices such as the iphone 5’s and such. I think the iphone 4 had to be below about 70-ish to run efficiently so thats probably what your aiming at then.
This is a good link, this goes over the optimisation for the game MAX AXE for the iphone 4. It should help a bit if your looking into that field :slight_smile: http://www.joshuaglazer.com/blog/optimizing-draw-batching-in-max-axe-for-older-mobile-devices-in-unity3d/

Last I looked dynamic batching was in free, static is only pro.

1 Like

@ThermalFusion Thanks yeah that’s correct, I mixed them up in the post :face_with_spiral_eyes:

@sam268 also change the pixel error in the terrain settings, this can also dramatically increase performance if you have a large terrain, or just need those few extra drawcalls

Ahh ok thanks, that is a lot of good ideas. And ya I have free, so I guess I can’t use static batching :(. But that shouldnt matter too much as long as I can keep my draw calls below 70ish with these other pointers. Thanks guys!

P.S. I am developing for android, so I have discovered 70 draw calls is the maximum I can go on lower end devices.