Draw Calls

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.

Bookmark the permalink. Follow any comments here with the RSS feed for this post. Trackbacks are closed, but you can post a comment.


    Aras Pranckevicius on November 6, 2008 at 13:48 | Permalink

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

    Rodrigo Chips Scharnberg on March 13, 2009 at 21:06 | Permalink

    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?

    col000r on May 27, 2009 at 11:02 | Permalink

    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…

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>