- Home /
Command Line Arguments To Create PVRTC Using PVRTexTool
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.
Answer by inewland · Aug 12, 2015 at 05:10 PM
Ok so I figured it out...
There are a few things you have to do:
1) 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
2) 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);
tex.LoadRawTextureData(buffer);
tex.Apply();
Your answer
Follow this Question
Related Questions
iOS Sprites in PVRTC? 1 Answer
iOS crash with "Memory pressure" error - too many sprites? 0 Answers
Texture appears Pink on Device (works on editor) 3 Answers
How to chose between 2bbp and 4bbp PVRTC in an iOS project? 1 Answer
Embedding PNGs in an app to create a Texture2D on runtime in iOS 1 Answer