Log in

View Full Version : RLE Compression for textures


Captain America
02-17-06, 12:24 PM
In photoshop there is an option to save .tga files with RLE compression. RLE is a loss less compression meaning visually the image quality is the same just a smaller size.

I noticed when using this I can significantly reduce the size of many of the game images, which in theory should reduce memory usage. Take for instance the Periscope.tga file, by default it's 4mb but when saved with RLE compression its 2.64mb. Thats a significant difference. I was thinking if I changed every .tga texture in the game I should notice improved performance.

Before I go ahead with this task I was hoping someone who knows about textures and RLE compression would advise me if this is a good idea. I don't want this to make my performance worse. I was thinking...if the texture is now compressed I am saving memory but will it require more GPU/CPU power to display the image in the game because its compressed? Should RLE be used for graphic intensive games? The devs didn't use it so it makes me wonder if this is worth it.

Any info is appreciated.

-CA

sergbuto
02-17-06, 12:53 PM
I think in case of compressed textures, the game will anyway decompress them before loading and therefore no saved operational memory but increased loading times. I tried it once before but did not notice any improvement although I will not bet on that since I did not do proper tests.

Marhkimov
02-17-06, 02:10 PM
I use RLE compression all the time and it does not affect anything in-game.

It's nice because all of the images are noticeably smaller in size, as you have already noticed.

JonZ
02-17-06, 08:05 PM
I wish we could have an unified answer about this.


I've searched about RLE not long ago and most of the post said to never do RLE compression and always save in 24 bits. Most of the reasons was for performance and stability issues.

I don't know how Ubi make their standards, but they have surely have one about tga files.

ref
02-20-06, 08:10 AM
I wish we could have an unified answer about this.


I've searched about RLE not long ago and most of the post said to never do RLE compression and always save in 24 bits. Most of the reasons was for performance and stability issues.

I don't know how Ubi make their standards, but they have surely have one about tga files.

All games must decompress all textures that it loads in order to display them, all terrain files in sh3 are rle compressed, advantage small size on disk, less load time, disadvantage has to be decompressed in memory.

JonZ
02-20-06, 08:46 AM
I wish we could have an unified answer about this.


I've searched about RLE not long ago and most of the post said to never do RLE compression and always save in 24 bits. Most of the reasons was for performance and stability issues.

I don't know how Ubi make their standards, but they have surely have one about tga files.

All games must decompress all textures that it loads in order to display them, all terrain files in sh3 are rle compressed, advantage small size on disk, less load time, disadvantage has to be decompressed in memory.

What about the TGA files with the usage of Alpha channels?

They have to be save in 32 bits, a must. But I don't know if RLE can be also checked.

ref
02-20-06, 10:25 AM
I haven't tried in the game, but I use 32 bits+alpha tga rle compresed all the tima at work, I don't think it would be a problem as the rle compression is a standard tga feature.

Captain America
02-20-06, 02:28 PM
Thanks for responding...

You can RLE compress 32bit .tga's. I use photoshop, I tested it and it does preserve the alpha channel.


All games must decompress all textures that it loads in order to display them, all terrain files in sh3 are rle compressed, advantage small size on disk, less load time, disadvantage has to be decompressed in memory.

So I take it that it could hurt performance if I were to RLE compress every texture? Bummer. I am still doing research on this but there's not a lot of info on the web regarding the performance gains/losses with graphic intensive games.

ref
02-20-06, 03:00 PM
So I take it that it could hurt performance if I were to RLE compress every texture? Bummer. I am still doing research on this but there's not a lot of info on the web regarding the performance gains/losses with graphic intensive games.

I don't think it would be a great performance lost, the decompression is made at the moment the texture is read from disk, then it's stored decompressed in memory, and the process is very quick, I've wrote a program to decompress the terrain, and in the process of decripting the compression scheme used in SH3 I've made tests with the files in the map directory, (the .rl ones) wich are 1200x1200 pixels, and with a not very optimized routine in delphi it only takes about 1.5 seconds to decompres when they are in memory, with an optimized routine you should se no noticeable diference in loading a compressed and a decompressed file, as I said the most time consuming part is loading them from disk, so you compensate with the compressed file being smaller.

Also there are rle decompressio routines embedded in direct x wich are writen in assembler and they are extremely fast, they are used for dib rle compressed files.