Drawcalls

From The DarkMod Wiki
Jump to: navigation, search

Introduction

The engine draws the things you see on the screen in batches and such a batch is called a drawcall.

The time a drawcall takes consists of two parts:

  1. a static overhead, that is always the same no matter how many things get drawn
  2. a dynamic part that depends on how many things there are to draw

One basic thing is that each model in idTech4 gets drawn once per light that hits that model. And each of these draws of the model is split into drawcalls for each material.

So if you have a model with two different materials that is hit by 3 lights, the entire model is drawn 3 times, and the engine uses 2 * 3 = 6 drawcalls to do so.

How much drawcalls are "good"?

Thsi number depends highly on the system and the performance you want to achive. In the past the limit to shoot for was about 300..500 drawcalls, but machines from today can easily handle 1000 drawcalls.

But generally spoken, the less drawcalls you have, the better.

How to reduce drawcalls of your scene

  1. If you are making models: Reduce the number of different materials a model uses by using a texture atlas.
  2. Combine multiple func_statics made from map geometry (brushes/patches) into one.
  3. Use the SEED system to combine multiple models in one scene.
  4. If you are using models, by using less different skins. (this only reduces the texture usage, not the drawcalls, unless you use the SEED system, see above, where it also reduces the number of entities and thus the drawcalls)

Note: To test drawcalls in-game use r_showPrimitives to print to console.

As a last resort you can also reduce the complexity of your scene by removing unnecessary models or replacing far-away detail brushes by decals.

See also