Hello Guest

Author Topic: Many high resolution sprites/images - Performance Advice  (Read 4436 times)

spacejaguar

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 27
    • View Profile
Many high resolution sprites/images - Performance Advice
« on: February 19, 2013, 11:02:50 am »
So after reading this 2 posts,

http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,405.msg1766.html#msg1766
http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,241.msg961.html#msg961

I still have questions regarding performance Vs memory loading Vs Atlas size.

I am making a game wich uses high resolution art, 130 animals at 512x512 resolution each... wich translates to a 34 megapixel image.  :o

Atlas spanning is out of the question as acording to one of the posts the system loads all the atlas to the memory even if only one sprite is used. And it would be best if I didn't had to mess with manual memory  management in Unity, Loading / Unloading of assets.

So all i am left is with one option, a compromise of creating several smaller collections each containing a single Atlas of 2048*2048 (wich would include on average 16 animals each)

Since at anytime only 2 animals would be shown on a scene at the same time only 2 animal atlas would be loaded since they belong to different collections.

Is this possible? If atlas are divided by different collections will the system only load them when required ?

Has anyone tried this aproach?


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Many high resolution sprites/images - Performance Advice
« Reply #1 on: February 19, 2013, 05:38:32 pm »
If load time isn't a massive concern, then perhaps you could store the images as filename.png.bytes and load it in as a PNG. Once you have the PNG loaded in as a Texture2D, you can then create a sprite at runtime. You also get much finer control over getting rid of them when you need to.

Atlases are loaded if you have a reference to them in the scene, so you'd have to manually load and unload these to get what you need.

spacejaguar

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: Many high resolution sprites/images - Performance Advice
« Reply #2 on: February 19, 2013, 08:15:40 pm »
I just noticed Fattie had answered this question on another post I had made before about "Load/Change texture on Sprite.":)

http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,1058.msg5282.html#msg5282

For what i understand this is perfect and exacly what i was looking for.
Unity will create a collection with a single sprite everytime I call for a PNG and after every use i can then destroy it. 

I will try this later :)