What is the best image format for textures?

Are there any good references for image formats?

Thanks for the help.

If you’re not bothered about space use .TGA’s

. They’re lossless. So ideal for storing normal maps.
. They support alpha channels.
. They’re bloody easy to decode. I have some code on my site in some of my demos that will do it. non-compressed and RLE, 24 and 32bit.
http://opengl.nutty.org/

Else try Jpegs, but not for normal maps, cos the artifacting makes normal maps look crap.

You could try PNG, but not all PNG supporting programs support PNG alpha. i.e. Photoshop 6. They’re also lossless.

Nutty

Try the DDS format. It can store 1D, 2D, 3D, and cubemap textures, with their mipmaps, in a single file.

Another nice feature is support for the DXTC compression format which is supported natively by the hardware so you won’t need to be uncompress it before sending it to the video card.

Are there libraries out there that support DDS?

NOt including the Direct utility package.

V-man

Try the DDS loader I wrote:
http://cvs1.nvidia.com/OpenGL/include/shared/nv_dds.h
http://cvs1.nvidia.com/OpenGL/src/shared/nv_dds.cpp

[This message has been edited by jra101 (edited 11-26-2002).]

… or grab the Image.cpp file from my framework at http://humus2.campus.luth.se/~humus/

DDS is the preferred vehicle for textures compressed using S3TC (DXTn). Using this compression will give you a 4x texture fetch rate boost compared to 16-bit textures, at an often acceptable quality loss. DDS files can also store MIP maps pre-calculated, which saves a little CPU when loading (and, if they’re compressed, it’s almost impossible to generate good MIP maps at load time).

nVIDIA has a Photoshop DDS plugin on their web site, as well as a Max ditto.

To load a DDS, you read the first 512 (or 128? I forget) bytes into a DDSURFACEDESC2 (minus a few header bytes), assert that the compression format is what you expect, get the width/height from the header, and then read the appropriate amount of data from the file after the header. (bytecount = width*height/2) MIP maps are just stored consecutively after that.

Last, both DXTC and DDSURFACEDESC2 and the DDS file format are documented on MSDN and/or in the DirectX 8 SDK, all of which are freely available on Microsoft’s web site.

I´m using the DDS format, too (currently my loading function only supports DXT1, DXT3 and DXT5 compressed textures with or without mipmaps).
I really like it .

For Normalmaps I use the RAW-Image format.
It has got not header, only the data, but it´s pretty easy to handle, but only Paint Shop Pro seems to support that format to my knowledge …

Diapolo

PNG support an arbitrary number of layers, so it can store Cube Maps as well (using 6 layers).
The format also support (though libpng is a bit buggy here) arbitrary channels’ depth so it fits perfectly 32-bit channel needs for ng cards…

Julien.

V-Man: wrote

Are there libraries out there that support DDS?

DevIL supports DDS loading.

http://openil.sourceforge.net/

…and they have a cool logo.

Definitely use a library for this. Nobody should be wasting time writing their own file loaders without good reason. I’d recommend PNG files personally, they include lossless compression, support alpha and luminance alpha formats, are supported in many packages and can be viewed casually in applications like web browsers and support gamma information making platform of creation a non issue. You can also get libpng straight from the horses mouth if you care.

I like PNG’s, but I have really found a lot of nice features in TIFF’s. They offer a lot more flexibility then PNG’s and they can support deflate compression like PNG’s too.

The only problem is that most of the nice features aren’t supported in art programs. (32-bit float images, volume images, etc)

-Evan

Originally posted by ehart:
The only problem is that most of the nice features aren’t supported in art programs. (32-bit float images, volume images, etc)

FilmGimp is a 32-bit per channel enabled version of Gimp. Maybe it support 32-bit float TIFFs, I’m not sure.

Julien.

i made an greyscale image the other day where is each pixel is a difference from its neighbouring pixel (basically gives u high (difference) resolution with minimum memory)
anyways has this been done before?
ie did i waste my time writing the code when an already existing image format exists already ( ) most likely of better quality.
and if so whats the nme of this image format?
ta

PNG uses neighboring difference as one of the possible filters that you can use before actually compressing the image; this will lead to better compression ratio for certain classes of images.

The idea (coding deltas instead of absolutes) is fairly old (and it’s been used for audio, too) but I can’t think of any popular format that actually uses it as the main image coding format these days.

Oh, speaking about grayscale images: the .DDS plug-in for Photoshop (from nVIDIAs site) won’t let you save a grayscale image; it can only save various RGB images, plus paletted; and evenso, it doesn’t accept an indexed input image. I knew there was a reason for good-old TGA to stick around :slight_smile: