PDA

View Full Version : DDS file information?



Diapolo
01-01-2003, 04:41 PM
Hi,

I currently use the DDS format for S3TC compressed 2D textures only, but I would like to use it for cubemaps or even volume maps.
Where can I get a detailed explanation about the format and how cubemaps are stored and all that stuff.

I know the MS tool called dxtex.exe, but if I load a S3TC compressed texture all I see is a white texture, dunno why.
The DX9 version doesn´t even start http://www.opengl.org/discussion_boards/ubb/frown.gif.
The error message I get is:
Unable to create D3D device.
Please make sure your desktop color depth is set to 16 or 32 bit.

So currently the only tool I can use is the S3TC Tool 1.01 from S3.

Anyone an idea for that?

Diapolo

zed
01-01-2003, 08:52 PM
>>I know the MS tool called dxtex.exe<<

u can get the source to that in the dx8 download (its pretty thorough with loading the various types of dds textures)
IIRC the only thing it doesnt include is a structure DDSURFACE (or something) but u can find thie contents of this structure elsewhere

Diapolo
01-01-2003, 10:44 PM
OK, I found an explanation in the MSDN.

DDS file layout: http://msdn.microsoft.com/library/en-us/dx8_c/directx_cpp/Art/DDSFileLayout.gif

Someone correct me, if I´m wrong.
The bData2 surface data should start at:
sizeof(Magic Value) + sizeof(Surface Format Header) + sizeof(bData1)

If that´s true, it seems pretty easy to write a full dds file reader http://www.opengl.org/discussion_boards/ubb/smile.gif.

Diapolo

Diapolo
01-01-2003, 10:58 PM
Originally posted by zed:
>>I know the MS tool called dxtex.exe<<

u can get the source to that in the dx8 download (its pretty thorough with loading the various types of dds textures)
IIRC the only thing it doesnt include is a structure DDSURFACE (or something) but u can find thie contents of this structure elsewhere


Is there any imaging software, that supports dds files?
I really need something like the dxtex tool, so that I can convert between various dds formats, add volume slices or cube map faces. Best would be, if the dxtex tool would work though.

Diapolo

DFrey
01-02-2003, 07:11 AM
Actually, I hate the dxtex tool. It works perfectly fine for me, but I hate how it obscures (i.e. screens) the image with the chosen background color. I can't find any background color that will just let me see the image clearly. Sometimes converting the formats to R8G8B8 will remove the background color, but not always. If I remember correctly, there is a dds plugin for PS and PSP.

jwatte
01-02-2003, 08:40 AM
The nVIDIA developer site has a bunch of "texture compression tools" which contain plug-ins for 3dsmax and Photoshop to deal with DDS files. These tools are fairly solid.

The size of a DDS header is 128 bytes. The data comes after that. If you know the format of the data beforehand, it's VERY easy to read :-) Even if you don't, all you need to do is mirror the declaration of DDSURFACEDESC2 or whatever that struct is.

I'm sure there's lots of code out there, but my flavor of it is found at: http://www.mindcontrol.org/~hplus/dds-info/

jra101
01-02-2003, 08:45 AM
You can find a DDS loader that supports 1D, 2D, rectangle, volume, and cubemap textures, with mipmaps in the NVIDIA SDK (Cg Toolkit). Works on Mac (OSX)/Linux/Windows.

Direct links to header/cpp:
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 01-02-2003).]