As far as I can see, BGE supports jpeg2000 textures. This presents a number of advantages! Jpeg2000 images offer alpha transparency AND lossy encoding, making them superior to PNGs and JPEGs in many cases.
But somehow it remains an unpopular format. Has anyone had experience with this format in the context of the game engine? Are there any good batch conversion apps for Linux that export to jp2? The quality/size ratio is better, but would there be extra computational overhead with many textures? Cross-platform issues?
The lossy encoding is the problem, it’s generally not good for image quality but game textures particularly suffer from lossy encoding (especially textures that aren’t strictly used for image data, like normal maps). PNG and TIFF offering lossless compression make them significantly better. You might save a little bit of hard drive space with lossy compression but it’s at a significant cost in quality, and when textures are moved to the video card they’re stored without compression at all regardless of what the source format was- so you’re not saving on VRAM.
The lossy encoding is the problem, it’s generally not good for image quality but game textures particularly suffer from lossy encoding (especially textures that aren’t strictly used for image data, like normal maps). PNG and TIFF offering lossless compression make them significantly better. You might save a little bit of hard drive space with lossy compression but it’s at a significant cost in quality, and when textures are moved to the video card they’re stored without compression at all regardless of what the source format was- so you’re not saving on VRAM.
jp2 supports lossless compression as well, and the resulting file size is still smaller on the tests I’ve run. Also, storage space is not a trivial issue- especially if you want others to download your game. If you’ve got gigabytes of images textures, using lossy compression properly can greatly reduce package size in exchange for a barely noticeable degradation in quality (I know this is true for animation, at least). So I’m still unconvinced.
But you are right that everything is uncompressed in VRAM, so I guess my concern is what kind of overhead might be involved in getting those stored textures onto the video card. Is it possible that jpeg2000 images might simply NOT work on certain video cards, or take way too long to load in comparison to JPEGs or PNGs?
When it’s lossless then Jpeg2k is no bad choice. But it seems that it is lossy. Wiki tells about block artifacts. And it is more effort to decode. And Jpeg2k is uncommon. There are more popular formats like PNG.
And when your concern is the graphics card then i would go with DDS. Jpeg 2K can still not compress in video ram. DDS does.
Yes, why not use DDS?
DDS textures are pretty small, they are compressed, so the image is not as good as the original, but they’re much faster to render as they are decompressed directly by the graphics card.
There’s a plugin for the GIMP for exporting in DDS. There are several types of compression you can choose, but you need the right one for your project (though you can mix and match for different textures on different models).
DXT1 compression is 8:1 ratio, meaning small files that render quickly. it has a 1 bit alpha, so it’s only good for clip alpha.
DXT5 is 4:1 ratio, so it is a bigger file, but loses less quality. It’s good for normal maps or things that need blended alpha, like hair or water.
All the other compression types are specialist things which might be used by a particular commercial game but are probably useless to you unless you really know what you’re doing.
I hear that blender can use DDS mipmaps these days, so it’s worth generating mipmaps when you export the image.
Hereis a good article about the different compression types. Sorry about the domain name of the article, it’s not my site. Don’t let that put you off though, it’s a pretty good explanation of DDS texture compression types.