Use Apple's utility for PowerVR compressed textures
by Mat Valadez · in iTorque 2D · 12/23/2008 (2:46 pm) · 12 replies
Apple ships a command-line tool for generating PowerVR compressed textures from PNG files with the iPhone SDK. The PVRTC files you create using this tool can be used directly with Torque, dramatically reducing texture memory usage. By default, the tool is installed to this path: /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/texturetool
For full usage information, run the tool without arguments. To generate a file that can be used with Torque, you must pass at least the following arguments:
texturetool -e PVRTC -o
For full usage information, run the tool without arguments. To generate a file that can be used with Torque, you must pass at least the following arguments:
texturetool -e PVRTC -o
#2
That means textures must be 64x64, 128x128, 256x256, 512x512 or 1024x1024
that are the only supported sizes on the iphone
12/25/2008 (12:28 pm)
IPhone only accepts power of two AND square textures.That means textures must be 64x64, 128x128, 256x256, 512x512 or 1024x1024
that are the only supported sizes on the iphone
#3
12/26/2008 (6:41 pm)
I think what Marc means is that PVRTC textures must be square and power of 2 dimensions. PNGs can be any size or ratio, and will get get auto-sized up to the next power of 2.
#4
The iphone does NOT accept any texture not meeting those requirements, independent if compressed or not.
12/27/2008 (4:50 am)
Well you can use whatever you want. but above are the only texture sizes that are allowed on the iphone so iTGB will resize / pack them to meet that.The iphone does NOT accept any texture not meeting those requirements, independent if compressed or not.
#5
01/09/2009 (1:14 pm)
What PVR format can you use to encode png's with alpha? 4bpp and 2bpp doesn't work for alpha, right?
#6
01/09/2009 (1:15 pm)
If I use any of the 16bit pvr's they seem to generate bigger files than the .png
#7
However, I can't load it in the editor. even when I edit the datablocks.cs and start the editor. it doesn't seem to like it.
Is there any example of a pvr file or what it should look like in datablocks.cs?
01/09/2009 (3:54 pm)
So I was able to use the cmd line tool to convert my png to pvr.However, I can't load it in the editor. even when I edit the datablocks.cs and start the editor. it doesn't seem to like it.
Is there any example of a pvr file or what it should look like in datablocks.cs?
#8
Use a regular PNG, in the datablock, don't include the extension. e.g.
Then create the PVR with the same name
on your non-iPhone build it'll load the PNG, but on the iPhone, it'll load you PVR first so you.
Basically, just use the PNG, but make the PVR and it'll load on the iPhone without you having to "manage" it.
01/09/2009 (11:48 pm)
ITGB is set to look for PVR textures first. Here's what I would do.Use a regular PNG, in the datablock, don't include the extension. e.g.
new t2dImageMapDatablock(SomeImageMap) {
imageName = "~/data/images/Actor/SomeImage";
...
}Then create the PVR with the same name
on your non-iPhone build it'll load the PNG, but on the iPhone, it'll load you PVR first so you.
Basically, just use the PNG, but make the PVR and it'll load on the iPhone without you having to "manage" it.
#9
Doing it manually in the resources is naturally a way but one that takes pretty long.
01/10/2009 (11:09 am)
Has someone already created a small post build script that removes all png where corresponding pvr are present after the app has been built?Doing it manually in the resources is naturally a way but one that takes pretty long.
#10
PVRs will generally be larger than PNGs in terms of file size, but they will take up a drastically less amount of video memory on the iPhone itself in game. When iTG* loads in any standard file format (PNG, JPG, etc.) it will uncompress them in order to store them into an OpenGL texture, which graphic cards (doesn't matter if it is an iPhone PowerVR or an ATI card on your PC, etc.) need to be in some kind of standard video format (ie 8888, 1555, paletized, DXT, etc.).
So basically, unless your image is saved in a file that uses some kind of valid texture compression format for the specified video hardware (ie. PVR, DDS, etc.), Torque will just load it as a standard, uncompressed texture for video memory storage (and ultimately video card rendering) purposes.
Bottom line is, don't be fooled by the disk size of an image and just use PVR wherever you can!
02/04/2009 (1:31 am)
@ EyalPVRs will generally be larger than PNGs in terms of file size, but they will take up a drastically less amount of video memory on the iPhone itself in game. When iTG* loads in any standard file format (PNG, JPG, etc.) it will uncompress them in order to store them into an OpenGL texture, which graphic cards (doesn't matter if it is an iPhone PowerVR or an ATI card on your PC, etc.) need to be in some kind of standard video format (ie 8888, 1555, paletized, DXT, etc.).
So basically, unless your image is saved in a file that uses some kind of valid texture compression format for the specified video hardware (ie. PVR, DDS, etc.), Torque will just load it as a standard, uncompressed texture for video memory storage (and ultimately video card rendering) purposes.
Bottom line is, don't be fooled by the disk size of an image and just use PVR wherever you can!
#11
I guess it a trade-off between using a compress file that is smaller and will help you go under 10Mb for the 3G limitation . or use PVR which will help your video memory / application crash.
Good to know.
02/04/2009 (7:44 am)
got ya, I see how it works.I guess it a trade-off between using a compress file that is smaller and will help you go under 10Mb for the 3G limitation . or use PVR which will help your video memory / application crash.
Good to know.
#12
02/04/2009 (8:17 am)
you will have a hard time getting smaller files than pvr unless you want even worse quality by using jpg
Torque Owner Eyal Erez
When I use power of two textures with filtering and padding, they end up taking twice the memory (because of the padding). So usually I resize them to 126*126 or 62*62 and that seems to work great. With the PVR textures, can I use square textures that are not power of 2?