Hello Guest

Author Topic: How do I deal with huge models that are over 700 frames?  (Read 5112 times)

Disastercake

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Disastercake
How do I deal with huge models that are over 700 frames?
« on: April 28, 2012, 01:02:58 am »
Hi,

I just purchased 2D toolkit and am experimenting with it now.  I currently am trying to make a series of sprite atlases that will contain 707 separate images at 601x442 dimensions.  The images total 28.7MB in size in all.

Unfortunately when trying to do this, Unity will crash and say it's out of memory.  How do you recommend I deal with a character that is this large using 2D Toolkit?

Cheers,
Mike
Soul Saga
www.disastercake.com
Working on Soul Saga, an upcoming anime adventure RPG game by Disastercake.
www.disastercake.com

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How do I deal with huge models that are over 700 frames?
« Reply #1 on: April 28, 2012, 09:24:29 am »
Hi,

I'm guessing your image size number is the size of the PNGs you're importing. What happens behind the scenes is each of theses images gets converted into a texture suitable for uploading into VRAM, and if the texture is uncompressed, EACH 601x442 image would take up 1.013MB. So, 707 images at that size works out at 716.4MB. This is inevitable, and would happen in any engine you end up using - even if the engine loads directly from PNG, thats how much memory it would take on VRAM if the image is uncompressed.

If you try to import all these images and create atlases out of them in one go (assuming you've got multiple atlas spanning ticked), you will most certainly crash Unity.

The only way to work with data of this scale, is to split up the data into smaller and more manageable chunks, and create sprite collections out of these. My advice here is to avoid using the spanning feature, and manually create sprite collections out of as many sprites would fit in each collection. This number will probably be larger than the numbers just divided, as I'm guessing (and hoping) that your images would have a ton of empty space in them - 2D Toolkit will trim these textures by default, so hopefully you end up using less than the 700 MB worked out above.

Hope that helps.

Disastercake

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 21
    • View Profile
    • Disastercake
Re: How do I deal with huge models that are over 700 frames?
« Reply #2 on: April 28, 2012, 09:12:16 pm »
Thank you very much for the prompt and informative response. =D

So if I'm understanding this right, you're recommending that each animation for the character have it's own sprite collection

This is actually what I ended up doing already, but I can't find an intuitive way to create the one character object.  Is there a way to make one animated sprite in the hierarchy pane link to several different sprite animation containers in the project pane?
Working on Soul Saga, an upcoming anime adventure RPG game by Disastercake.
www.disastercake.com

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: How do I deal with huge models that are over 700 frames?
« Reply #3 on: April 29, 2012, 12:37:50 am »
An animation can refer to multiple sprite collections. Did you try making the animations with all the different sprite collections simply pulled into one SpriteAnimation object? I'm not sure how well it'll work due to the size of data, but it should work without having to split it up.

If this works, then the game simply sees one animation, and the fact that they are in different collections wouldn't make any difference.