The Blog

[Release] LSDxt DXT Compressor 4.0

The fourth version of my DXT compressor is now available for release here.

Texture addressing modes and new filters are the main additions this time, along with alternative command-line options to make it more compatible with existing tools.

Changes:
Added the Lanczos2 filter.
Added support for BC4, BC5, BC6H, and BC7 formats.
Improved quality of very-small mipmaps.

 

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 | bc1 Exports as DXT1 (color only).
-dxt1a | bc1a Exports as DXT1 (1-bit alpha).
-dxt2 Exports as DXT2.
-dxt3 | bc2 Exports as DXT3.  Default.
-dxt4 Exports as DXT4.
-dxt5 | bc3 Exports as DXT5.
-bc4 Exports as BC4.
-bc5 Exports as BC5.
-bc6 | -bc6h Exports as BC6H.
-bc7 Exports as BC7.
-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.  Deprecated.
-quality_normal When used with a DXT format, medium quality and speed are used for the compression.  Deprecated.
-quality_production When used with a DXT format, high quality and low speed are used for the compression.  Deprecated.
-quality_highest When used with a DXT format, maximum quality and lowest speed are used for the compression.  Deprecated.
-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
-RescaleBox Rescales the image using a box filter.  Default.
-RescaleTent Rescales the image using a bilinear filter.
-RescaleQuadratic Rescales the image using a quadratic filter.
-RescaleKaiser Rescales the image using a Kaiser filter.
-RescaleLanczos2 Rescales the image using a Lanczos2 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.
-RescaleBSpline Rescales the image using a B-Spline 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.
-Box A box filter will be used for mipmaps.
-Tent A bilinear filter will be used for mipmaps.
-Quadratic A quadratic filter will be used for mipmaps.
-Kaiser A Kaiser filter will be used for mipmaps.  Default.
-Lanczos2 A Lanczos2 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.
-BSpline A B-Spline 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.
-f <box | quadratic | bspline | mitchell | lanczos | kaiser> Selects the type of filter that will be used for rescaling. This is a short alternative to the -Rescale* set of commands. “lanczos” here is equivalent to -RescaleLanczos64.
-clamp <int> <int> Clamps the image width and height between the given values.
-nomipmap | nomips 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.212639005871510 0.715168678767756 0.072192315360734.
-gamma | g <float> Specifies the gamma to use during resampling and mipmap generation.  Any negative values cause it to use the full IEC 61966-2-1 compliant conversion rather than a pow() approximation (all values below 0 are treated equally).  Default is -2.2 (full standard conversion).
-clamp Specifies to use the clamp-type texture address mode for filtering.
-repeat | wrap Specifies to use the repeat-type texture address mode for filtering.
-mirror | reflect Specifies to use the mirror-type texture address mode for filtering.
-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 x64.exe” -file “image.png” -nmips 5 Creates image.dds with a maximum of 5 mipmap levels.  DXT3 format is used.
“LSDxt x64.exe” -file “image0.png” -file “image1.png” Creates image0.dds and image1.dds.  DXT3 format is used.
“LSDxt x64.exe” -file “image0.png” -file “image1.png” -outfile “main.dds” Creates image0.dds and main.dds.  DXT3 format is used.
“LSDxt x64.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 x64.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

About L. Spiro

L. Spiro is a professional actor, programmer, and artist, with a bit of dabbling in music. || [Senior Core Tech Engineer]/[Motion Capture] at Deep Silver Dambuster Studios on: * Homefront: The Revolution * UNANNOUNCED || [Senior Graphics Programmer]/[Motion Capture] at Square Enix on: * Luminous Studio engine * Final Fantasy XV || [R&D Programmer] at tri-Ace on: * Phantasy Star Nova * Star Ocean: Integrity and Faithlessness * Silent Scope: Bone Eater * Danball Senki W || [Programmer] on: * Leisure Suit Larry: Beach Volley * Ghost Recon 2 Online * HOT PXL * 187 Ride or Die * Ready Steady Cook * Tennis Elbow || L. Spiro is currently a GPU performance engineer at Apple Inc. || Hyper-realism (pencil & paper): https://www.deviantart.com/l-spiro/gallery/4844241/Realism || Music (live-played classical piano, remixes, and original compositions): https://soundcloud.com/l-spiro/

12 Awesome Comments So Far

Don't be a stranger, join the discussion by leaving your own comment
  1. Michael
    July 12, 2015 at 4:17 AM #

    Hi Spiro,
    All is made 100% from scratch or it uses Resampler by Rich Geldreich ?
    Michael

    • L. Spiro
      July 12, 2015 at 4:19 AM #

      It uses a heavily modified and re-factored version of his resampler.

      L. Spiro

      • Michael
        July 12, 2015 at 9:50 PM #

        Since it’s already an heavily modified version from Graphics Gems 3, when you say modified, you mean it contains bugs who cause the resize not correct ?

        • L. Spiro
          July 12, 2015 at 10:00 PM #

          My modifications are related to expanding its functionality, changing its memory policies to conform to my engine’s, support for iOS, adding proper gamma support, etc., as well as a complete refactor into my engine’s coding style, using my types, naming conventions, namespaces, etc.

  2. yukels
    September 26, 2016 at 5:54 PM #

    Hi Spiro,
    We would like to try/use the LSDxt DXT Compressor in our product. Your release includes only command line compressor for Windows platform only. Could you share dll/library or source code of your library, please?

    Thanks in advance,
    Dmitry

    • L. Spiro
      September 26, 2016 at 6:03 PM #

      I can prepare a package with the source, but as I am currently busy moving to a new place it will take just a bit of time.

      L. Spiro

    • L. Spiro
      October 4, 2016 at 2:46 AM #

      I have prepared a package that should compile without fuss or errors/warnings here: http://lspiroengine.com/Misc/LSDxtSrc.rar

      L. Spiro

  3. yukels
    November 2, 2016 at 7:22 PM #

    Thanks a lot! Sorry for delay – I was in long vacation. I’ll try it soon.

  4. chrrox
    April 18, 2018 at 9:34 AM #

    Hi I saw you worked with tri-ace as a main programmer for their Aska engine.
    They are using your index compression in the star ocean games(recent ones 5 and later) I was wondering if you could share any of your code or an example of implementing the compression. I love how the games characters look and it would save me a lot of time if i could make a model viewer for them. (I can currently get the game models but it involves dumping memory of running systems and is a slow process). Thanks so much for any help I posted this hear because I did not think you would see it if i posted on the older post here.

    • L. Spiro
      April 18, 2018 at 12:24 PM #

      I see comments from anywhere.
      I implemented the index-buffer compression in ASKA engine, yes. My implementation was based entirely off what I had posted here.
      I don’t recall making any changes to the algorithm, but if there are any they should be small and easy to figure out by looking at the data.

      L. Spiro

      • chrrox
        April 19, 2018 at 8:58 AM #

        Thank you for the reply :) . was the lzw compression referring to the slz type 07 compression? I decompressed some slz 05 types that use deflate and the index buffer does not look slz compressed. I am going to attempt to create a viewer ill let you know if i succeed.

        • L. Spiro
          April 19, 2018 at 9:16 AM #

          I don’t remember how LZW was applied. I think it was skipped, but it could have been replaced by a compression routine they already had, or I implemented my LZW (with changes for security) and completely forgot.

          I don’t think my custom LZW is used, but if it is it can only be decoded via a custom decoder. It is made from scratch and can only be decoded with a custom tool that must also be written from scratch.

          L. Spiro

Leave a Comment to L. Spiro

Remember to play nicely folks, nobody likes a troll.