4
\$\begingroup\$

I'm duplicating one object with submeshes frequently, and assigning a random material from five materials to each submesh. There is batching happening, but it's not quite as efficient as I would have expected (details here). Note objects are all less 900 vertices no light maps and ... All are dynamic batching ready

So if dynamic batching works there must be only 5 draw calls right but there isn't there is really much more than 5

\$\endgroup\$
1
\$\begingroup\$

In dynamic batching the 900 is that ultimate limit for 1 batch. It means that if you have a mesh with 900 vertices, it will fill a full batch and the next item will create a new batch!

For dynamic batching, Unity has to merge all of your vertices and create a new VBO every single frame. So even if it decreases your number of batches, it may still use a lot of CPU time to create those batches.

By the way, it's not 900 vertices, it's 900 "vertex attributes": http://docs.unity3d.com/Manual/DrawCallBatching.html

"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."

\$\endgroup\$
  • \$\begingroup\$ I know my mesh is 150 vertices and 300 with normal and ... I meant in total it is still beaneth 900 \$\endgroup\$ – Milad Qasemi Apr 2 '15 at 19:00
  • \$\begingroup\$ Then it will batch every 3 objects together. Is it worse than that? There is also some weird limitations to scale of your objects. Uniformly and non-uniformly scaled objects won't get batched together. Shadows and every extra light also creates new batches, and as far as I know, in shadow pass there will be no dynamic batching! \$\endgroup\$ – Mahdi Jeddi Apr 3 '15 at 20:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.