Does anyone know the command line arguments for creating PVRTC textures?
I’ve been trying to manually convert a few to have Unity load them in via ‘Texture2D.LoadRawTextureData’ but haven’t had any luck.
I was able to use the Xcode utility to create a Unity readable pvrtc formatted file no problem. Can’t seem to get it working with the PVRTexTool.
My current format is:
PVRTexTool -i ~/Downloads/Tex_Natural_A.tga -o ~/Downloads/Tex_Natural_A.pvr -f PVRTC1_2,UBN,lRGB -q pvrtcfast
Any help would be great.
Ok so I figured it out…
There are a few things you have to do:
Encode your texture using these parameters:
PVRTexTool -i ~/Downloads/Tex_Natural_A.tga -o ~/Downloads/Tex_Natural_A.pvr -f PVRTC1_2,UBN,lRGB -q pvrtcfast -legacypvr
Next inside of Unity, you need to strip the metadata/header data from the pvr before Unity can read it.
Note that with legacy pvr, the header size is always has a 52 bit-length.
WWW www = new WWW(“file://” + dir.ToString() + “/Tex_Natural_A.pvr”);
yield return www;
int headerSize = 52;
byte buffer = new byte[www.size - headerSize];
System.Buffer.BlockCopy(www.bytes, headerSize, buffer, 0, www.size - headerSize);
Texture2D tex = new Texture2D(512,256,TextureFormat.PVRTC_RGBA2,false,true);