Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any tool to split a PVR texture into a set of tiles?

I 've one big png texture 4096x4096 that I need to load parts of in the memory. I already split the big png texture into 16 1024x1024 tiles then converted them to PVR compressed files.

The problem is that when I draw these tiles, the edges between tiles are not the same as the png does. So, I think if there is a tool to generate one 4096x4096 PVR texture then splitting it into 16 1024x1024 PVR tiles??

like image 559
Abdurrahman Ghanem Avatar asked May 18 '11 12:05

Abdurrahman Ghanem


1 Answers

By PVR (which is a more general texture file format that supports several texture types) I assume you mean PVRTC?

PVRTC isn't block-based in the traditional sense where, say, with ETC or S3TC a texture is split into 4x4 pixel blocks and each block is compressed separately. Instead it attempts to share data between sets of overlapping neighbourhoods of pixels. It also (sort of) assumes that the texture probably tiles so, for example, the extreme left edge area actually shares information with the extreme right hand (and similarly for top and bottom). This is usually not too much of a problem unless the edges are completely different.

If you thus tried to subdivide an already compressed texture into smaller regions it's not going to work because the compressor has made assumptions about what was being shared in the big image, which won't be the same as the small one.

As for compressing each piece separately, it sounds like the edges of each separate piece might be quite different. The only thing I can think of is to chop your original texture into, say, (2^N -4)x (2^N -4) units but store them, centred, in 2^N * 2^N textures where you pad the 2 pixel border with a copy of the original pixels. You then set up your texture mapping to just use the centre (2^N -4)x (2^N -4) region. That, hopefully, should then reduce the discontinuity artefacts.

like image 117
Simon F Avatar answered Oct 25 '22 01:10

Simon F