So I'm using Love2D which uses SDL2* as far as I'm aware and I have a question about texture atlases & spritebatching.

I have an isometric chunk, with 2 layers, terrain and objects (trees, buildings, units). The terrain is not animated and the tiles are 32x16, they fit perfectly even in a 1028x1028 texture atlas.

However the object spritebatch\layer is a different thing. I have trees, that are animated and each frame uses up to 200x200 space in the atlas. You can see the problem. Now, I think I can fit all of it in a 8192x8192 texture and this is OK for my GPU, which is entry level (GT 720). It gets stored in the VRAM.
So I conducted some test and imported a 10k x 10k image, the GPU could not handle it, and it was loaded onto the RAM. What exactly happens here? How much is the performance loss, I'm about to test, but is this going to cause any incompatibility problems? Other than the 300MB RAM usage instead of VRAM.

Now, you might state the obvious, "Why not use 2 or more texture atlases?".
I don't know if I'm doing things wrong, but I want to use sprite batches for the object layer, and the way I'm drawing it is this:

function update_objects()
  for i=0,chunk_width-1,1 do
    for o=0,chunk_height-1,1 do
                        (i - o) * tile_width  * 0.5,
                        (i + o) * tile_height * 0.5 
                        - tile_offset[objects_chunk[i][o]]);

In order to deal with the depth issue that isometric games have, I simply draw furthest to closest. As far as I'm aware, sprite batches can only use 1 texture atlas, and I confirmed that by tests.
Of course, there's a draw call that draws the sprite batch. I'm ok with several draw calls (units, buildings, environment in 3 separate batches for example), but I don't see how I will deal with the depth issue if I do go that way.

*(not OpenGL as I previously stated)

Any ideas?

| improve this question | | | | |
  • \$\begingroup\$ Well, 10k*10k image stored in a raw format takes up around 400MB, which is much less than the usual 2-4GB. Try checking what the max image size is \$\endgroup\$ – Bálint Aug 14 '17 at 9:36
  • \$\begingroup\$ If per-fragment parts of the pipeline need to drop to software emulation you can typically expect performance of less than 1 fps; yes, that expensive GPU actually does do quite a lot of work to make things run fast. \$\endgroup\$ – Maximus Minimus Aug 14 '17 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.