Author Topic: Atlas Maker issues  (Read 11188 times)

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Atlas Maker issues
« on: March 05, 2014, 08:34:28 PM »
I just upgraded to 4.3 and started using NGUI (which looks awesome so far) but I am having some issues with the Atlas Maker.

Using the Unity Packer
If I put a couple of small textures in the atlas, it works perfectly. If it's more than 3 or 4 small textures it goes a bit crazy and does not display the sprites properly. It looks like the coordinates are somehow off.

Using the custom packer
I get the following error:

Unsupported texture format - needs to be ARGB32, RGBA32, RGB24 or Alpha8
UnityEngine.Texture2D:SetPixels(Color[])
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:111)

Unsupported texture format - needs to be ARGB32, RGBA32, RGB24 or Alpha8
UnityEngine.Texture2D:SetPixels(Int32, Int32, Int32, Int32, Color[])
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:143)

I found this post but the error is not intermittent (except I occasionally only get the first one) and I did not find "RGBA32" in NGUIEditorTools.cs

Any ideas? I don't want to have to create an atlas for every 2 or 3 sprites. Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlas Maker issues
« Reply #1 on: March 06, 2014, 10:44:17 AM »
What steps are you using here? Any way I can reproduce the problem(s) on my end? I just tried creating atlases using both Unity packer and the custom one, and in both cases everything always works as expected.

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Atlas Maker issues
« Reply #2 on: March 06, 2014, 01:52:57 PM »
Hmm, strange. I can't send my project file due to an NDA but I tried to create a repro case and I can't break it in a new project. I even tried moving my project settings over and it still breaks in the new one. I also tried the new graphics I created for the new project and I am getting the same error.

I will see if the other engineer on this project changed any settings. I am not sure what could be causing this behavior...

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Atlas Maker issues
« Reply #3 on: March 06, 2014, 01:57:04 PM »
Also, for some reason it's making the texture 1024x1024

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Atlas Maker issues
« Reply #4 on: March 06, 2014, 05:49:28 PM »
I tried to create a repro project but could not reproduce the error. I compared all of the settings I could find and it all seems the same. I even tried the new graphics in the old project...and they made it fail. Unfortunately I cannot send the project because it contains graphics, etc. that are specific to our app. I swapped out the graphics for ones with colored squares so you could see what was happening and did my best to send repro steps.

Hmm, so I got rid of the error by using the following settings on my sprites:


I noticed that in the Atlas Maker, the Texture size is 1024x1024. The size of the texture that is created is 2048x2048


This is the atlas. My guess (could be wrong) is that it could fit into a 1024x1024 atlas:


Here are the sprites (shown when I select the atlas and click View Sprites):


I then select all of my sprites and the word Update shows up next to them in the Atlas Maker.

I click Add/Update All and the error returns.

First Error (only occurs once):
Unsupported texture format - needs to be ARGB32, RGBA32, RGB24 or Alpha8
UnityEngine.Texture2D:SetPixels(Color[])
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:111)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UIAtlasMaker:PackTextures(Texture2D, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:136)
UIAtlasMaker:UpdateTexture(UIAtlas, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:540)
UIAtlasMaker:UpdateAtlas(UIAtlas, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:640)
UIAtlasMaker:UpdateAtlas(List`1, Boolean) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:623)
UIAtlasMaker:OnGUI() (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:985)
UnityEditor.DockArea:OnGUI()

Second Error (occurs 6x -- once for each sprite):
Unsupported texture format - needs to be ARGB32, RGBA32, RGB24 or Alpha8
UnityEngine.Texture2D:SetPixels(Int32, Int32, Int32, Int32, Color[])
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:143)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UITexturePacker:PackTextures(Texture2D, Texture2D[], Int32, Int32, Int32, Int32) (at Assets/NGUI/Scripts/Editor/UITexturePacker.cs:97)
UIAtlasMaker:PackTextures(Texture2D, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:136)
UIAtlasMaker:UpdateTexture(UIAtlas, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:540)
UIAtlasMaker:UpdateAtlas(UIAtlas, List`1) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:640)
UIAtlasMaker:UpdateAtlas(List`1, Boolean) (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:623)
UIAtlasMaker:OnGUI() (at Assets/NGUI/Scripts/Editor/UIAtlasMaker.cs:985)
UnityEditor.DockArea:OnGUI()

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlas Maker issues
« Reply #5 on: March 07, 2014, 10:43:42 AM »
Texture being limited to 1024x1024 implies your quality settings are set to "Fastest" or something else that limits the maximum texture size. Either that, or on the texture's import settings you have it limited to 1024.

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Atlas Maker issues
« Reply #6 on: March 07, 2014, 12:52:46 PM »
Thank you for the quick response. I checked the import settings on my source graphics and changed the quality settings, neither of which seemed to have any effect.

I am not sure exactly what happened here but I found a workaround that seems to have fixed it....sort of. The atlas that was created was 2048x2048 but somehow "Override for iPhone" was checked and max size was set to 1024. I changed it to 2048, hit apply and it worked. I couldn't find any settings that would possibly make that happen. This seems to work but is there anything in the code that could possibly cause this?

BehindTheStone

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 135
    • View Profile
Re: Atlas Maker issues
« Reply #7 on: March 07, 2014, 01:07:02 PM »
Haha, got the same problem today: http://www.tasharen.com/forum/index.php?topic=8480.0

My solution was: changing the project from 2D to 3D. If you remember, on Project-Creation you can choose if you want Unity to setup the Project in 2D or 3D Mode. I used the 2D one in that project for the very first time and it gave me these problems.

Maybe it will help you, too.

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Atlas Maker issues
« Reply #8 on: March 07, 2014, 01:10:12 PM »
Hmm, that's a strange workaround. I just started using 4.3 so forgive me if this is a dumb question but are there issues with creating a 2D game in a 3D project? It seems like that defeats the purpose of upgrading to 4.3 but I could be wrong.

Also, although my workaround does work, the atlas has a lot of empty space and it seems that it would fit into a 1024x1024 atlas (although I could be wrong)...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlas Maker issues
« Reply #9 on: March 08, 2014, 12:15:56 PM »
I'm not sure what Unity does behind the scenes if you choose 2D as your default. I chose 3D as the default, and I have the 2D mode enabled after the fact, and everything works as I'd expect.

jacky

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 24
    • View Profile
Re: Atlas Maker issues
« Reply #10 on: March 10, 2014, 06:46:31 PM »
Hmm, well it seems to be working ok now. Thanks for your help!