Using PNG for a 3D game.
to backup what hplus0603 said, png is designed mainly for webpages which it does well at, its not designed for games.the best for games is dds
I don't think PNG is entirely unsuitable for games... especially 2D games (maybe not for texturing 3D models though, not sure). Think about it:
pros:
-lossless
-Indexed or pixmapped color(depending on your needs)
-Very flexible color index system compared with others
-Better alpha channel than some other formats (who work often with a on/off style alpha channel, whereas PNG has 8 bits of alpha per pixel if enabled)
cons:
-pixmapped PNGs can be very large
-loading a PNG image requires decompressing compressed data blocks (MAY result in a slight performance hit)
look at the alternatives though:
GIF and similar spec:
-most other indexed formats have a fixed number of color indexes, whereas with PNG you can have as little as you need
for pixmapped images:
Targa have worse alpha channel and similar RLE / index color issues as GIF.
JPEG not lossless!
I mean overall, PNG isn't really a bad choice of format, especially because of the powerful alpha channel, it's not really "only" good for web use. The downside is that it CAN be relatively difficult (everything is relative) to implement if you don't want to contaminate your code with gpl'd code
pros:
-lossless
-Indexed or pixmapped color(depending on your needs)
-Very flexible color index system compared with others
-Better alpha channel than some other formats (who work often with a on/off style alpha channel, whereas PNG has 8 bits of alpha per pixel if enabled)
cons:
-pixmapped PNGs can be very large
-loading a PNG image requires decompressing compressed data blocks (MAY result in a slight performance hit)
look at the alternatives though:
GIF and similar spec:
-most other indexed formats have a fixed number of color indexes, whereas with PNG you can have as little as you need
for pixmapped images:
Targa have worse alpha channel and similar RLE / index color issues as GIF.
JPEG not lossless!
I mean overall, PNG isn't really a bad choice of format, especially because of the powerful alpha channel, it's not really "only" good for web use. The downside is that it CAN be relatively difficult (everything is relative) to implement if you don't want to contaminate your code with gpl'd code
If you decide to go with PNG, I *strongly* recommend Corona as image loader library.
It's open source, independent of SDL, so easy to use and supports also other formats like JPG, BMP and TGA.
Lutz
It's open source, independent of SDL, so easy to use and supports also other formats like JPG, BMP and TGA.
Lutz
Quote:Original post by AAAP
Targa have worse alpha channel and similar RLE / index color issues as GIF.
What's the problem with the alpha channel in TGAs ?
Quote:Original post by AAAP
The downside is that it CAN be relatively difficult (everything is relative) to implement if you don't want to contaminate your code with gpl'd code
libpng: no GPL/LGPL contamination, no SDL dependencies. Problem solved.
In targa, alpha is boolean, it's not "wrong" per se (i use targa), but it's not as powerful as that found in PNG
I would say you are wrong. IIRC TGA transparency is (or at least can be) 8-bits as other (R, G and B) components.
Just my 2 cents...
Just my 2 cents...
I back the recommendation for DDS. Historically, DDS stands for "DirectDraw Surface," because the format was just a dump of one or more DirectDraw surfaces; transferring to and from a DDS file from a surface was trivial. DirectDraw surfaces are now Direct3D surfaces, but the principle remains the same - it means that anything you can store in a D3D surface (including indexed/paletted data) can be stored in a DDS file.
The DXT compression can also be a really big win, too, because you generally don't need to decompress it on load (modern hardware supports it directly).
The DXT compression can also be a really big win, too, because you generally don't need to decompress it on load (modern hardware supports it directly).
Quote:Original post by AAAP
In targa, alpha is boolean, it's not "wrong" per se (i use targa), but it's not as powerful as that found in PNG
Alpha is not boolean in Targas. It is usually 8 bit (ie. standard 32bit RGBA data), but the format can even support a 32bit alpha channel (128 bit RGBA). Although the latter is usually not supported by common graphics applications.
Quote:Original post by AAAP
-pixmapped PNGs can be very large
I have to ask what was meant by this as I'm genuinely
curious. Surely an uncompressed PNG will be exactly the
same size as any other uncompressed format in memory?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement