Microsoft DirectX 8.1 (C++)

DDS File Layout for Cubic Environment Maps

For cubic environment maps, one or more faces of a cube are written to the file using either uncompressed or compressed formats, and all faces must be the same size. Each face can have mipmaps defined, although all faces must have the same number of mipmap levels. If a file contains a cube map, DDSCAPS_COMPLEX, DDSCAPS2_CUBEMAP, and one or more of DSCAPS2_CUBEMAP_POSITIVEX/Y/Z and/or DDSCAPS2_CUBEMAP_NEGATIVEX/Y/Z should be set. The faces are written in the order: positive x, negative x, positive y, negative y, positive z, negative z, with any missing faces omitted. Each face is written with its main image, followed by any mipmap levels.

For example, a 256-by-256 cube map with positive X, negative Y, and positive Z faces, a pixel format of DXT1, and all mipmap levels would contain the following:

"DDS ",
(256, 256),
(linearsize=32768),
(pixel format=DXT1),
(mipmapcount=9),
(TEXTURE, LINEARSIZE, COMPLEX, MIPMAP,
   CUBEMAP, POSITIVEX, NEGATIVEY, POSITIVEZ, FOURCC)
128 bytes
256 x 256 positive X main image32768 bytes
128 x 128 positive X mipmap image8192 bytes
64 x 64 positive X mipmap image2048 bytes
32 x 32 positive X mipmap image512 bytes
16 x 16 positive X mipmap image128 bytes
8 x 8 positive X mipmap image32 bytes
4 x 4 positive X mipmap image8 bytes
2 x 2 positive X mipmap image8 bytes
1 x 1 positive X mipmap image8 bytes
256 x 256 negative Y main image32768 bytes
128 x 128 negative Y mipmap image8192 bytes
64 x 64 negative Y mipmap image2048 bytes
32 x 32 negative Y mipmap image512 bytes
16 x 16 negative Y mipmap image128 bytes
8 x 8 negative Y mipmap image32 bytes
4 x 4 negative Y mipmap image8 bytes
2 x 2 negative Y mipmap image8 bytes
1 x 1 negative Y mipmap image8 bytes
256 x 256 positive Z main image32768 bytes
128 x 128 positive Z mipmap image8192 bytes
64 x 64 positive Z mipmap image2048 bytes
32 x 32 positive Z mipmap image512 bytes
16 x 16 positive Z mipmap image128 bytes
8 x 8 positive Z mipmap image32 bytes
4 x 4 positive Z mipmap image8 bytes
2 x 2 positive Z mipmap image8 bytes
1 x 1 positive Z mipmap image8 bytes

Note that as of Microsoft® DirectX® 8, cube maps are always written with all faces defined.