Microsoft DirectX 8.1 (C++)

DDS File Layout for Volume Textures

A volume texture is an extension of the standard texture for Microsoft® DirectX® 8.x, and can be defined with or without mipmaps. If a file contains a volume texture, DDSCAPS_COMPLEX, DDSCAPS2_VOLUME, DDSD_DEPTH, and dwDepth should be set. For volumes without mipmaps, each depth slice is written to the file in order. If mipmaps are included, all depth slices for a given mipmap level are written together, with each level containing half as many slices as the previous level with a minimum of 1. Volume textures do not support DXTn compression as of DirectX 8.0.

For example, a 64 x 64 x 4 volume map, a pixel format of R8G8B8 (3 bytes per pixel), and all mipmap levels would contain:

"DDS ",
(64, 64, 4),
(pitch=768),
(pixel format=R8G8B8, bitcount=24),
(mipmapcount=7),
(DEPTH, TEXTURE, PITCH, COMPLEX, MIPMAP, VOLUME, RGB)
128 bytes
64 x 64 slice 1 of 4 main image.12288 bytes
64 x 64 slice 2 of 4 main image.12288 bytes
64 x 64 slice 3 of 4 main image.12288 bytes
64 x 64 slice 4 of 4 main image.12288 bytes
32 x 32 slice 1 of 2 mipmap image.3072 bytes
32 x 32 slice 2 of 2 mipmap image.3072 bytes
16 x 16 slice 1 of 1 mipmap image.768 bytes
8 x 8 slice 1 of 1 mipmap image.192 bytes
4 x 4 slice 1 of 1 mipmap image.48 bytes
2 x 2 slice 1 of 1 mipmap image.12 bytes
1 x 1 slice 1 of 1 mipmap image.4 bytes