S3TC/DXT/DDS compression and transparencies

Any kind of tutorial regarding U-Ed and mapping belongs here
User avatar
Posts: 3348
Joined: Thu Aug 04, 2011 9:26 pm
Personal rank: Chaos Evangelist
Location: Kernow, UK

S3TC/DXT/DDS compression and transparencies

Post by Dr.Flay »

As optimising and masked/transparent textures have been mentioned, I thought I should cover the differences regarding compression for those missing the basics.

S3TC has been a standard part of DirectX, OpenGL and all graphics cards since the turn of the century, but what are the benefits ?
Other than the fact they can be stored natively in graphics RAM much faster, here are a few things to consider.

Note: 8-bit (indexed / palletised) = 256 colours
24-bit (True-Colour) = 16,777,216 colours
1) Using a palette reference in an 8-bit image (usually the first colour "0") will not effect the filesize.
(It is also the standard way formats like PNG and GIF handle transparency.)
This can be compressed as plain RGB DXT1. This will give you the best comression ratio of 8 to 1.

2) The newer versions 3 and 5 both store transparencies as an extra channel in a 32-bit space.
(This is the standard way formats like PNG and TGA store 24-bit transparencies.)
Use these modes if your transparent texture needs to keep an alpha channel to preserve fine details.
eg. if it is a complex 24/32-bit transparency, or because an 8-bit reduced version suffers from jagged edges.
Look at the standard UT textures "Detail" for examples of transparent textures needing an alpha-channel.

3) Using a higher version will convert it to 32-bit RGBA (24-bit with alpha) and a lower compression of 4 to 1.

If your texture is 8-bit or non-transparent, always use DXT1 for maximum compression.
Generally DXT3 is best suited to images with sharp alpha transitions, between transparent and solid areas.
Because DXT5 uses an interpolated alpha scheme, it generally produces superior results for alpha (transparency) gradients than DXT3

4) With S3TC compression you can actually use 24-bit images in UE1. Instead of dithering a complex photograph into a spotted 8-bit compromise.
Or if you struggle with colour-banding when trying to reduce an image to 8-bit, perhaps try a compressed 24-bit texture instead.

UEd 2 and below, need you to prepare your DDS images for importing (Tools linked at the bottom)
UEd 2.1 (Unreal 227) and above can compress textures during import.
UED 3 and above can compress textures already imported to a pack. UEd 3+ can read and write UEd 2 UTX files :mrgreen:

Correctly made textures should have both standard and compressed “DXmerged” in the file. This means users only have to enable/disable the setting, and can use the same packs.

Traditionally, mappers were told not to use compressed textures for editing because they would not display in UEd.
Since the newer video renderers became available, this is no longer a problem and they will display.
This still leaves the issue of larger textures, where there is the possibility of miss-alignment if they are not perfect.
Depending on the map and how perfect the textures you may not notice any problems, and it will never break a map.

http://www.oldunreal.com/wiki/index.php ... ession_doc
The reference documents used for Oldunreal wiki, are included below with a few tools and.... plugins for Gimp and Photoshop :highfive:
My Google Drive – S3TC/DXT/DDS Tools and plugins collection

http://developer.nvidia.com/content/leg ... ture-tools
http://developer.nvidia.com/content/gpu ... ompression
http://developer.nvidia.com/nvidia-text ... -photoshop
Free multi-OS image editor http://www.gimp.org
S3TC/DDS/DXT plugin for GIMP http://code.google.com/p/gimp-dds/
XnView can also read and write DDS files http://www.xnview.com/en/xnview/#formats (not very good)


http://www.celticwarriors.net/Website/S ... apping.htm
UCC Merge DXT scripts http://www.unrealsp.org/viewtopic.php?t=199
You do not have the required permissions to view the files attached to this post.