Use large image individually, or in TextureAtlas?

| | August 18, 2015

Does it make any sense to include a large image (with dimensions of say 1920×1080) in a TextureAtlas and then use it with libgdx for example?

Or should I rather use it individually and include the .png file into the assets folder as it is?

Thank you.

2 Responses to “Use large image individually, or in TextureAtlas?”

  1. Use it individually. Texture atlases are used to gain efficiency by minimising texture swaps for many small textures, and avoiding wastage due to textures having to be bumped up in size to dimensions that are a power-of-two. A single image on an atlas gains you nothing except more book-keeping, and if the atlases are required to be power-of-two in size, your example image would need to be 2048×2048. That’s a lot of wasted space.

    The original tags included Android, which brings some extra factors to the discussion:

    A 1920 x 1080 image will most likely need to be compressed to work on Android anyway, which comes with a need for power-of-two sizing. PNG is not a native format, so any PNG images will have to be converted and probably compressed before use. So even storing and using it individually, for loading and rendering it will be bumped up to 2048×2048 before it’s compressed. You could use it at its native resolution uncompressed, but it would be massive in memory, and you probably want to avoid that. In practice we’ve always used compression on full-screen backdrops, but left texture atlases uncompressed (because the quality drop is far more noticeable on the smaller sprites); that’s a pretty common policy for most places I believe.

  2. First of all 1920×1080 is not power of two, even if your card support NPOT textures I think it’s a best practice to use a POT texture.

    Second let’s calculate the size in bytes. 1920 * 1080 * 4 = 8294400 bytes that is around 8mb of memory. Since the answer is tagged as android I assume you are talking about a mobile platform. A lot of the mobile platforms can’t handle more that 2048*2048Citation needed.

    So if you are talking about it as a stand alone texture that’s big! If it was part of an Atlas that’s even worse, I assume the atlas will be much bigger.

    My advise use it as stand alone. And make sure you use don’t alot of memory, you might need to scale it down.

Leave a Reply