The first version of my DXT compressor is now available for release here.
The algorithm and comparisons are described here: DXT Compression Revisited
Here is a list of the commands:
-file <path> | Input file to process. There can be multiple of these. |
-outfile <path> | Output file for the last -file input. By default, if no output file is specified, the default for any given input is the same as the input path but with a .dds extension. This allows to optionally override this default. |
-dxt1c | Exports as DXT1 (color only). |
-dxt1a | Exports as DXT1 (1-bit alpha). |
-dxt2 | Exports as DXT2. |
-dxt3 | Exports as DXT3. Default. |
-dxt4 | Exports as DXT4. |
-dxt5 | Exports as DXT5. |
-A8B8G8R8 | Exports as uncompressed A8B8G8R8 format. |
-G16R16 | Exports as uncompressed G16R16 format. |
-A2B10G10R10 | Exports as uncompressed A2B10G10R10 format. |
-A1R5G5B5 | Exports as uncompressed A1R5G5B5 format. |
-R5G6B5 | Exports as uncompressed R5G6B5 format. |
-A8 | Exports as uncompressed A8 format. |
-A8R8G8B8 | Exports as uncompressed A8R8G8B8 format. |
-X8R8G8B8 | Exports as uncompressed X8R8G8B8 format. |
-X8B8G8R8 | Exports as uncompressed X8B8G8R8 format. |
-A2R10G10B10 | Exports as uncompressed A2R10G10B10 format. |
-R8G8B8 | Exports as uncompressed R8G8B8 format. |
-X1R5G5B5 | Exports as uncompressed X1R5G5B5 format. |
-A4R4G4B4 | Exports as uncompressed A4R4G4B4 format. |
-X4R4G4B4 | Exports as uncompressed X4R4G4B4 format. |
-A8R3G3B2 | Exports as uncompressed A8R3G3B2 format. |
-A8L8 | Exports as uncompressed A8L8 format. |
-L16 | Exports as uncompressed L16 format. |
-L8 | Exports as uncompressed L8 format. |
-A4L4 | Exports as uncompressed A4L4 format. |
-quick | When used with a DXT format, low quality and high speed are used for the compression. |
-quality_normal | When used with a DXT format, medium quality and speed are used for the compression. |
-quality_production | When used with a DXT format, high quality and low speed are used for the compression. |
-quality_highest | When used with a DXT format, maximum quality and lowest speed are used for the compression. This can take a long time. |
-prescale <int> <int> | Rescales the image(s) to this size before converting. |
-rescale <nearest | hi | lo> | Rescales the image(s) to nearest, next-highest or next-lowest power of two. |
-rel_scale <float> <float> | Relative scale of the original image(s). 0.5 is half size. Default is 1.0 1.0 |
-RescalePoint | Rescales the image using a point filter. |
-RescaleBox | Rescales the image using a box filter. |
-RescaleKaiser | Rescales the image using a Kaiser filter. |
-RescaleLanczos3 | Rescales the image using a Lanczos3 filter. |
-RescaleLanczos4 | Rescales the image using a Lanczos4 filter. |
-RescaleLanczos6 | Rescales the image using a Lanczos6 filter. |
-RescaleLanczos8 | Rescales the image using a Lanczos8 filter. |
-RescaleLanczos12 | Rescales the image using a Lanczos12 filter. |
-RescaleLanczos64 | Rescales the image using a Lanczos64 filter. |
-RescaleMitchell | Rescales the image using a Mitchell filter. |
-RescaleCatrom | Rescales the image using a Catmull-Rom filter. |
-RescaleBlackman | Rescales the image using a Blackman filter. |
-RescaleGaussian | Rescales the image using a Gaussian filter. |
-RescaleBell | Rescales the image using a Bell filter. |
-Point | A point filter will be used for mipmaps. |
-Box | A box filter will be used for mipmaps. |
-Kaiser | A Kaiser filter will be used for mipmaps. |
-Lanczos3 | A Lanczos3 filter will be used for mipmaps. |
-Lanczos4 | A Lanczos4 filter will be used for mipmaps. |
-Lanczos6 | A Lanczos6 filter will be used for mipmaps. |
-Lanczos8 | A Lanczos8 filter will be used for mipmaps. |
-Lanczos12 | A Lanczos12 filter will be used for mipmaps. |
-Lanczos64 | A Lanczos64 filter will be used for mipmaps. |
-Mitchell | A Mitchell filter will be used for mipmaps. |
-Catrom | A Catmull-Rom filter will be used for mipmaps. |
-Blackman | A Blackman filter will be used for mipmaps. |
-Gaussian | A Gaussian filter will be used for mipmaps. |
-Bell | A Bell filter will be used for mipmaps. |
-clamp <int> <int> | Clamps the image width and height between the given values. |
-nomipmap | If specified, mipmaps are not generated. |
-nmips <int> | Specifies the maximum number of mipmaps to generate. |
-rgbe | Specifies that the input image(s) is/are in linear space already. |
-flip | Flips the image vertically. |
-swap | Swaps the R and B channels. |
-norm | Normalizes the image for each mipmap level. Used for normal maps. |
-weight <float> <float> <float> | Specifies the weights to be used during DXT compression. Defaults are 0.212656 0.715158 0.072186. |
-gamma <float> | Specifies the gamma to use during resampling and mipmap generation. Default is 2.2. |
-alpha_threshold <int> | Specifies the cut-off for DXT1a alpha. Values below this point are treated as alpha = 0. Valid range is 0 to 255. |
-pause | Pauses the console after completing the operation. |
Examples:
LSDxt.exe -file “image.png” -nmips 5 | Creates image.dds with a maximum of 5 mipmap levels. DXT3 format is used. |
LSDxt.exe -file “image0.png” -file “image1.png” | Creates image0.dds and image1.dds. DXT3 format is used. |
LSDxt.exe -file “image0.png” -file “image1.png” -outfile “main.dds” | Creates image0.dds and main.dds. DXT3 format is used. |
LSDxt.exe -file “image.png” -rescale hi -ResampleBox -Blackman | Rescales the image to the next-highest power-of-2 if it is not already a power-of-2. The rescale uses a box filter while mipmaps use a Blackman filter. DXT3 format is used. |
LSDxt.exe -file “image.png” -weight 0.3086 0.6094 0.082 | Creates a DXT3 image named image.dds with custom RGB weights of 0.3086 0.6094 0.082. |
Many more commands will follow in future releases, including options for converting heightmaps to normal maps, fading alpha levels in mipmaps, sharpening mipmaps, etc.
L. Spiro
Wow, thank you for sharing!!
Any chance you will be adding support for DDS packed texture arrays / cube maps / 3D textures? It would be great as no tool I know support these, and nvtools never had it implemented even.
In the very least texture arrays and cube maps are planned to be added.
3D textures could be done but the time to compress would be stellar.
L. Spiro
It’s fantastic to use this tool, and found 2 problems with me. One is, cannot read 64×100 png using libpng to produce. The other is too slow to save png and LSDxt it than convert to myself fileformat, is it possible to provide library to link with?
I am planning to allow some kind of system such as that where you can use external libraries to load images instead of the internal ones used by the engine. It will take a short while before I can add it though.
L. Spiro
Please accept my apologies for my negative review.
In my opinion, the utility gives unsatisfactory results.
Branded utility of nvidia is bad too.
The best result I’ve ever seen, provides utility VTFEdit, but it saves the vtf-files, not dds (for source engine games).
There is a flaw in my method and I need to make revisions. Currently I have integrated Squish into my own engine and I might release this tool using Squish. It would no longer be “my own algorithm” but my modifications to Squish make it about 4 times faster and my tool still provides all the options of scaling, filtering, mip-map generation, etc., just using Squish for the DXT conversion. I’ve also upgraded Squish to work with ARM NEON, tested on PlayStation Vita.
So far Squish is the best I have seen, and I am hoping to work out a new algorithm that somehow merges Squish’s algorithm and my own for hopefully best results.
L. Spiro
Oh, that would be great if you had the time to do this good deed. Unfortunately, I not a programmer, and I can not compile tools you’re talking about, Squish.
And thank you so much for your reply, you expanded my horizons, I am grateful.