Restoring Texture After DXT Compression

From Valve Developer Community
Jump to: navigation, search
Original compressed texture versus the decompressed texture via the AI.
(Click to see full size)

VTF Textures saved in a compressed DXT format suffer irreversible data loss. If the source files for the texture are unavailable, the only choice is to use the compressed texture which can be problematic due to the blocky artifacts and green tint from the compression. If this is used for further edits and then re-compressed, the quality loss will get even greater.

The effects of the DXT can now be reversed by the use of an AI neural network model, which has been specifically trained on images in their original format versus their DXT-compressed version. The results are effective on cartoony textures and remove most of the blocky artefacts, although fine-grain detail on more realistic textures will be smoothed out.

Note.pngNote:The AI can only work off information already present in the image, hence the results will never be the same as the original source file. It is only an approximation.
Warning.pngWarning:DXT textures with fine-grain detail, such as rock or sand, will be smoothed out if cleaned up.

Steps

Warning.pngWarning:The model linked in this tutorial is trained on textures that have had green tint introduced due to improper decompression algorithms used by older DXT decoders. Running an image that has been properly decoded (using a tool like VTFEdit Reloaded or Vtex2) will result in a minor hue shift.
  1. Download CupScale and follow the install instructions here.
    Note.pngNote:Make sure you have Python 3.9 installed rather than any newer version, as only that specific version will work.
    Warning.pngWarning:If you don't have all dependencies installed as listed in CupScale's dependency checker, attempting to modify the image will confusingly cause the process to immediately cancel.
  2. Download the AI model from here and assign the model to CupScale (underneath ESGRAN Model Options).
  3. Export your compressed texture into .png format and drag it onto CupScale's area.
  4. Run the AI by pressing the Upscale and Save button. This might take a while depending on how powerful your GPU is and the image resolution.
  5. The new decompressed image will be available beside your original image.

See also