Hello Guest

Author Topic: PNG atlas  (Read 5206 times)

Mr Oliv

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
PNG atlas
« on: January 22, 2014, 06:08:21 pm »

Hi

Just tried saving Sprite Collections as PNG's and got an unexpected result... The build became a lot smaller, but looking at Unity's Profiler, the app actually consumes way more texture memory at runtime.

Unity Atlases
Build Log: Complete Size: 104.3mb
Profiler: Texture size: 101mb

PNG Atlases
Build Log: Complete Size: 48.7mb
Profiler: Texture Size: 173mb

I exported several builds switching back and forth to make suer I did it right. What's going on???

/M

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: PNG atlas
« Reply #1 on: January 22, 2014, 09:39:36 pm »
1. Where are you getting texture size from?
2. Are mipmaps on?
3. Is one of these settings reducing texture sizes loaded in the non PNG path? http://2dtoolkit.com/forum/index.php/topic,612.0.html

Ultimately, the textures are simply loaded into memory using Texture2D.LoadImage in the same way Unity recommends, it doesn't do anything other than that. I've never bothered checking if Unity allocates more memory for png textures vs native textures, but I wouldn't rule that out either.

Mr Oliv

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: PNG atlas
« Reply #2 on: January 22, 2014, 10:29:21 pm »


1. Where are you getting texture size from?
I'm looking at Unity's Console > Editor Log after each build to see all the assets, and there's no question PNG's take up less space than Unity's textures (about 60-70% smaller than uncompressed Unity textures). But when I run the app and look in the Profiler, the texture memory increases hugely during runtime with PNG atlases. Around 70% more than using Unity textures.

2. Are mipmaps on?
No

3. Is one of these settings reducing texture sizes loaded in the non PNG path? http://2dtoolkit.com/forum/index.php/topic,612.0.html
No, I was using uncompressed Unity textures (I'm building a high end digital brochure basically) with full quality textures.

Ultimately, the textures are simply loaded into memory using Texture2D.LoadImage in the same way Unity recommends, it doesn't do anything other than that. I've never bothered checking if Unity allocates more memory for png textures vs native textures, but I wouldn't rule that out either.
That's what I thought. This doesn't make sense

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: PNG atlas
« Reply #3 on: January 23, 2014, 11:22:34 am »
The best thing to do is to try and reproduce this with 1 sprite collection exactly. If you can I'll be happy to take a look if you can email a repro case (support at unikronsoftware dot com). It sounds very much like Unity doing completely different things in the 2 paths, if I can confirm that its probably worth sending them a bug report. Things like this will never get fixed otherwise.