Learning on Web Dev Open is free for all.

Immersive Web > Geometry, assets, and not shipping 40MBDraw calls, merging, and the batching tradeoff
Phase 07Geometry, assets, and not shipping 40MB348 of 434

Draw calls, merging, and the batching tradeoff

Fewer, larger batches are faster until they defeat culling and you are drawing the whole city to show one street.

Concept13 minAI pair

Each draw call carries fixed overhead: state validation, uniform uploads, driver work. On desktop a few thousand is survivable; on a mid-range phone a few hundred is the honest ceiling. Merging static geometry that shares a material collapses many calls into one, and instancing does the same for many copies of one thing.

The tradeoff is culling. The renderer skips objects outside the camera frustum, and it can only do that per drawable: merge a whole environment into one buffer and it becomes all-or-nothing, so you draw every triangle even when the camera is looking at a wall. The workable answer is usually spatial: merge in chunks that are roughly the size of what fits on screen, so culling still has something to work with.

You should now be able to

  • Count the draw calls in a scene and set a target
  • Choose between merging, instancing and leaving it alone
Ask the community

Loading…