- Home /
The problem is a bug in unity
Beast lightmapping and draw calls
Hey!
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 calls.
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!
Edit:
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
Update:
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.
Answer by Dreamora · Aug 05, 2011 at 11:36 PM
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
Hey! Thanks for the answer! But I'm just using the light for baking, my quality settings are set to fastest with 0 pixel lights. Are they still working on some level? I'll try deleting them to see what happens.
Just tried deleting the light in the test scene after the bake and before the bake in both cases the draw calls stay 360.
(still only two lightmaps which seems weird on its own as yesterday I had 458 draw calls in the same scene with the same amount of lightmaps)
indeed change of drawcalls should not happen with exactly the same amount of data. unless one thing in the level was a terrain, then it potentially could change depending on the view
I've re-tested with just using Unity cubes: no terrain; nothing, but unity cubes. I'm even baking without light. any ideas?
ONLINE STORE :
====( http://popbuynow.com/ )=====
The website wholesale for many kinds of fashion shoes, like the nike,jordan,prada,, also including the jeans,shirts,bags,hat and the decorations. All the products are free shipping, and the the price is competitive, and also can accept the paypal payment.,after the payment, can ship within short time.
free shipping
competitive price
any size available
accept the paypal
jordan shoes $32
nike shox $32
Christan Audigier bikini $23
Ed Hardy Bikini $23
Smful short_t-shirt_woman $15
ed hardy short_tank_woman $16
Sandal $32
christian louboutin $80
Sunglass $15
COACH_Necklace $27
handbag $33
AF tank woman $17
puma slipper woman $30
====( http://popbuynow.com/ )=====