Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

TGA files still show up in video game textures surprisingly often


That's probably because of how simple the format can be, with basically a header and footer tacked on to some RGBA data.

Surprisingly, with PNG, the deflate compression can slow you down, depending on what you are doing with the data. Saving a little bit of IO when you're accessing local data can turn out to be a losing proposition. TGA makes it easier to just shove pixels around, from program to program. TGA has all sorts of weird options which you can ignore, but with PNG, compression is mandatory.


I believe PNG supports uncompressed files, usually with a compression level = 0.


The data is still a Deflate stream, it's just that the deflate stream will be a series of literal blocks. The idea behind "uncompressed" is that you can just copy the data into memory, and level = 0 does not achieve that (you still have to decode the deflate stream).


... what decoding needs to be done on a series of literal blocks?


Not only that, but you can use TGA to write 16-bits per channel, which is very useful for raw data, or linear RGB colour spaces.


Does bitmap not tick all of these boxes?


I’ve never seen a 16 bits per channel BMP… is that even possible?


Half-Life is a little old but I wrote a parser for the .tga files it uses and it was simple (but reading the full spec... yeah it can get complicated with all the different flags).


When I worked on Call of Duty (~7 years ago) almost all of our source images were TGA. The runtime format that almost all games use are various block compressed formats (BC7, ASTC, etc) and usually these are grouped in some kind of package/archive format (although engines are moving away from that in order to stream at the asset level) and lz4 compressed on disk.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: