Hello Guest

Author Topic: How do you deal with large animations and atlasing?  (Read 4697 times)

niall111

  • Newbie
  • *
  • Posts: 3
    • View Profile
How do you deal with large animations and atlasing?
« on: May 07, 2014, 01:59:34 pm »
I have approximately 500 frames worth of near full-screen animations.  Obviously it's not possible to atlas all of them in a single collection (not that I didn't try!) so I've taken to breaking them down into 30-50 frame chunks.  Image sizes are 768x1024 with alpha, I can fit about 10-12 frames on a 2048 atlas targetting ipad 1-2.  These smaller collections are then assigned to individual prefabs that i'm loading and unloading on the fly during animation, with barely a hiccup.  Memory usage stays well within limits as well, with only a single sprite collection loaded into memory at once.  Even an ipad1 performed admirably with this setup.  Stellar stuff, I'd say! 

Until it came time for the retina versions...  at 1536x2048, building 30-50 frames to a collection just runs into the Unity out-of-memory error.  Even adding them in smaller chunks to the collection and committing each chunk doesn't help, as it seems Unity/tk2d will still decompress all collection images into memory to optimally pack them. 

I don't suppose there's any way around this, other then further reducing the number of frames per collection, and having to load/unload them more often on the fly?  I'd love to have an "add" button next to the commit button, that will just create new materials/atlases and add them to the current collection, is that silly?  For example, I could bring in 12ish of the large frames at a time, knowing they will fit on a single atlas, commit that, then add another 12 frames, and hit my theoretical "add" button to create a second atlas? 


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How do you deal with large animations and atlasing?
« Reply #1 on: May 07, 2014, 07:05:21 pm »
I would expect Unity to run out of memory with that kind of data, being a 32 bit app :(
Why not split them up into multiple collections manually? That will work much much better. There is no restriction in the number of collections that can be used in an animation, so from that point of view it should be no different.

niall111

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: How do you deal with large animations and atlasing?
« Reply #2 on: May 07, 2014, 07:40:29 pm »
Two very interesting points I hadn't thought of!  The 32 bit thing explains why going from work PC with 8 gigs of RAM to home PC with 16 gigs made no difference, unity can only access 4 gigs of ram anyway.  Why do they keep claiming a 64 bit version is a low priority, because "it's not that necessary"?! 

And being somewhat new to tk2d, I didn't realize an animation could include multiple collections, that will certainly make this possible at least, thanks!

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How do you deal with large animations and atlasing?
« Reply #3 on: May 08, 2014, 04:10:47 pm »
Quote
Why do they keep claiming a 64 bit version is a low priority, because "it's not that necessary"?!
Its one of the bullet point features of Unity 5...