The DirectX texture editor (DxTex) enables DirectX SDK users to create texture maps that use the DXTn compression formats.
Compatibility Chart
Direct3D 9 | Direct3D 9 EX | Direct3D 10 | 64-bit Native Mode | Windows XP | Windows Vista |
---|---|---|---|---|---|
Yes |
No |
No |
Yes |
Yes |
Yes |
The DirectX texture editor is automatically installed when you install the DirectX SDK.
Source: | (SDK root)\Utilities\Source\dxtex |
Executable: | (SDK root)\Utilities\Bin\x86 or x64 |
The DxTex tool allows you to open, view, manipulate, and save textures in various formats, and use various texture features. DxTex uses a traditional document-based UI. Each texture map is a document, and several documents can be open at one time.
Follow these steps to open an existing texture.
Follow these steps to create a new texture.
Follow these steps to convert an existing texture to a different format, compare the original and new formats, and save the resultant texture.
Note When changing formats, the original bitmap is used as the source image, and any previous format change is overwritten. This is to prevent progressive degradation of the image that would otherwise occur with multiple format changes.
Many texture formats include an alpha channel, which provides opacity information at each pixel. DxTex fully supports alpha in textures. When a bitmap is applied as alpha to a texture, the blue channel of the bitmap is used to provide the alpha data.
There are two ways to provide a texture with alpha data. You can use a special file naming convention to notify DxTex to add a specified bitmap as alpha to a texture automatically, or you can add a bitmap as alpha to a texture manually. For both methods, you must have a texture you wish to add alpha data to, and a bitmap that will provide the alpha data to the texture.
Note Some DxTex operations (Open as Alpha Channel, conversion to DXT3, and conversion to DXT5) are not possible on DXT2 and DXT4 formats. For more information, see the Premultiplied Alpha section.
Follow these steps to open a texture with alpha automatically.
Follow these steps to open a bitmap as an alpha channel in an existing texture.
Note If the existing texture is a volume map or cube map, you must select the File -> Open Onto Alpha Channel of This Surface menu item after selecting an appropriate surface in the cube mapped or volume mapped texture. See the Cube Map and Volume Map sections of the user's guide for more information.
When alpha data is applied to a texture, the texture will display with the alpha channel overlayed. To display the alpha channel by itself as a grayscale image, select the View -> Alpha Channel Only menu item.
DxTex can convert textures to cube and volume map textures, and provides the ability to navigate and save these textures. A cube map texture is a collection of six textures that are arranged like the faces of a cube, one texture per face. A volume map texture is a collection of one or more textures arranged in "slices," where each pixel can be thought of as having three dimensions: height and width, which describe the pixel's location on a slice texture, and depth, which identifies the slice the pixel is on.
Follow these steps to convert a texture into a cube map.
Follow these steps to import texture data into each face of a cube map.
Follow these steps to convert a texture into a volume map.
Follow these steps to import texture data into each slice of a volume map.
Mipmapping is a technique that improves image quality and reduces texture memory bandwidth by providing prefiltered versions of the texture image at multiple resolutions. Filtering is done through a simple box filter. That is, the four nearest pixels are averaged to produce each destination pixel.
Follow these steps to generate a mipmap for a texture.
Note To generate mipmaps in DxTex, the width and height of the source image must both be powers of two.
You can use command-line options to pass input files, an output file name, and processing options to DxTex. If an output file name is specified, the application exits automatically after writing the output file, and no user interface is presented.
dxtex [infilename] [-a alphaname] [-m] [DXT1|DXT2|DXT3|DXT4|DXT5] [outfilename] infilename: Name of the file to load. This can be a .bmp or .dds file. -a alphaname: The next parameter is the name of a .bmp file to load as the alpha channel. If no alpha filename is specified, DxTex still looks for a file named Infilename_a.bmp. If it exists, use that file as the alpha channel. -m: Mipmaps are generated. DXT1|DXT2|DXT3|DXT4|DXT5: Compression format. If no format is specified, the image will be in ARGB-8888. outfilename: Name of the destination file. If this option is not specified, the user interface shows the current file and all requested operations. If an outfilename is specified, the application exits after saving the processed file without presenting a user interface.
Creating a DXTn-compressed texture is not difficult. However, Direct3D can do the conversion for you when using the IDirect3DTexture9 interface. Advanced developers will probably want to write their own tools that meet their specific needs, but the DxTex tool provides useful basic functionality.
DxTex uses the Direct3D Reference Rasterizer to draw the textures, regardless of what 3D hardware is available. So with larger textures (greater than 256-by-256 pixels), the application may be somewhat slow, depending on your CPU speed.
See DDS File Reference for more detailed information about the DDS file format.
Note DxTex does not currently support textures with surface formats that do not contain at least an R, G, and B texture (such as D3DFMT_G16R16 and D3DFMT_A8), although D3DX can load and save such textures in DDS format.
The DXT2 and DXT4 formats use premultiplied alpha. This means that the red, green, and blue values stored in the surface are already multiplied by the corresponding alpha value. Direct3D cannot copy from a surface that contains premultiplied alpha to one that contains non-premultiplied alpha, so some DxTex operations (Open as Alpha Channel, conversion to DXT3, and conversion to DXT5) are not possible on DXT2 and DXT4 formats. Supporting textures using these formats is difficult on Direct3D devices that do not support DXTn textures. This is because Direct3D cannot copy them to a traditional ARGB surface either, unless that ARGB surface uses premultiplied alpha as well, which is rare. For this reason, you might find it easier to use DXT3 rather than DXT2, and DXT5 rather than DXT4, when possible.