Noob Thread: Draw Calls?

Okay, so, i’ve been a busy bee making a game and i stumbled on the whole “Draw calls” thing and i’m not sure about it… i can gather the basic elements of it (i’m assuming that it’s the number of times per frame that something happens) but i don’t know what a good target is… though i do understand that that’d be different for whichever platform one is developing for so i understand that what a good number of draw calls for one machine is will not be the same for a different one.

So, for example, the scene that i’m looking at (my “workshop” level where i put stuff together and test) has two enemies running an AI system i’ve built, about 36 “skill orbs” (basic circles that when picked up give the player skill points to spend on abilities) and some cubes to run around on (and run into since some are walls.) and the number of draw calls is sitting around 70-80… since this is in the “Greybox” phase, there isn’t much in the way of finalized models and textures nor a fancy-schmancy GUI.

is this a good number or would this present possible problems? before i was only really going on the FPS but i’ve read and heard “draw calls” in many places and am not sure what this fully means.

for a computer that’s classed as “midrange” based on today’s tech levels, what would you think is the upper limit i should try and avoid hitting? do you have any suggestions on how to keep that number lower?

yes, this is titled “noob thread” for this very reason because it seems to be a very basic question that a noob would ask. (i am not ashamed to admit i am a noob also.)

A draw call is when the CPU sends geometry data to the GPU with a request that it be drawn to the screen. Each draw call, therefore, is taking resources from both the CPU and GPU, so you want to keep them down as much as you can.

I believe about 1,000 draw calls as an upper limit is a good rule of thumb for a desktop system.

As far as reducing calls goes, keep your dynamic lights down to a reasonable number (every light that hits an object requires that object to be redrawn, so if four lights are hitting a wall, that wall will be drawn 5 times). Take advantage of batching (which means you should use texture atlases and try to make sure objects that are near each other are using the same material). Combine meshes where you can (e.g. combine static geometry on a “per room” basis, and give them all the same material).

Lightmapping will reduce draw calls by reducing the number of active lights in your scene. Occlusion culling will reduce draw calls by eliminating geometry that can’t be seen by the camera in the first place. You should use both to further reduce your draw calls.

Thank you very much! that helps a great deal!

knowing this now, i think i can say that 70-80 draw calls at this point is well within acceptable levels :stuck_out_tongue:

Great info, RonHiler. Thanks :slight_smile:

Sure, no prob. Just remember, 1,000 is just a general rule of thumb. You may need to go up or down depending on other factors (how heavy your scripts are for example). As always, it depends on your project.

Somebody linked this for me not too long ago, and I recommend watching it, its full of great info on scene optimizations. It’s a few years old, but the information is still very relevant:

http://unity3d.com/unite/archive/2007

Grab the second video (Performance Optimization).