Beast lightmapping and draw calls


We’re currently trying to optimize the performance of our game, and we noticed some strange (to us) draw call increase with beast lightmapping.

Here is what we’ve tried:

starting with a new clean scene we place 1 unity cube with 1 material a 1000 times in a grid

camera has all these cubes in view and all are marked static

there a 0 lights in the scene and the pixel lights counts in the quality settings is set to 0

the total vertex count is 24.0k.

  • without lightmapping this it results
    in 2 draw calls

  • after a beast bake (texel res = 2: resulting in 1: 1k
    lightmap) this still gives 2 draw

  • after a beast bake with texel res = 22 resulting in 2: 1k lightmaps this gives 441 draw calls.

Can anyone tell me why this is happening?

Thanks a lot!


I’ve edited the above results with using only cubes created in Unity, before i was using a model from my game.
which as dreamora describes can give different results


When I look at the combined mesh it seems as if it is broken up into 1 or two pieces, i would realy like to know how the batch decides it has to have 441 draw calls instead if the sub 10 I’d expect. It makes no sense to me.

Update 2:
I’ve filed a bug report and a developer is looking into it, will update if the problem is resolved.

Final Update:
I’ve learned that his bug will probably not be resolved anytime soon (not before the next update, if then even)
But Because we are not supporting iPhone 3g and below anyway we found a workaround in using just one 2k lightmap.
This resolution supports our specific needs. And with only 1 lightmap the batching doesn’t break.

Thats because of the light. each object hit by a pixel light is redrawn for the pixel light, on its own, as such it will give a +1 to the drawcalls.

Additionally different lightmaps on the game objects also means different drawcalls, which explains the difference between the 458 and 716

the delta on the maya vs unity is likely caused by the number of vertices in them which requires more drawcalls to handle the unity cubes vs the maya ones. I assume that your maya cube merged the vertices on the corner, not distinct ones