DDS
DDS, or DirectDraw Surface, is a widely used texture container format that is able to store several forms of image data in both compressed and uncompressed forms. Fallout 3 and Fallout: New Vegas use D3D9 which supports around 60 formats, but commonly only five are used both in game and by modders.
Brief Introduction
DDS commonly uses a Block Compression library called DirectXTex. Block Compression is a lossy method of condensing colors into 4x4 blocks of pixels at either 64 or 128-bits, depending on the compression codec. This method of encoding blocks in 4x4 pixels causes a minimum resolution of 4x4 and requires resolution to follow a power of 2 (i.e. multiples of 2/4/8/16, etc. 16x32 is fine but 61x23 is not) and textures below this resolution can cause issues up to and including crashes. Individual color channels are limited to either 5 (Red/Blue), 6 (Green), or 8-bits (ARGB), and alpha ranges from 1 (DXT1) to 8-bits (DXT5/ARGB). It also features the ability to store sequentially smaller images (mipmaps) to alleviate aliasing of textures when viewed from afar.
DDS Formats
Format | Description |
---|---|
DXT1 | Stores either RGB at 5:6:5 bits-per-color and does not have an alpha channel. If your texture doesn't have an alpha channel, it is recommended to use DXT1. |
DXT1 (Alpha) | Stores RGB at 5:5:5 bits-per-color with 1-bit of alpha (on or off). One bit of green is effectively taken away to be used for the alpha channel, and color depth is slightly worse. Only recommended to be used with meshes that require Test alpha. Due to quirks in how DXT1 alpha works, transparent edges from Test alpha may appear darker or black. |
DXT3 | Stores RGB identically to standard DXT1 and supports alpha at 64-bits. DXT3 handles alpha values explicitly and does not treat underlying pixels as premultiplied by alpha, which results in sharper or more defined transparent edges. Only recommended for UI textures. |
DXT5 | Stores RGB identically to standard DXT1 and supports alpha at 64-bits. DXT5's alpha is interpolated and can produce smoother gradients than DXT3. Recommended to use if your texture contains alpha. |
ARGB (8.8.8.8) | Stores RGBA at 8:8:8:8 bits-per-color, practically uncompressed. If you are aiming for absolute quality, then ARGB is your only real option outside of higher resolution textures. Severe memory footprint, can quickly cause out of memory errors if too many textures in the scene are uncompressed. |
Cubemaps
Cubemaps use either DXT1 or ARGB, however they require textures to be laid out in a 1:6 ratio lengthwise (i.e. vertically 32 by 192 horizontally) to be exported, if your exporter supports them.
Mipmaps
Mipmaps are used to reduce visual artifacts from textures viewed at far distances. Most editing programs will create new mipmaps on export, but you can set your own if you wish to make a texture "morph" depending on viewing distance. Mipmaps also serve to improve performance, as renderers average the pixels of distantly rendered textures down to something more logical for the camera's viewpoint, and the lower resolution of a mipmap requires far less calculations to average than a full resolution texture, therefore performance can be severely impacted if several textures in your scene lack mipmaps altogether. The only textures you should not have mipmaps for are UI elements as they are 2D elements and have no depth in 3D space.
Notes
- DDS quality is dependent on the exporter, and can vary wildly depending on the program. Best seems to be Crunch and Nvidia Texture Tools, with Nvidia's DDS plugins for Photoshop being the best exporter for dedicated photo editors. From testimonials, GIMP's DDS exporter has severe issues with bicubic artifacts and can export textures incorrectly, causing them to appear completely black in game.
- BC artifacts can be "cleaned up" rather well using an ESRGAN model such as BCGone and textures can look close to before they were compressed. This is not a magic process as BCGone can and will erase or smooth out very fine details and images usually require a light sharpening pass before they match the original texture.
See Also
- Nvidia's DDS plugin for Photoshop (Old) on the Skyrim Nexus
- Paint.NET
- Crunch on Github
- S3 Texture Compression on Wikipedia
- All supported D3D9 DDS formats on Microsoft's official documentation