Author Topic: Texture Import Settings and Atlas Creation/Updating  (Read 10940 times)

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Texture Import Settings and Atlas Creation/Updating
« on: March 24, 2014, 08:12:10 PM »
I have been encountering various errors and strange behavior with my atlases and I was wondering if there is one place that I could find the info for properly setting up my atlases.

I have encountered a few things along the way that has solved a lot of problems but having this info would have saved me hours. I am still encountering issues that are most likely the result of improper settings.

Here is what I have found so far:
1. If you use a PMA shader (Premultiplied Alpha), do not check Alpha is Transparency in the Texture Import Settings
2. What should my Import Settings be for PNGs? (I was using Sprites but I read that I should be using Advanced -- a coworked noticed a degradation in image quality when we used a Texture but perhaps there was another setting that was incorrect)
3. After I create an atlas, I have to set the Max Size to 2048 and the Format to Truecolor. I also have to uncheck "Override for iPhone" because the Max Size gets set to 1024 and I get all sorts of errors.
4. Should the Import Settings be changed to Advanced for the atlas as well?

Are there any other settings? I am still getting errors and banding on my graphics and it is getting incredibly frustrating. Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Texture Import Settings and Atlas Creation/Updating
« Reply #1 on: March 26, 2014, 03:13:33 AM »
1. There is no reason to use the PMA feature anymore. Don't use it.
2. Doesn't matter. NGUI overrides texture settings when you attempt to add something to the atlas.
3. Max size set to 1024 suggests that you are targeting older devices or have your Quality set to "Fastest".
4. Same as #2.

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Texture Import Settings and Atlas Creation/Updating
« Reply #2 on: March 26, 2014, 12:59:49 PM »
Quote
2. Doesn't matter. NGUI overrides texture settings when you attempt to add something to the atlas.

I am a bit confused about this because if I don't change the settings before I add to the atlas, I get a crash. I have reproduced this several times (i.e. -- I import a new graphic and try to add it to the atlas. If I don't change the import settings to Advanced/Max Size 2048/Format ARGB 32 bit I get a crash).

Also, if I do not set the max size manually, I get a crash. This is reproducible as well. I don't have the quality set to Fastest but I will check the build target.

You also mentioned in another post that you need to change the import settings. Did something change in the most recent version?
(http://www.tasharen.com/forum/index.php?topic=8480.msg40090#msg40090)

Quote
Also... why is your "Tester" texture set to 16 bit? It must be RGBA 32 bit.

Edit: You seem to have the texture type set to "Sprite", when it should be "Advanced". The texture import settings are wrong... Turn off the "2D" mode.

(also, what do you mean by "Turn off the 2D Mode"?)

Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Texture Import Settings and Atlas Creation/Updating
« Reply #3 on: March 26, 2014, 07:58:43 PM »
You get a crash? Nothing should crash. Are you using some versioning system that requires manually checking out files prior to modification, thus preventing NGUI from altering the texture settings?

Changing the settings is only needed if your platform overrides the default import settings.

What version of NGUI are you using, and what version of Unity? 2D Mode was added in Unity 4.3.

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Texture Import Settings and Atlas Creation/Updating
« Reply #4 on: March 26, 2014, 08:07:24 PM »
Sorry, I should have provided more details...

Quote
You get a crash? Nothing should crash. Are you using some versioning system that requires manually checking out files prior to modification, thus preventing NGUI from altering the texture settings?

I suppose crash is the wrong word. I get an error and I can no longer use the Atlas Maker. Unity functions properly but I have to quit and restart.

It is pretty much as described here:
http://www.tasharen.com/forum/index.php?topic=8480.msg40069#msg40069

Quote
Changing the settings is only needed if your platform overrides the default import settings.

I have no idea why it would but apparently it is somehow. I have all of my quality settings as high as possible.

Quote
What version of NGUI are you using, and what version of Unity? 2D Mode was added in Unity 4.3.

NGUI 3.5.0b
Unity 4.3.4f1

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Texture Import Settings and Atlas Creation/Updating
« Reply #5 on: March 26, 2014, 08:22:51 PM »
You should update your NGUI to the latest, which is 3.5.5 at the time of this writing.

The "texture as been destrotyed" Unity bug has been one of those voodoo things that some people run into, but can't seem to create a repro case for me to look at. I've known about it for a year now, and still not a single repro case that works. Are you using Unity Free? Are you using any file versioning system?

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Texture Import Settings and Atlas Creation/Updating
« Reply #6 on: March 27, 2014, 10:51:52 AM »
Ahh, that's got to be frustrating! It's not terribly consistent and it seems to have sorted itself out at the moment. If it happens again, I will try to see if I can at least come up with consistent repro steps and perhaps the Console log.

It definitely seems to have something to do with the texture import settings of the source textures. I don't believe it has ever happened when I set the texture type to advanced/max size 2048/RGBA 32 Bit.

The other thing that I have found is that it happens every time when the textures are too big to fit in the atlas but that is not the only time I have gotten the error.

I know it is tough to diagnose without the actual project but, unfortunately, I cannot send that.

I am using Unity Pro and SVN (separate client).

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Texture Import Settings and Atlas Creation/Updating
« Reply #7 on: March 27, 2014, 11:04:17 AM »
Regarding #2

NGUI only sets a a minimal amount of settings now, where it earlier forced it to be max size 4096x4096, true color, non power of two etc. Now it only sets alpha is transparency, which means if you have it set to "Texture" it will default to Compressed (yuck) and power of two (also yuck for UI). This is cause a clear quality degradation in import - well, it will be exactly as icky as the actual imported texture is, even if the Atlas is true color.

Generally, it's a good idea to set the textures to be either the GUI preset or advanced and set the individual settings underneath as well.

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Texture Import Settings and Atlas Creation/Updating
« Reply #8 on: March 27, 2014, 11:17:42 AM »
I do set it to Advanced, perhaps I didn't mention that. Thanks!

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Texture Import Settings and Atlas Creation/Updating
« Reply #9 on: March 28, 2014, 04:59:00 AM »
Yeah, but setting it to advanced doesn't do anything in and of itself - it just reveals the underlying options. Look at the individual settingsthen:

* Non Power of 2 (none)
* Max Size (bigger than the texture)
* Format (Automatic true color)

are the important ones.

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Texture Import Settings and Atlas Creation/Updating
« Reply #10 on: March 28, 2014, 10:40:27 AM »
Ahh, RGBA32 was mentioned in another post. Is that ok or should I reimport the textures?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Texture Import Settings and Atlas Creation/Updating
« Reply #11 on: March 29, 2014, 05:41:06 AM »
"Truecolor" is actually ARGB32 in Unity, not RGBA32. Unity seems to like ARGB32.

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Texture Import Settings and Atlas Creation/Updating
« Reply #12 on: March 29, 2014, 05:32:45 PM »
Oh, good to know. Thanks! RGBA seems to work for now, perhaps I will change it before our next release though. Thanks!