3 ms·
TGA files still show up in video game textures surprisingly often
by Macha 5y ago
TGA files still show up in video game textures surprisingly often
- klodolph 5y agoThat'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.
- jfrunyon 5y agoI believe PNG supports uncompressed files, usually with a compression level = 0.
- klodolph 5y agoThe 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).
- jfrunyon 5y ago... what decoding needs to be done on a series of literal blocks?
- NL807 5y agoNot 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.
- jamesfinlayson 5y agoHalf-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).
- Impossible 5y agoWhen 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.