Performance and size of NPOT texture in POT atlas?

Hi.
I’m starting developing my 5th Android game and this time I’m trying to make it as fast and small as possible.

Since atlases are always POT, are they always compressed?
And if Unity saves atlases - which are POT - and uses them (loading, compressing etc), do we get the same performance and size optimization as using a POT texture?
In other words, is there a difference in size and performance of (i) using POT textures and (ii) using NPOT textures but adding them to POT atlas)?

I believe that atlases (e.g: Sprite packer) are created based on the import settings of the textures assigned to each atlas.
If your source textures are all non-compressed (Truecolor) then the resulting atlas will have the same format.

Thank you so much for replying liortal! :slight_smile:

So let’s say all my sprites are NPOT. If I set the compression to ETC2 8 bits, Unity will say it can’t be compressed because it’s NPOT. But when I add them to an atlas, they WILL be compressed, right? And they will give the same performance as POT sprites?

Short answer, yes. Long answer… myeah

GPUs love POT textures, because if a texture is NPOT, it needs to be padded with “garbage” and an implicit offset needs to be used to acces the actual picture data. This is all done automagically by Unity, but is still a hit on performance. There is also the issue of compression, as you have said yourself.

Another issue is GPU stalling. if you have 500 different sprites, on 500 different textures, the GPU needs to grab one texture, draw it’s sprite (or several instances if they can be batched) then grab another texture and so on. The action of grabbing a texture is slow. While you are uploading graphic data to the GPU, it can’t really do much, and must wait for the texture to be loaded. By using an Atlas, you are sending (ideally) several sprites at the same time on the GPU. you then use offsets to find the data of each separate sprite, and draw them. So you would only do one (albeit massive) texture upload, and then draw 500 sprites, which is much more performant.

Atlas are not magical though. fi you need 30 pixels out of a 2048x2048 atlas, you actually lose performance. So you generally want to take that into consideration when packing an atlas.

Another advantage of an Atlas is putting a bunch of NPOT images together, into a POT one. That pesky 1025x1025 image would need 1023x1023 px of padding to become POT… but pack it with other smaller images and tadaaa you saved all that space.
I hope that answered your question. In short, POT good, NPOT bad, and Atlas… good or bad depending how well you use them.

2 Likes