The Blog

[Release] LSDxt DXT Compressor 2.0

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

It now uses FreeImage to provide support for virtually all image formats, and uses a heavily optimized Squish implementation for better performance and quality.

Changes:
Normalizing normal maps is now correct.
Changed the DXT conversion routine to use the Squish library.
Added an x64 version (performance improved by at least 210%).
Fixed a bug where the filters for mipmaps were being ignored (instead changing the normal resample filter).
Negative gamma values now act as a switch to use true IEC 61966-2-1 compliant sRGB conversions to and from linear space for all resampling (VAL = VAL <= 0.04045f ? VAL * (1.0f / 12.92f) : ::powf( (VAL + 0.055f) * (1.0f / 1.055f), 2.4f)).

 

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.  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
-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.212639005871510 0.715168678767756 0.072192315360734.
-gamma <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).
-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/

No comments yet.

Leave a Comment

Remember to play nicely folks, nobody likes a troll.