Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: leegod on January 28, 2015, 08:35:35 PM

Title: How to drop atlas's file size?
Post by: leegod on January 28, 2015, 08:35:35 PM
So I made many atlases by ngui-atlas maker.

Some has many cards (over 20~30), some has many gui element (window, btn, etc).

But its file size incredibly large like over 20mb, 40mb.

So I checked image atlas's inspector and it has 4096, Truecolor setting.

So if I want size-down, (cuz I am making mobile game, file size is also issue) should I have to make atlas texture format as 'Compressed' and lower 'Max Size' option at import setting?

Do I have other optional ways to lower entire .apk file size?

Thanks.
Title: Re: How to drop atlas's file size?
Post by: Agent_007 on January 29, 2015, 01:49:30 AM
There are few options:

- If your atlas only uses limited count of colors (e.g. 217 colors) you can use palette texturing (8 bit alpha texture for finding the color index and 32 bit color map for finding the color)
- If you can manage with 16 bit colors then use that option (better solution for this is that your artist can produce UI elements with 16 bit colors)
- Compress to ETC1 as you said (this option has the problem that ETC1 doesn't support alpha, so you have to do some extra shader work http://malideveloper.arm.com/develop-for-mali/sample-code/etcv1-texture-compression-and-alpha-channels/ and for upscaled elements the compression artifacts can be easily seen)
- In case the .apk size is the only issue (== no need to worry about runtime texture memory usage) you can use better image compression and decompression during runtime (like BPG http://bellard.org/bpg/ )
Title: Re: How to drop atlas's file size?
Post by: ArenMook on January 29, 2015, 01:00:40 PM
Best way to reduce your atlas size is to not bake everything. Have a 400x150 button? Don't bake it. Use 9-slicing. 9-slicing and overlapping multiple sprites to create a more complex looking image is pretty easy to do, but it does involve using your imagination better to see what can be split up and how.

Windward uses a single 1024x1024 texture for all of its UI elements, except country flags which are on a separate texture.
Title: Re: How to drop atlas's file size?
Post by: leegod on January 31, 2015, 09:23:19 PM
Best way to reduce your atlas size is to not bake everything. Have a 400x150 button? Don't bake it. Use 9-slicing. 9-slicing and overlapping multiple sprites to create a more complex looking image is pretty easy to do, but it does involve using your imagination better to see what can be split up and how.

Windward uses a single 1024x1024 texture for all of its UI elements, except country flags which are on a separate texture.

9-slicing?  So slice original 400x150 button to 9 pieces, and later make 9 sprites ngui object in game, and assign 9 pieces individually to there?

And how deal about card illustration (I am using 500 * 400 size card) sort of things that can't be sliced.

Title: Re: How to drop atlas's file size?
Post by: ArenMook on February 02, 2015, 01:40:42 AM
No... 9 slicing takes an image and slices it into 9 connected pieces where corners don't get stretched, sides get stretched in one dimension and the center gets stretched in both dimensions. Check the documentation page for UISprite.

For cards that are size 500x400 don't even bother putting them into an atlas. Keep them as textures and use UITexture to draw them.