Author Topic: Using multiple atlases for an animated sprite.  (Read 3240 times)

MoProductions

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 45
    • View Profile
Using multiple atlases for an animated sprite.
« on: April 22, 2016, 11:59:29 AM »
We have 2D sprite animations that won't fit into a single 4096x4096 atlases (don't get me started).  Is there a way to have an animated sprite use multiple atlases, or do I need to put some code checks in there and just manage it manually.
Thanks!
-Mike

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Using multiple atlases for an animated sprite.
« Reply #1 on: April 25, 2016, 12:35:52 PM »
Unity supports 8k by 8k textures now, so you could use that. Still, even a single 4096x4096 RGBA32 texture is 67 megabytes of GPU memory. If you go to 8k by 8k you are now going to be using 268 megabytes. I suggest an alternative approach. Round up your artists and fire them for being dumb. :)

There are plenty of ways of using sprite animations though. First, you could stick to Unity's sprites for this -- UI2DSprite can draw them. Unity will then be responsible for creating atlases for you. Another alternative is to not just use sprite animations, but actually do sprite blending. Ie: instead of swapping sprite A to sprite B, blend from A to B instead. This will give you very smooth transitions. Third option is to split up your sprites into components. For example if you have a sprite that's a 256x256 square that spins around and the reason you can't shrink it down is because it has a fine pattern in it, you can use a sliced sprite to draw a rectangle, and a tiled sprite on top of it to add the pattern to it, separately. You can even write a shader to do blending, respecting the first sprite's alpha, if you're inclined.

Anyway, to sum it up -- there are plenty of smart ways to go, if you're clever about it. Using more memory is not one of them.