S3TC/DXT/DDS compression and transparencies

Tutorials and discussions about Mapping - Introduce your own ones!

S3TC/DXT/DDS compression and transparencies

Postby Dr.Flay » Fri Oct 03, 2014 7:54 am

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
CUT4test.rar
Prepared textures
(194.59 KiB) Downloaded 67 times

LogoNoTextTweak8.png
8 bit masked


LogoNoTextTweak.png
24 bit Alpha channel DXT5

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.
GL_COMPRESSED_RGB_S3TC_DXT1_EXT 6:1 / 8: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.
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 4:1
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 4: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/legacy-texture-tools
http://developer.nvidia.com/content/gpu-accelerated-texture-compression
http://developer.nvidia.com/nvidia-texture-tools-adobe-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://wiki.beyondunreal.com/Legacy:Alpha_Channel
http://wiki.beyondunreal.com/Legacy:S3TC
http://wiki.beyondunreal.com/Legacy:DXT
http://wiki.beyondunreal.com/Legacy:Texture_Compression

http://www.celticwarriors.net/Website/S3TC/S3TCandMapping/S3TCandMapping.htm
UCC Merge DXT scripts http://www.unrealsp.org/viewtopic.php?t=199
User avatar
Dr.Flay
Site Staff
 
Posts: 3127
Joined: Thu Aug 04, 2011 9:26 pm
Location: Kernow, UK
Personal rank: Chaos Evangelist

Return to Mapping

Who is online

Users browsing this forum: No registered users and 3 guests