How can state changes be batched while adhering to opaque-front-to-back/alpha-blended-back-to-front?
Posted
by
Sion Sheevok
on Game Development
See other posts from Game Development
or by Sion Sheevok
Published on 2011-03-01T08:37:57Z
Indexed on
2011/03/01
15:33 UTC
Read the original article
Hit count: 236
This is a question I've never been able to find the answer to. Batching objects with similar states is a major performance gain when rendering many objects. However, I've been learned various rules when drawing objects in the game world.
- Draw all opaque objects, front-to-back.
- Draw all alpha-blended objects, back-to-front.
Some of the major parameters to batch by, as I understand it, are textures, vertex buffers, and index buffers. It seems that, as long as you are adhering to the above two rules, there's little to be done in regards to batching.
I see one possibility to batch, while still adhering to the above two rules. Opaque objects can still be drawn out of depth-order, because drawing them front-to-back is merely a fillrate optimization, meanwhile state changes may very well be far more expensive than the overdraw of drawing out of depth-order. However, non-opaque objects, those that require alpha-blending at least, must be drawn back-to-front in order to avoid rendering artifacts.
Is the loss of the fillrate optimization for opaques worth the state batching optimization?
© Game Development or respective owner