DDS file reference DDS file number

Source: Internet
Author: User
Tags bit set
DDS file reference DDS file number Http://msdn.microsoft.com/en-us/library/bb172993 (vs.85). aspx

the DirectDraw surface (. DDS) file format is used to store textures and cubic Environment Maps, both with and without mipmap levels. the surface of DirectDraw (. The file format is used to store textures. The cube environment ing has and does not have multiple image levels. This format can store uncompressed and comprespixsed El formats, and is the preferred file format for storing dxtn compressed data. this format can store compressed and compressed image formats, and is the preferred file format for storing compressed data dxtn. This file format is supported by the DirectX texture tool (DirectX texture editor (dxtex.exe), as well as some non-Microsoft tools, and by the d3dx library.this file format supports directxtexture tool (directxtexture editor (dxtex.exe )), and some non-Microsoft tools and d3dx libraries.

This format was introduced with DirectX 7. describes this format and DirectX 7. In DirectX 8, support for volume textures was added. In DirectX 8, the volume texture is added.

File layout file Layout

The basic structure of A. Dds file is a header, and one or more surfaces written to a binary file. 1. The basic structure of the DDS file is a header, and one or more surfaces are written to the binary file. The header consists of a fourcc and a ddsurfacedesc2 structure. The header contains an automatic detection and ddsurfacedesc2 structure. This header contains all the information needed to determine the contents of the entire file. This header contains all the information that needs to be determined for the entire file. The image below shows the layout of A. Dds file. The image below is displayed. The layout file of the DDS.

Surface format Header

the ddsurfacedesc2 Structure describes the file contents using the standard flags and values defined in the DirectDraw documentation, but files shocould use a restricted set of values to ensure full compatibility. the ddsurfacedesc2 Structure describes the file content using standard flag and DirectDraw document-defined values, but the file should use a set of value constraints to ensure compatibility. A robust reader shocould verify key values and a robust writer shocould ensure all required flags are set for the different fields and options to ensure easy loading by the application or other tool. A strong reader should verify the key value and strong writers should ensure that all necessary signs are for different areas and options, to ensure that the application Program or other tools are easily loaded. also, A robust reader shocould not use a field unless the corresponding flag is set, and a robust writer shoshould set all undefined fields to 0. furthermore, powerful readers should not use a field unless the corresponding flag, as well as a strong writer should be set to 0 for all undefined fields.

The table below shows the members of The ddsurfacedesc2 structure. The following table shows the members of The ddsurfacedesc2 structure.

Member member Description
DWORD dwsize dubyte value dwsize Size of structure. Size Structure. This member must be set to 124. This member must be set to 124.
DWORD dwflags dual-byte value dwflags Flags to indicate valid fields. flag to indicate valid fields. Always include ddsd_caps, ddsd_pixelformat, ddsd_width, and ddsd_height. Always include ddsd_caps, ddsd_pixelformat, ddsd_width, and ddsd_height.
DWORD dwheight dubyte value dwheight Height of the main image in pixels the height of the main image, in pixels
DWORD dwwidth dubyte value dwwidth Width of the main image in pixels pixel width of the main Image
DWORD dwpitchorlinearsize dual-byte value dwpitchorlinearsize for uncompressed formats, this is the number of bytes per Scan Line (DWORD> aligned) for the main image. for the compression format, this is the number of bytes for each scanned image's main line (two-byte value "alignment. dwflags shoshould include ddsd_pitch in this case. dwflags should include ddsd_pitch in this case. for compressed formats, this is the total number of bytes for the main image. for the compression format, this is the total number of bytes as the main image. dwflags shocould be include ddsd_linearsize in this case. dwflags should include ddsd_linearsize in this case.
DWORD dwdepth dual-byte value dwdepth For volume textures, This is the depth of the volume. For batch textures, This is the depth of the volume. Dwflags shoshould include ddsd_depth in this case. dwflags should include ddsd_depth in this case.
DWORD dwmipmapcount dual-byte value dwmipmapcount For items with mipmap levels, this is the total number of levels in the mipmap chain of the main image. For projects with multiple image levels, this is the total number of multiple image chains of main images at all levels. Dwflags shoshould include ddsd_mipmapcount in this case. dwflags should include ddsd_mipmapcount in this case.
DWORD dwreserved1 [11] dual-byte value dwreserved1 [11] Unused not used
Ddpixelformat ddpfpixelformat 32-byte value that specifies the pixel Format Structure. 32-byte value, the specified pixel format structure.
Ddcaps2 ddscaps ddcaps2 ddscaps 16-byte value that specifies the capabilities structure. 16 bytes value, the specified function structure.
DWORD dwreserved2 dual-byte value dwreserved2 Unused not used

Note that the field names used in this description do not correspond exactly with the ddsurfacedesc2 fields due to the restrictions placed on. DDS file format, but a standard ddsurfacedesc2 structure can and shocould be used. note that the field names here are used to describe different because they are in. The file format of DDS is restricted to the ddsurfacedesc2 field, but a standard ddsurfacedesc2 structure can and should be used. Use the magic DDS value and the header dwsize value to validate the file. Use the magic DDS value and the header dwsize value to verify the file.

the pixel format of the image is given in the ddpfpixelformat field of the header, and can describe all the formats supported by direct3d. the pixel format of the image is supported by all direct3d formats that can be described in the header ddpfpixelformat field. DDS files are usually restricted to either RGB or fourcc formats, and the use of other formats is not generally supported. DDS files are generally limited to RGB or fourcc value formats. Other formats are not generally supported. restrict usage to RGB formats values, a1r5g5b5, a4r4g4b4, r8g8b8, r5g6b5; and fourcc formats dxt1, dxt2, dxt3, dxt4, and dxt5 to ensure the best support. use RGB a8r8g8b8, a1r5g5b5, a4r4g4b4, r8g8b8, r5g6b5, and fourcc value formats dxt1, dxt2, dxt3, dxt4, and dxt5 to ensure optimal support. a well-written reader shocould handle more formats, if possible. good written readers should handle more formats, if possible.

The following table shows the layout of the ddpixelformat structure. The following table shows the layout of the ddpixelformat structure.

Member member Description
DWORD dwsize dubyte value dwsize Size of structure. Size Structure. This member must be set to 32. This member must be set to 32.
DWORD dwflags dual-byte value dwflags flags to indicate valid fields. flag to indicate valid fields. uncompressed formats will usually use ddpf_rgb to indicate an RGB format, while compressed formats will use ddpf_fourcc with a four-character code. no compression format. Generally, ddpf_rgb is used to represent the RGB format. The compression format uses the four-character Code ddpf_fourcc.
DWORD dwfourcc dubyte value dwfourcc This is the four-character code for compressed formats. this is a 4-character compressed format code. dwflags shoshould include ddpf_fourcc in this case. dwflags should include ddpf_fourcc in this case. for dxtn compression, this is set to "dxt1", "dxt2 ", "dxt3", "dxt4", or "dxt5 ". for dxtn compression, this is set to "dxt1", "dxt2", "dxt3", "dxt4", or "dxt5 ".
DWORD dwrgbbitcount dubyte value dwrgbbitcount for RGB formats, this is the total number of BITs in the format. this is the total number of BITs in RGB format. dwflags shoshould include ddpf_rgb in this case. dwflags should include ddpf_rgb in this case. this value is usually 16, 24, or 32. this value is usually 16,24 or 32. for a8r8g8b8, this value wocould be 32. for a8r8g8b8, this value will be 32.
DWORD dwrbitmask, DWORD dwgbitmask, DWORD dwbbitmask dual-byte value dwrbitmask, dual-byte value: dwgbitmask; dual-byte value: dwbbitmask for RGB formats, these three fields contain the masks for the red, green, and blue channels. for the RGB format, these three fields contain masks with red, green, and blue channels. for a8r8g8b8, these values wocould be 0x00ff0000, 0x0000ff00, and 0x000000ff respectively. for a8r8g8b8, these values are 0x00ff0000, 0x0000ff00, and 0x000000ff respectively.
DWORD dwrgbalphabitmask dubyte value dwrgbalphabitmask For RGB formats, this contains the mask for the alpha channel, if any. For RGB format, this contains the alpha channel mask, if any. Dwflags shoshould include ddpf_alphapixels in this case. dwflags should include ddpf_alphapixels in this case. For a8r8g8b8, this value wocould be 0xff000000. For a8r8g8b8, this value will be 0xff000000.

The final details of the format are inferred from the capabilities Bits Set in the ddscaps field of the header. the final details of the format are inferred in the feature bit set in the header ddscaps field. The layout of the ddscaps structure is shown in the table below. The ddscaps structure layout is shown in the table below.

Member member Description
DWORD dwcaps1 dual-byte value dwcaps1 DDS files shoshould always include ddscaps_texture. The DDs file should include ddscaps_texture. If the file contains mipmaps, ddscaps_mipmap shoshould be set. If the file contains mipmaps, ddscaps_mipmap should be set. For any. Dds file with more than one main surface, such as a mipmaps, cubic environment map, or volume texture, ddscaps_complex shoshould also be set. For any. The DDs file contains more than one main surface, such as mipmaps, ing of cubic environment, or volume texture. ddscaps_complex should also be created.
DWORD dwcaps2 dubyte value dwcaps2 for cubic Environment Maps, ddscaps2_cubemap shocould be stored as well as one or more faces of the map (ddscaps2_cubemap_positivex, hour, ddscaps2_cubemap_positivey, hour, hour, and hour ). for cubic environment ing, ddscaps2_cubemap should be included in one or more maps (ddscaps2_cubemap_positivex, d Middleware, ddscaps2_cubemap_positivey, ddscaps2_cubemap_negativey, ddscaps2_cubemap_positivez, ddscaps2_cubemap_negativez ). for volume textures, ddscaps2_volume shocould be pinned ded. for batch textures, ddscaps2_volume should be included.
DWORD reserved [2] dual-byte value reserved [2] Unused not used

Note that as of DirectX 8, cubic Environment Maps are always written with all faces defined. Note that due to DirectX's 8-cube environment ing, all written definitions are always faced.

    • DDS file layout for textures file layout texture of DDS
    • DDS file layout for cubic Environment Maps file layout cube environment ing of DDS
    • DDS file layout for volume textures file layout volume texture of DDS
    • DDS Bit Flag values DDS bit flag value

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.