Hello everyone,
I was not sure whether to post a new topic here or in the apposit graphics session, but is a more logical issue then technical.
I'm developing my own engine for a 2D isometric game.
In the game I've 2 layers for rendering
- first layer is static (like floor, walls etc...), there's no interaction and no depth sorting needed. So it will be a simple VertexArray, with inside all tiles positions and texCoords
- second layer is interactive and will contains movable and all type of objects that can change drawing order based on their positions.
My doubts incur with second layer. My idea was to use sprites instead of VertexArray, because in this case I can create mores instance with the same sprite and different transformations. But in my case this is not so simple, because many of my objects are not a single image, but a chunk of tiles (base tile is 16x16px). Here the problem comes with depth sorting. Using a VertexArray allows me to sort all tiles render order and push all vertices inside the VertexArray without groing crazy (and I don't even have to think about how to solve the depth sorting problem for convex figures), but unfortunately I cannot do instancing. If I need to render 100 trees for example, I need to push 100xN vertices inside the array, instead of using one with 100 different transformations.
In a nutshell:
Using VertexArray for all interactive objects and actors (even player and npcs)
PROS:
- depth management is much simpler
- only 1 draw call
CONS:
- For each instance of my abstract entity, I need to upload vertices and texCoords to GPU
Using chunk of sprites (or small VertexArrays) for each interactive objects and actors (even player and npcs)
PROS:
- I can upload only one sprite/va per instance and using transformations
CONS:
- more difficult to determine whether a VertexArray must be rendererd before or after another one
- objects with convex shapes must be "sliced" in simpler objects
From this consideration I'm more likely for the first solution, but I don't want to overload the GPU too much and lose the possibility of instancing.
Do you have any advice for an hybrid solution? Split convex objects is not a problem, but understand how to compare different instances of same va/sprite chunk and above all understand if this approach could cause slowdowns.
Thanks so much
Ray