Can someone explain to me why non-uniform scaled objects can be batched and uniform scaled objects can’t? See quote below. This makes it sound like it is better to have non-uniform scale on your objects, but this other page makes it sound like scaling should be avoided all together :http://docs.unity3d.com/Documentation/Components/class-Transform.html
Dynamic Batching
(http://docs.unity3d.com/Documentation/Manual/DrawCallBatching.html)
Generally, objects should be using the
same transform scale. The exception is
non-uniform scaled objects; if several
objects all have different non-uniform
scale then they can still be batched.
I build most of the objects in my game out of cube primitives that I’ve scaled to different sizes. They seem to batch fine and performance is pretty good. Is there something I should be looking out for?
I believe this might have something to do with how unity handles non-uniform scales: It duplicates the mesh with baked in scale - so from the rendering perspective, they are not scaled at all. This adds some overhead which would be unacceptable just for dynamic batching alone (for uniform scales) but since the overhead of generating mesh is already there, the engine can cheaply do the batching.
Try to apply some kind of “vertex position to color” shader and do uniform then non-uniform scaling and you will see what happens.
Also quote form manual
Batching dynamic objects has certain overhead per vertex, so batching is applied only to meshes containing less than 900 vertex attributes in total.
If your shader is using Vertex Position, Normal and single UV, then you can batch up to 300 verts; whereas if your shader is using Vertex Position, Normal, UV0, UV1 and Tangent, then only 180 verts.
Sorry to necro this but I thought it was important. I did do some testing and the documentation is correct. If you have several objects and they all use the same material and have non-uniform scale (meaning they are longer than they are wide) they will batch together. You’ll get one draw call and everything else will be batched.
You can add as many oddly shaped boxes as you want and they will all be batched together even if their dimensions are totally different . But add one regular cube into the mix that is the same on all sides and it will not be batched with the others.
This was a big help to me. I went through some of my game objects and found a few of them that were taking 4-5 draw calls. I found that they included a few 1x1x1 cubes. I changed those cubes to 1x1x1.1 and just like that I went down to one draw call.