tl;dr
PVRTC encoder/decoder for Unity is a C# implementation of PVRTC texture format compression and decompression for Unity game engine. Only 4 bit modes supported.
Downloads:
Bitbucket repository
1823768–116774–pvrtc_encoder_and_decoder.unitypackage (478 KB)

Why?
Since AFAIK there isn’t any existing C# implementation of PVRTC encoder/decoder.
What I could do with this
You can do runtime PVRTC compression in your iOS app/software. This could be handy if you are doing procedural texture generation and want to save some GPU texture memory. Or you could in certain situation save few download bytes by sending e.g. PNG textures to device and then converting those to PVRTC.
How to use
- Import the Assets folder to your project.
- Check out PvrtcTest.cs for examples (there is also scene named pvrtcTest for testing the outputs)
important functions are:
EncodeRgb4Bpp(Texture2D bitmap)
EncodeRgba4Bpp(Texture2D bitmap)
and
DecodeRgb4Bpp(byte[ ] data, int width)
DecodeRgba4Bpp(byte[ ] data, int width)
What could be better
- Performance could be better
- There could be a multithreaded version of encoder/decoder
- Encoder could read data from FILES instead of Unity Texture2d structures
- Decoder could guess the texture resolution from byte array size
What it DOES NOT DO
- It does NOT support PVRTC 2 bit
- It does NOT open PVR files
- It does NOT generate PVR files
Thanks
jthlim and Brendan Duncan who made the C++ implementation that I shamelessly ported to C#.
