Borders and resize on the cmd line PVRTexTool

I have a TGA 112 * 112 image, i want to add a 8*8 border to make a 128*128 OGLPVRTC4 image without any resize.

It works very well with the GUI version but i dont know what the command line version does.

If i dont put the -x and -y parameters it says "Power of two dimensions are required when TWIDDLE is enabled.".

if i use -x128 and -y128, it works but i think the image is resized in 128*128 and resized again to add the borders.

The API and the doc of the command line version is unclear about what it does.

The border option in the command line tool currently takes a power of two texture and resizes the image smaller (i.e. 120120) then adds the required border to make the texture power of two again (i.e. 128128). Sadly there’s a bug in this at present (as you posted recently about in the forum) that will output an incorrect size of border. As I said, this will be fixed for our release next month.

Using the resize parameters the texture is resized twice as you have guessed.

There’s no automatic resize to power of two dimensions in the command line version at present as this precise method of adding borders hadn’t been considered (it’s more a happy coincidence in the GUI version). Thinking about it, it does seem a more natural way of approaching the problem so I may implement a way of doing this and try to make the docs more clear. I try to make the CL version of PVRTexTool behave the same way as the GUI wherever possible.

Incidentally, the block size in PVRTC4 compression is 4 so adding a larger border than this should bring no benefit - have you tried using 120*120 textures?

Gordon2009-01-08 12:13:26

Sorry i made a mistake in my example, i tried 112 * 120 for a 8*4 border (with the border bug, the t1 or t2 parameter).

Actually, In my application, i resize a big texture with FreeImage to make power of two tiles then i call PVRTexTool with the t2 parameter (actually 8*4 border). With that, i have 2 resize (FreeImage and PVRTexTool for the borders) and a loss of quality.

With the corrected next version i will do the same with a 4*4 border.

bruno.deligny2009-01-08 15:08:25

Does the -nt command line work?

i’m running this:

PVRTexTool.exe -fPVRTC4 -nt -ifile.png -ofile.pvr

and svn doesn’t see a diff in the files, nor does my loader ( it doesn’t handle twiddling ).


David Goemans

The PVRTC formats are the only formats that don’t have an untwiddled option as the data is already in the order that the GPU requires to render.

For other formats the -nt option should work (and is mandatory for use under khronos APIs for instance). This is why you see no difference.

I shall look at adding a warning when the nt flag is used with PVRTC so that this is more clear and update the documentation.