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), | 128 bytes |
(TEXTURE, LINEARSIZE, COMPLEX, MIPMAP, CUBEMAP, POSITIVEX, NEGATIVEY, POSITIVEZ, FOURCC) |
256-by-256 positive x main image | 32768 bytes |
128-by-128 positive x mipmap image | 8192 bytes |
64-by-64 positive x mipmap image | 2048 bytes |
32-by-32 positive x mipmap image | 512 bytes |
16-by-16 positive x mipmap image | 128 bytes |
8-by-8 positive x mipmap image | 32 bytes |
4-by-4 positive x mipmap image | 8 bytes |
2-by-2 positive x mipmap image | 8 bytes |
1-by-1 positive x mipmap image | 8 bytes |
256-by-256 negative y main image | 32768 bytes |
128-by-128 negative y mipmap image | 8192 bytes |
64-by-64 negative y mipmap image | 2048 bytes |
32-by-32 negative y mipmap image | 512 bytes |
16-by-16 negative y mipmap image | 128 bytes |
8-by-8 negative y mipmap image | 32 bytes |
4-by-4 negative y mipmap image | 8 bytes |
2-by-2 negative y mipmap image | 8 bytes |
1-by-1 negative y mipmap image | 8 bytes |
256-by-256 positive z main image | 32768 bytes |
128-by-128 positive z mipmap image | 8192 bytes |
64-by-64 positive z mipmap image | 2048 bytes |
32-by-32 positive z mipmap image | 512 bytes |
16-by-16 positive z mipmap image | 128 bytes |
8-by-8 positive z mipmap image | 32 bytes |
4-by-4 positive z mipmap image | 8 bytes |
2-by-2 positive z mipmap image | 8 bytes |
1-by-1 positive z mipmap image | 8 bytes |
Note As of Microsoft?DirectX?8.0, cube maps are always written with all faces defined.