Based on a bit of research, watching the Unite ’07 Performance Optimization talk and talking on the unity forums:
Each material on each mesh causes one draw-call per frame, per light that affects it and per camera that sees it.
If I have 1 mesh with 20 seperate textures, only ambient light, one camera, this will also result in 20 draw-calls. If I would combine the 20 textures into one atlas the scene would now only need a single draw-call.
If I have 20 meshes with one texture each, only ambient light, one camera, this will result in 20 draw-calls. If I would combine all the textures into one big atlas, the scene would still require 20 draw-calls, even though all the objects would now use the same texture.
The only way to optimize here would be to combine meshes. But you can only do that if your meshes aren’t to move around independently from each other.
3 Comments
Regarding light: the calculation is true only for pixel lights. Vertex lights are rendered in one draw call (vertex+ambient is rendered in one call as well).
Of course, some shaders might be more complex; i.e. some shader might have two passes (=two draw calls) no matter what is the lighting setup.
Also, realtime shadows complicate the calculation as well (one draw call for each shadow caster).
Basically this means that if you have 300 balls bouncing on the screen, that you can interact with them you’re screwed, and there is nothing to be done to reduce the number of drawcalls on the screen?
well, you could put them all in one mesh, add a bone to every single ball and move the bones around via script. I think someone on the unity-forum tried this and reported positive results…
About col000r
Markus HoferIndie Game Developer
Austria, Europe
GAMES
NEW ORBITAge of Curling
Speedlap Red
RECENT POSTS
anyonemost peopleMERCH