What ARE DDS files?

Blitz3D Forums/Blitz3D Beginners Area/What ARE DDS files?

Neochrome(Posted 2006) [#1]
Just out of curiousity, i've been working with PNG JPG and BMP files for ever when writing games
the Obvious question i actually dont know is

What are DDS textures, whats their advantages and what should i use them for?
i've also noted that DDS files can be loaded into BSP files.. but i dont know what this difference are. :-(


t3K|Mac(Posted 2006) [#2]
snippet from wikipedia:

The Microsoft DirectDraw Surface (.dds) file format is used to store textures and cubic environment maps, both with and without mipmap levels. This format can store uncompressed and compressed pixel formats, and is the preferred file format for storing DXTn compressed data. This file format is supported by the Microsoft DirectX Texture tool (DXTex Tool), as well as some third party tools, and by the Direct3D extensions (D3DX) library.


in short, DDS textures take less space im ram (usually 1/4 to 1/6 of the original size, depends on the texture though) but still look pretty good.


bradford6(Posted 2006) [#3]
Compressed Textures

Microsoft DirectDraw Surface (.dds) file format.

up 8:1 compression.

will work with OpenGL as well:
The DXT formats are a standard part of the Direct3D API and are available for the OpenGL API through the ARB_texture_compression and GL_EXT_texture_compression_s3tc extensions.

S3TC because it was S3 graphics that created ito show off their awesome Savage3D cards. (they actually werent that bad, I had one but Nvidia/ATI has since dominated the market)


AJirenius(Posted 2006) [#4]
I don't get it...

Isn't *.png a compressed format as well. Whats the new thing with .dds then?
Is it faster?


bradford6(Posted 2006) [#5]
.png .jpg etc are compressed image formats.

.dds is a compressed texture. this means that your video Card is handling the decompression/displaying of it.


t3K|Mac(Posted 2006) [#6]
png & jpg textures will be decompressed in your video cards ram. DDS won't.


t3K|Mac(Posted 2006) [#7]
@mark: will readpixel&writepixel be possible with DDS textures?


Moraldi(Posted 2006) [#8]
In which way Blitz3D can use DDS textures?


Mustang(Posted 2006) [#9]

In which way Blitz3D can use DDS textures?



Like you would use any other textures for your models - Fredborg even made a tool that can replace .TGA references inside old (before .DDS support made) .B3D models to .DDS so that when you load a model it automatically uses compressed textures instead of .TGA.

.DDS isn't the best choice for everything, like smooth gradients and menu background images and such. But I'd recommended using it for game model/enviroment textures.


Naughty Alien(Posted 2006) [#10]
..same as JPG, PNG...load and apply them on to model..


Neochrome(Posted 2006) [#11]
thanks guys. That clears things up


jfk EO-11110(Posted 2006) [#12]
You cannot use Writepixel etc with dds textures since TextureBuffer(dds_texhandle) will always return zero.

IMHO the most fantastic use of the new DDS textures are masked textures. Unlike the blocky contours of masked BMP etc. masked DDS will use a bezier curve for the mask outline. In short: it looks much better.

All you have to do is save it as DXT3 or DXT5 with alpha information (for photoshop users: alpha not on an additional channel, but as "unpainted" pixels on the standard RGB channels, aka checkerboard-nothing shine trough). Then simply load it with the mask flag. This also fixes the "fade to black" outline artefacts seen with black masked BMPs aso.


t3K|Mac(Posted 2006) [#13]
"You cannot use Writepixel etc with dds textures since TextureBuffer(dds_texhandle) will always return zero."

this would be awesome if mark could enable this...


jfk EO-11110(Posted 2006) [#14]
Remember they are hanging around in compressed format in the Vram...


Mustang(Posted 2006) [#15]
Yup, you'd have to uncompress it, do the pixelstuff and then re-compress it... that would be slow. If you need textures with WritePixel capabilities just don't use compressed format.


t3K|Mac(Posted 2006) [#16]
but thats bad, cause i have several big lightmaps (1024x1024, nearly 10 of it) - and they are eating up loooots of vram. as DDS this is no problem. at least readpixel should work. then i could access the lightmaps for proper lighting of my characters.


Mustang(Posted 2006) [#17]
t3K|Mac, you can always make half-size (actually 1/4) duplicates (512*512), load them as non-compressed, and use them for reading the light info. Together with compressed 1K maps you still save 75% VRAM compared to your current situation / non-compressed 1K lightmaps.

[if my calculations are correct: big lightmaps DXTCd are 1/8 of original size, and 512 "dummy" lightmaps are 1/4 of the original size)


t3K|Mac(Posted 2006) [#18]
this is a good point. never thought of this.... sometimes its just too simple to check it out by myself ;). thanks man.


Neochrome(Posted 2006) [#19]
is it me but is the DSS textures making the 3D world render quicker too?? im gaining a few extra FPS out of my written games just by converting my jpg bmp to DDS alone!


Dreamora(Posted 2006) [#20]
Its faster as the upload time from RAM to VRAM is shorter due to the lower size. (or because they don't need any uploading at all because the VRAM isn't used to the same amount as with uncompressed)


Neochrome(Posted 2006) [#21]
well i guess im going straight too DSS then!! no mucking about! lol... the other textures work as normal too dont they? providing i dont need to write to them in anyway


jfk EO-11110(Posted 2006) [#22]
Maybe dds is not the best choice for lightmaps. Cause (not sure if that is possible at all) you need to save a lightmap dds as a lossless compressed texture. This way it won't be that much smaller than a bmp in Vram. When you use lossy textures for the lightmap (eg. the photoshop plugin default settings for dxt1) then there will be artefacts of bleeding edges and/or wrong colors on edges, as well as the common jpg-ish compression artefacts that are interrupting smooth gradients.


t3K|Mac(Posted 2006) [#23]
thats ok for me. considering the little amount of ram used, i can live with those artefacts.