If you have experience with PVRTC, you may have noticed that the textures produced by Unity are uglier than they should be. Today, I did some digging to find out why.
It turns out that Unity uses texturetool, the same tool that ships with the iOS SDK. However, 3.0f5 ships with an older version than Apple is currently shipping.
What’s cool is that it is really easy to update Unity’s copy of texturetool, resulting in higher quality PVRTC textures that take up no more space, and (as far as I’ve seen) don’t take any longer to compress. Here’s how:
Quit Unity
Make sure you have the latest iOS SDK from Apple
Right-click /Applications/Unity/Unity.app and choose “Show Contents”
Open /Applications/Unity/Unity.app/Contents/Tools in Finder
Rename texturetool to texturetool.old or whatever in case you need it again (you won’t)
Open /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin in Finder
Copy the texturetool from bin into the Tools directory
I just gave it a try with a project with a lot of textures. Sadly its no generally great improvement (at all). In some cases things seemed to look just a tidbit better, in other cases they looked noticably worse though (even more artifacts than before).
Thanks for the tip, but yeah, bummer, didn´t bring a lot for me. I´d love it if there was an option to get color assets compressed for iPhone with smaller filesize than rgba 16 and still way better look than pvrtc (which is so bad i only really use it for abstract graphics).
We’re working on a 2D game with lots of complex pre-rendered backgrounds and scenery. I don’t actually have a copy of the texture where it was the worst, but we were seeing dark lines around the edges of compressed textures. The current version of texturetool doesn’t produce such edge artifacts.
Texture compression isn’t suitable for 2D games at all. It gets pretty bad with alpha channels. However on large textures without alpha, you will see some serious gains.
yeah, well, i agree when talking about pvrtc compression. I also mostly use em for abstract stuff as i said, like for example when you have a texture that should actually be mud it can look ok with pvrtc compression
Of course other compression methods lead to way nicer look for many things while still achieving good compression rates, too bad we can´t use such for iOS stuff.
Ok, here’s the example that drove me to switch compressors in the first place:
This is just a detail from the left-hand side of a texture atlas with 3x zoom.
On the left is the original, with a different colour profile.
In the centre is the result of compressing it with Unity’s old texturetool. You can see a dark, junky gradient at the edge of the sand, on the left. This is the edge of the original texture, and there’s no good reason for it to be dark.
On the right is the result of a new compressor (turns out I don’t even have the 4.2 SDK installed). There are still slight artifacts that are clearly edge-related, but they’re completely acceptable.
The image was supposed to blend with another one on the left edge. With the old compressor, the result was an unacceptably obvious vertical line. The new compressor fixes that entirely, making the blend seamless.
PVRTC is best for photographic images, so it should be completely appropriate for our content. I’m glad I was able to figure this out instead of octupling texture sizes whenever compression didn’t produce good results.