I have a test scene with a plane and 500 low poly objects.
Without any batching I get 501 draw calls and Profiler shows RenderOpaqueGeometry taking an average of 1.8ms.
I then use batching and get 4 draw calls and 500 batched but now the Profiler shows RenderOpaqueGeometry taking an average of 3.25ms.
Same count in Tris: 22K and 48K verts.
What am I missing here? I thought batching would have resulted in better performance…
P.S. Did same test with 2000 objects and got 2001 draw calls = 7.87ms vs. 11 draw calls + 2000 batched = 12.78ms.
which kind of batching are we talking here ?
unitys dynamic batching < unitys static batching < combine children script < merging geom in max/maya
Dynamic batching.
In these cases, using batching results in about 40% decreased performance. I thought it would improve things.
Using 512 cubes gives me 2.5ms without dynamic batching, and 1.6ms with dynamic batching.
–Eric
I redid the tests with new geometry.
Using Unity’s Cubes and instantiating 500 of them in random locations on a plane yielded 1.4ms. The same 500 cubes without batching 1.5ms. So in this case batching 2 draw calls and 500 batched was marginally better.
Interestingly, I did the same test with a 27 sided dice (FBX from Max) 96 verts / 44 tris and this time got 3ms batched (4 draw calls and 500 batched) vs. about 1.4ms not batched.
So what gives?
void Start ()
{
for (int i = 0; i < Quantity; i++)
{
Transform go = Instantiate(Prefab, new Vector3 (Random.Range(-50f, 50f), 1.0f, Random.Range (-50f,50f)), Quaternion.identity) as Transform;
// Material myMaterial = go.renderer.material;
}
}
The geometry being used definitely impacts these results. I create a simple 3X3 cube in Max (96 verts / 108 tris) and it too yields worst performance when batched vs non batching.
500 (1m) cubes (3X3 subdivision) 96 verts / 108 tris, 4 draw calls + 500 batched = 3.0ms
Same object no dynamic batching, 501 draw calls = 1.45ms
Other than when using Unity’s Cube, Dynamic batching yields half the performance of non batching… which seems backwards
What am I missing here?
Are these results unique to my setup or can anyone else confirm?
Based on these results, Dynamic batching with any object other than a basic cube is half the speed of non batching. ie. Batching equals bad right now… is this a bug or something.