DDS Image Format
DDS (DirectDraw Surface) is a texture container format designed for GPU-ready
You are a file format specialist with deep knowledge of the DDS texture format, GPU block compression algorithms, mipmap chains, and real-time 3D graphics texture pipelines. ## Key Points - **File extension(s):** `.dds` - **MIME type:** `image/vnd.ms-dds` (unofficial) - **Compression formats:** - **BC1 (DXT1):** 4:1 compression, RGB + optional 1-bit alpha. 4 bits/pixel. - **BC2 (DXT3):** RGB + explicit 4-bit alpha. 8 bits/pixel. - **BC3 (DXT5):** RGB + interpolated 8-bit alpha. 8 bits/pixel. Most common for general textures. - **BC4 (ATI1):** Single channel (grayscale, roughness, height). 4 bits/pixel. - **BC5 (ATI2):** Two channels (normal maps: X+Y components). 8 bits/pixel. - **BC6H:** HDR RGB (half-float), no alpha. 8 bits/pixel. For HDR textures and lightmaps. - **BC7:** High-quality RGB/RGBA. 8 bits/pixel. Best quality for general textures, slower to encode. - Also supports uncompressed formats (R8G8B8A8, R16G16B16A16F, R32G32B32A32F, etc.) - **Color depth:** Varies by format: 4-128 bits per pixel. BC formats store 4x4 pixel blocks.
skilldb get file-formats-skills/DDS Image FormatFull skill: 204 linesDDS (.dds)
You are a file format specialist with deep knowledge of the DDS texture format, GPU block compression algorithms, mipmap chains, and real-time 3D graphics texture pipelines.
Overview
DDS (DirectDraw Surface) was introduced by Microsoft as part of the DirectX SDK. Originally designed for DirectDraw (DirectX 7, 1999), it evolved into the primary texture container format for DirectX-based applications and games. DDS stores textures in GPU-native compressed formats (BCn/DXTn), meaning the data can be uploaded directly to the GPU without CPU-side decompression. This enables faster load times and lower memory usage compared to formats that require decompression before GPU upload. DDS supports mipmaps, cube maps, volume textures, and texture arrays. It is the standard texture format for DirectX games and is widely supported in Windows game development toolchains. The DX10 header extension (2006) added support for modern compressed formats and resource arrays.
Core Philosophy
DDS (DirectDraw Surface) is a GPU-native texture format designed for real-time 3D graphics. Unlike image formats intended for viewing (JPEG, PNG, WebP), DDS stores texture data in formats that GPUs can decompress directly in hardware — block-compressed formats like BC1-BC7 (also known as DXT1-DXT5 and their successors). This means DDS textures can be loaded into video memory and rendered without CPU-side decompression, a critical performance advantage in games and real-time applications.
The philosophy behind DDS is render performance over visual quality or file size efficiency. A BC1-compressed DDS texture has a fixed 6:1 compression ratio regardless of content, with compression artifacts that would be unacceptable in a photograph but are imperceptible at typical viewing distances in a 3D scene. This predictable memory footprint and zero-decode-cost loading is what makes DDS essential for game engines and GPU-intensive applications.
DDS is not an interchange or web format. Use it exclusively in GPU rendering pipelines (game assets, 3D applications, VR/AR content) where its hardware decompression advantage matters. For image editing, exchange, or web delivery, convert to PNG (lossless) or JPEG/WebP (lossy). Most game engines and 3D tools handle DDS conversion automatically as part of their asset pipeline.
Technical Specifications
- File extension(s):
.dds - MIME type:
image/vnd.ms-dds(unofficial) - Compression formats:
- BC1 (DXT1): 4:1 compression, RGB + optional 1-bit alpha. 4 bits/pixel.
- BC2 (DXT3): RGB + explicit 4-bit alpha. 8 bits/pixel.
- BC3 (DXT5): RGB + interpolated 8-bit alpha. 8 bits/pixel. Most common for general textures.
- BC4 (ATI1): Single channel (grayscale, roughness, height). 4 bits/pixel.
- BC5 (ATI2): Two channels (normal maps: X+Y components). 8 bits/pixel.
- BC6H: HDR RGB (half-float), no alpha. 8 bits/pixel. For HDR textures and lightmaps.
- BC7: High-quality RGB/RGBA. 8 bits/pixel. Best quality for general textures, slower to encode.
- Also supports uncompressed formats (R8G8B8A8, R16G16B16A16F, R32G32B32A32F, etc.)
- Color depth: Varies by format: 4-128 bits per pixel. BC formats store 4x4 pixel blocks.
- Max dimensions: 2^16 (65,536) pixels per dimension (limited by DDS header fields)
- Mipmaps: Full mipmap chain support (each level is half the dimensions of the previous)
- Texture types: 2D texture, cube map (6 faces), volume/3D texture, 1D texture, texture arrays (DX10 extension)
- Transparency: BC2 (4-bit alpha), BC3 (interpolated 8-bit alpha), BC7 (high-quality alpha), or uncompressed RGBA
- Metadata support: Minimal (header contains format info, dimensions, mip count, caps flags)
How to Work With It
Opening & Viewing
- Windows: Native thumbnail support (recent versions), Visual Studio texture viewer
- DirectX Texture Tool: Microsoft's official viewer (legacy, from DirectX SDK)
- RenderDoc: GPU debugger that can inspect DDS textures
- NVIDIA Texture Tools Exporter: View and convert DDS files
- IrfanView/XnView: With DDS plugin
- GIMP: Via DDS plugin (gimp-dds)
- Photoshop: Via NVIDIA Texture Tools plugin or Intel Texture Works plugin
- Paint.NET: Via DDS plugin
Creating & Editing
- NVIDIA Texture Tools (nvtt):
nvcompress -bc3 input.png output.dds(command line) - DirectXTex (texconv):
texconv -f BC7_UNORM -m 0 input.png(Microsoft's tool, generates mipmaps with-m 0) - Compressonator (AMD): GUI and CLI for texture compression with quality preview
- ISPCTextureCompressor (Intel): Very fast BC1-BC7 encoder using ISPC SIMD
- Mipmap generation: Always include mipmaps for 3D rendering textures. Most tools generate them automatically.
- Normal maps: Use BC5 (two-channel) format; reconstruct Z in the shader. Do NOT use BC1/BC3 for normal maps (visible artifacts).
- sRGB vs Linear: Mark color textures (albedo/diffuse) as SRGB format variants (e.g., BC7_UNORM_SRGB). Mark data textures (normal, roughness, metallic) as LINEAR.
Converting To/From
- PNG to DDS:
texconv -f BC7_UNORM_SRGB -srgb -m 0 -y input.png - DDS to PNG:
texconv -ft png -o . input.ddsormagick input.dds output.png - TGA to DDS:
texconv -f BC3_UNORM -m 0 input.tga - Batch convert:
texconv -f BC7_UNORM -m 0 -r *.png - HDR to DDS:
texconv -f BC6H_UF16 -m 0 input.hdr(for IBL/environment maps) - Python:
from PIL import Image; import struct(manual parsing) or usewandlibrary with ImageMagick delegate
Common Use Cases
- Game texture assets (diffuse, normal, specular, roughness, metallic, emissive, AO maps)
- Environment/cube maps for reflections and skyboxes
- Lightmaps (BC6H for HDR light data)
- UI textures in games and real-time applications
- Terrain textures (often large texture arrays)
- Particle effect textures (with alpha for soft particles)
- Decal textures
- Virtual texturing source data
Pros & Cons
Pros:
- GPU-native compression (no CPU decompression needed; uploaded directly to VRAM)
- 4:1 to 8:1 fixed-ratio compression reduces VRAM usage dramatically
- Built-in mipmap support eliminates aliasing and improves texture filtering
- Cube map and texture array support
- BC7 provides excellent quality at 8 bits/pixel
- BC6H enables HDR textures at compressed sizes
- Fast random access (any pixel decodable without reading entire file)
- Industry standard for DirectX game development
Cons:
- Lossy block compression introduces artifacts (blocky patterns on gradients)
- Block compression operates on 4x4 pixel blocks (textures should be multiples of 4)
- DDS-specific tools required (not viewable in web browsers or standard image viewers)
- Encoding BC6H/BC7 is computationally slow (ISPCTextureCompressor helps)
- Windows/DirectX-centric (OpenGL/Vulkan ecosystems often prefer KTX/KTX2)
- No metadata or color management
- Legacy header format can be confusing (DX9 vs DX10 headers)
- Not suitable for general image interchange
Compatibility
| Platform | Support |
|---|---|
| DirectX / Direct3D | Native (the defining API) |
| Unreal Engine | Native texture import |
| Unity | Native texture import |
| Godot | Supported |
| NVIDIA tools | Full |
| AMD Compressonator | Full |
| Photoshop | Via plugin (NVIDIA/Intel) |
| GIMP | Via DDS plugin |
| OpenGL/Vulkan | Can load BC textures (but KTX format preferred) |
| Web browsers | Not supported |
Practical Usage
Convert textures to DDS with Microsoft's texconv
# Convert albedo texture to BC7 with sRGB gamma and full mipchain
texconv -f BC7_UNORM_SRGB -srgb -m 0 -y albedo.png
# Convert normal map to BC5 (two-channel, linear)
texconv -f BC5_UNORM -m 0 -y normal_map.png
# Convert HDR environment map to BC6H
texconv -f BC6H_UF16 -m 0 -y environment.hdr
# Batch convert all PNGs to BC7 with mipmaps
texconv -f BC7_UNORM_SRGB -m 0 -r -y textures/*.png -o output/
Read DDS metadata and extract layers with Python
# Using imageio or wand to inspect DDS files
from pathlib import Path
import struct
def read_dds_header(filepath):
"""Parse DDS header to extract format info."""
with open(filepath, 'rb') as f:
magic = f.read(4)
assert magic == b'DDS ', "Not a DDS file"
header = f.read(124)
height = struct.unpack_from('<I', header, 8)[0]
width = struct.unpack_from('<I', header, 12)[0]
mip_count = struct.unpack_from('<I', header, 24)[0]
fourcc = header[72:76].decode('ascii', errors='replace')
print(f"Size: {width}x{height}, Mipmaps: {mip_count}, FourCC: {fourcc}")
# Convert DDS to PNG via ImageMagick (from Python subprocess)
import subprocess
subprocess.run(["magick", "texture.dds", "texture.png"], check=True)
Game engine texture import pipeline (Unreal/Unity)
# Unreal Engine — import textures via command line (UnrealPak)
# Textures placed in Content/Textures/ are auto-imported as BC7/BC5
# Unity — use TextureImporter settings in an Editor script:
# TextureImporter.textureCompression = TextureImporterCompression.CompressedHQ
# For normal maps: TextureImporter.textureType = TextureImporterType.NormalMap
# Validate DDS textures before import
for f in *.dds; do
texconv -nologo -info "$f"
done
Anti-Patterns
Using BC1/BC3 for normal maps instead of BC5. BC1 and BC3 compress all channels together, introducing cross-channel artifacts that cause visible shading errors on normal-mapped surfaces. Use BC5 which stores X and Y channels independently, and reconstruct the Z component in the shader with z = sqrt(1 - x*x - y*y).
Forgetting to generate mipmaps for 3D rendering textures. Textures without mipmaps cause aliasing, shimmering, and moire patterns when viewed at a distance. Always generate a full mipmap chain (-m 0 in texconv) for any texture used in real-time 3D rendering. Only skip mipmaps for UI/HUD textures rendered at 1:1 pixel scale.
Marking data textures (normal, roughness, metallic) as sRGB. Data textures contain linear values that are not meant for display. Tagging them as sRGB causes the GPU to apply gamma correction during sampling, producing incorrect lighting. Use _UNORM (linear) format variants for all non-color textures; only albedo/diffuse textures should use _SRGB.
Using uncompressed RGBA for textures that could be block-compressed. Uncompressed 32-bit RGBA uses 4x-8x more VRAM than BC-compressed equivalents. A 4K RGBA texture uses 64 MB uncompressed vs 16 MB with BC7. Always use block compression for runtime textures unless you need exact pixel values (e.g., lookup tables).
Creating textures with dimensions that are not multiples of 4. BC compression operates on 4x4 pixel blocks. Non-multiple-of-4 dimensions cause the encoder to pad the texture, wasting memory and potentially creating edge artifacts. Always use power-of-two or at minimum multiple-of-4 dimensions for DDS textures.
Related Formats
- KTX / KTX2: Khronos texture container for OpenGL/Vulkan; supports ASTC, ETC2, and BCn compression
- ASTC: Adaptive Scalable Texture Compression (ARM/Khronos); more flexible block sizes, preferred on mobile GPUs
- ETC2: Ericsson Texture Compression; required by OpenGL ES 3.0, used on Android
- PVRTC: PowerVR Texture Compression (Imagination Technologies); used on older iOS devices
- Basis Universal (.basis): Binomial/Google supercompressed format that transcodes to any GPU format at runtime
- TGA/PNG: Source texture formats that are converted to DDS during the game build pipeline
- EXR: HDR source format; BC6H DDS is the GPU-compressed runtime equivalent
Install this skill directly: skilldb add file-formats-skills
Related Skills
3MF 3D Manufacturing Format
The 3MF file format — the modern replacement for STL in 3D printing, supporting colors, materials, multi-object assemblies, and precise manufacturing data in a single package.
7-Zip Compressed Archive
The 7z archive format — open-source high-ratio compression using LZMA2, with strong AES-256 encryption, solid archives, and multi-threading support.
AAC (Advanced Audio Coding)
A lossy audio codec standardized as part of MPEG-2 and MPEG-4, designed to supersede MP3 with better quality at equivalent or lower bitrates.
AC3 (Dolby Digital)
Dolby's surround sound audio codec used in cinema, DVD, Blu-ray, and broadcast television for multichannel 5.1 audio delivery.
AI Adobe Illustrator Format
AI is Adobe Illustrator's native vector graphics file format, used for
AIFF (Audio Interchange File Format)
Apple's uncompressed audio format storing raw PCM data, serving as the Mac equivalent of WAV for professional audio production.