Z-order with Alpha blending in a 3D world
Posted
by
user41765
on Game Development
See other posts from Game Development
or by user41765
Published on 2014-02-04T11:17:18Z
Indexed on
2014/06/04
21:46 UTC
Read the original article
Hit count: 323
I'm working on a game in a 3D world with 2D sprites only (like Don't Starve game). (OpenGL ES2 with C++)
Currently, I'm ordering elements back to front before drawing them without batch (so 1 element = 1 drawcall). I would like to implement batching in my framework to decrease draw calls.
Here is what I've got for the moment:
- Order all elements of my scene back to front.
- Send order list of elements to the Renderer.
Renderer look in his batch manager if a batch exist for the given element with his Material.
- Batch didn't exist: create a new one.
- Batch exist for element with this Material: Add sprite to the batch.
Compute big mesh with all sprite for each batch (1 material type = 1 batch).
When all batches are ok, the batch manager compute draw commands for the renderer.
Renderer process draw commands (bind shader, bind textures, bind buffers, draw element)
Image with my problem here: Explication here
But I've got some problems because objects can be behind another objects inside another batch.
How can I do something like that?
Thanks!
© Game Development or respective owner