Author Topic: Atlas texture size reasoning  (Read 2857 times)

missingno

  • Guest
Atlas texture size reasoning
« on: October 11, 2013, 10:16:58 AM »
Why are atlas sizes only specific sizes ?

For example: a 1024 x 1024 will immediately jump to 1024 x 2048 if I add one tiny sprite to a completely full 1024 x 1024. I don't understand the reasoning behind this, as automatically increasing it that much vs just increasing the size enough to hold the new sprite creates a huge amount of wasted space and memory.

I am running into this problem and it's causing my game to crash on the iPod Touch 4 when if the atlases were sized just enough to fit the sprites in them I would have memory to spare.

Can anyone explain this to me ?

Thanks.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Atlas texture size reasoning
« Reply #1 on: October 11, 2013, 01:13:47 PM »
Each sprite needs a 1 pixel border in the atlas, so if you add something that's 1024 pixels high or wide, it needs the next power of two which is 2048.

If they're that big, consider using them in a UITexture instead of the atlas.

missingno

  • Guest
Re: Atlas texture size reasoning
« Reply #2 on: October 11, 2013, 01:40:43 PM »
I think I explained what I was looking for wrong. I mean my atlas (all my sprites) is 1024x1024 and is completely full. How come if I were to add a 20x20 sprite the atlas would jump to 1024x2048 and not something like 1024x1046 ?

Quote
it needs the next power of two.

Why is that, if it only needs a single pixel border why allocate an extra 1022 ?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile