Functions for doing texture processing based on DirectXTex data typically loaded from a WIC or TGA image file and then written to a .DDS file.FlipRotate
Flip and/or rotate image or set of images.
- TEX_FR_ROTATE0 Rotate by 0 degrees (no-op)
- TEX_FR_ROTATE90 Rotate by 90 degrees
- TEX_FR_ROTATE180 Rotate by 180 degrees
- TEX_FR_ROTATE270 Rotate by 270 degrees
- TEX_FR_FLIP_HORIZONTAL Horizonal flip
- TEX_FR_FLIP_VERTICAL Vertical flip
Resize an image or set of images. Note that if given a set of images, the result will always have mipLevels of 1.Convert
Convert an image or set of images from one pixel format to another. Note this does not support converting to/from block compressed formats. See "Compress" and "Decompress".GenerateMipMaps
Generates mipmaps for an image or a set of images.GenerateMipMaps3D
Generates mipmaps for a 3D volume texture from a set of images representing the slices. Note this function cannot use WIC to do the resizing as 3D volume maps require specific filtering so this is always done in software.PremultiplyAlpha
This converts an image assuming the original is not using premultiplied alpha into a premultiplied alpha version of the same image. The format and size are not changed. This is most useful for working with rendering that relies on premultiplied alpha blending (see DirectXTK
Compresses an image or set of images to a BC format. Note the alphaRef parameter is only used by BC1 for supporting conversions to 1-bit transparency.
- TEX_COMPRESS_DEFAULT Default flags.
- TEX_COMPRESS_RGB_DITHER Enables dithering RGB colors for BC1-3 compression
- TEX_COMPRESS_A_DITHER Enables dithering alpha channel for BC1-3 compression
- TEX_COMPRESS_DITHER Same as TEX_COMPRESS_RGB_DITHER and TEX_COMPRESS_A_DITHER
- TEX_COMPRESS_UNIFORM By default, BC1-3 uses a perceptual weighting. By using this flag, the perceptual weighting is disabled which can be useful when using the RGB channels for other data.
- TEX_COMPRESS_PARALLEL This opts-in to multi-threaded compression if enabled.
Decompresses a BC format to a non-BC format image.ComputeNormalMap
Converts a height-map to a normal-map.
- CNMAP_DEFAULT Default flags
Selects which channel to use as the height. Luminance is the average of R, G, and B.
Selects mirroring semantics for scanline refereneces. Otherwise defaults to wrap.
- CNMAP_MIRROR Same as both CNMAP_MIRROR_U and CNMAP_MIRROR_V
- CNMAP_INVERT_SIGN Inverts the sign of the computed normal vector
- CNMAP_COMPUTE_OCCLUSION Computes a crude occlusion term and stores in the resulting alpha channel
Copies a rectangle from a soure image to a destination image. Does not support block compressed formats.ComputeMSE
Computes the mean-squared error for each component based on two input images. Note the image data is converted to DXGI_FORMAT_R32G32B32A32_FLOAT for this operation. BC data is automatically decompressed.
These are flexible functions for doing texture processing that can be used in many different ways. See the Texconv
command-line utility for some extensive examples of using them.
- TEX_FILTER_DEFAULT Default flags
- TEX_FILTER_SEPARATE_ALPHA WIC makes use of pre-multiplied alpha when resizing images, which works fine for standard transparency data. If the alpha channel, however, contains some other kind of value then the resulting image can have 'holes' in it. Use of this flag uses an alternative algorithm which resizes the RGB and alpha channels independantly and then recombines the result.
This selects the use of dithering for resizing and format conversions. By default it uses no dithering.
- TEX_FILTER_DITHER 4x4 dithering
- TEX_FILTER_DITHER_DIFFUSION Error-diffusion dithering
This selects the filtering mode used for resizing. By default it uses "Fant".
- TEX_FILTER_POINT Nearest neighbhor
- TEX_FILTER_LINEAR Linear
- TEX_FILTER_CUBIC Cubic
- TEX_FILTER_FANT Fant which is euivalent to a box filter for down-scaling.
This controls color space transformation for conversions.
- TEX_FILTER_SRGB_IN Indicates the input format is the sRGB (gamma 2.2) format. This is implied if using a DXGI_FORMAT_*_SRGB format
- TEX_FILTER_SRGB_OUT Indicates the output format is the sRGB (gamma 2.2) format. This is implied if using a DXGI_FORMAT_*_SRGB format
- TEX_FILTER_SRGB This is the same as setting both TEX_FILTER_SRGB_IN and TEX_FILTER_SRGB_OUT