Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: DCalabrese on June 19, 2012, 04:01:12 PM
-
I'm working on a file-size reduction pass for one of our projects. As I got to the NGUI sprite atlases, I realized it was at 2048x2048 with a file size of 21.3mb. Pretty massive! So I started looking at how I could reduce its size and chop the art into multiple files - however when looking at the image, I would say 80% of it was empty space. For some reason, NGUI had laid out the sprites down the left side, and across the bottom. The result was a 2048x2048 atlas image, that only actually needed to be 1024x512. Separating this into multiple atlases seem a little silly right now, as it looks like it will do the same thing and give me extra-large atlas images even if I split the sprites to other atlases.
QUESTION 1: Why is NGUI creating such inefficient atlas images? Is there a setting I can change so it will pack the imagery to fill all that empty space?
In addition to that, I also ended up removing some uneeded assets from that atlas. While it did remove them - it did not rebuild the atlas image. So now I have a 2048x2048 atlas image where the top 512x1024 is completely empty.
QUESTION 2: How do I make NGUI force-rebuild an atlas so that it moves around the sprites to fill empty space whenever I remove old sprites from atlas?
Thanks in advance!
-
It's Unity that does it, not NGUI. NGUI simply uses Unity's PackTextures functionality. I can tell you that it sucks donkey balls when it comes to packing long or narrow sprites. If you have a sprite that's like 1000x10, it will treat it as if it's 1000x1000. Eliminate long and narrow sprites, and you will fix the issue.
-
ArenMook, wow, I had no idea Unity had this bug. And this makes sense - this is the first project that we worked on that had long/narrow sprites, which would explain why we didn't see this before (even when we built our own atlas systems)! By moving the handful of long sprites to their own Atlas, the main Atlas now rebuilds and fills itself properly. Thank you very much for the solution!
-
Sorry for the bump from old post, but I'm still having this issue with long/narrow images.
I have an atlas with 512x1024 dimensions and the real dimensions are 512x433. it's too much empty space and this is my SD version atlas.
There's anyway to fix this? Unity knows about this bug?
Thanks!
-
It does, but you should be able to us the built-in packing solution instead of Unity's solution. If you go to the Atlas Maker there is a checkbox for Use Unity Packer, just make sure that isn't checked.
-
I just got into a new project where they was using NGUI v2.3.4 and I update the atlas unchecking Unity Packer but continue having this double size empty space.
I will fix it by hand just cropping the redundant empty space and changing the top length reference in the atlas, but my question is, if this would be fix by Unity at some point or we'll have this issue forever.
I can't resize the image to make them shorter. :-\
-
I'll probably redo the packing myself at some point, but until then...
-
Well, until then probably doing it by hand. At least it works.