submit to reddit
Tweet
Follow ToxicBlob on Twitter

Not all PVRTC are created equal

PVRTC compression comparision (side by side)
PVRTexTool version 3.23 vs. Unity version 3.4.2. . . click to view comparison QuickTime

This post is of a technical nature. If you’re not a game developer, please do be patient. Sin or Win is coming, soon!

There are three options for textures when developing for iOS in Unity: True colour, 16-bit* and PVRTC compressed images. True colour & 16-bit images are great for image fidelity, but swallow lots of memory. On a limited platform like iOS one can’t have many of them without running into memory issues. So most developers crush their images into PVRTC which tends to have a fraction of the memory requirements. I have avoided using PVRTC because the results were horribly poor. However, this week I’ve been optimising Sin or Win and investigating my texture options led to this PVRTexTool discovery.

Typically, Unity’s built-in PVRTC compression results in unacceptably blurred and smudgy results. Then I stumbled across a reference in Unity’s Optimising iOS Graphics Performance documentation on PVRTexTool from Imagination Tech - creators of the PVRT format. Use another tool, Unity suggests, if your PVRTC is poor quality. Doing so result in the image above. Click on the image for a QuickTime comparison.

Bizarrely, the newly released Unity 3.4.2 comes with an old version of PVRTexTool** (version 3.11). I’ve filed a bug report with Unity, requesting for better compression to come with Unity 3.5 (or Unity 3.4.3!).

In the meantime, here’s how you take advantage of better compression today.

Install PVRTexTool from Imagination Tech:
  1. Download PVRTexTool from Imagination Tech. You’ll have to create a username and password to do so. Once that’s done, Mac users download the PVRTexTool file with the yellow folder icon
  2. Unarchive the file and you’ll get a PVRTexTool folder in your Downloads. Drag this to your Applications folder
  3. Documentation is in the “Documentation” folder
  4. Most interesting is the command line application PVRTexTool. It’s found at /Applications/PVRTexTool/PVRTexToolCL/MacOS_x86/PVRTexTool. There is a GUI version of the tool, but it has an annoying Windows interface and is more time consuming to use. The command line tool can be wrapped into your pipeline tools for seamless integration
Use PVRTexTool to convert an image:
  1. From the Terminal change to the folder where your image is. PVRTexTool takes images in BMP, TGA, JPG, PNG, GIF, DDS. I use PNG
  2. Run /Applications/PVRTexTool/PVRTexToolCL/MacOS_x86/PVRTexTool -fPVRTC4 -pvrtcbest -yflip 1 -square -iPICTURE.PNG replacing the green PICTURE.PNG with the name of your image. PVRTexTool will then take it’s time, but it’ll create PICTURE.PVR, a high quality PVRTC compressed image you can drag to Unity. Also, ensure that you use “-pvrtcbest” otherwise you’ll just create PVRTC images as poorly as Unity already does
I hope this helps fellow Unity users get more texture quality from their images. The only downside to this is that compression takes slightly longer. The resulting images look better and take up the same space as those converted with Unity. Hopefully Unity will add the ability to choose between Fast, Normal, High Quality and Best Quality PVRTC generation.


*Coming from film I was spoilt into thinking of 16-bits as 16-bits per colour channel. Really that’s known as 48-bit colour. 16-bit colour in Unity is a paltry 32,768 colours

**I couldn’t actually get PVRTexTool 3.11 to work, so definitely download the newest version from Imagination Tech
blog comments powered by Disqus