Difference between revisions of "DDS textures"

From PioneerWiki
Jump to: navigation, search
(Added two links to articles on technical and artistic aspects of DXTn textures.)
m (Updated the compressonator link to their Github page)
 
Line 41: Line 41:
 
= Software for working with DDS files =
 
= Software for working with DDS files =
  
*[http://developer.amd.com/tools-and-sdks/archive/legacy-cpu-gpu-tools/the-compressonator/ AMDs The Compressonator] and a [http://www.katsbits.com/tutorials/textures/making-dds-using-ati-compressonator.php guide] for it.
+
*[https://github.com/GPUOpen-Tools/compressonator AMDs The Compressonator] and a [http://www.katsbits.com/tutorials/textures/making-dds-using-ati-compressonator.php guide] for it.
 
*[http://www.gimp.org/ GIMP] [https://code.google.com/p/gimp-dds/ plugin to export DDS files].
 
*[http://www.gimp.org/ GIMP] [https://code.google.com/p/gimp-dds/ plugin to export DDS files].
 
*[http://www.imagemagick.org/ Imagemagick]
 
*[http://www.imagemagick.org/ Imagemagick]
 
*[http://blender.org Blender] opens DDS textures, but it can't create them.
 
*[http://blender.org Blender] opens DDS textures, but it can't create them.

Latest revision as of 09:04, 9 May 2020

Fluffyfreak wrote:

Formats to use:

In Pioneer we support DXT1 and DXT5 formats, many places will give a long and detailed explanation for what this means but I will be brief:

  • DXT1: 24-bit images, RGB no Alpha channel.
  • DXT1a: 32-bit images, RGBA - results in 1 bit alpha DO NOT BOTHER.
  • DXT5: 32-bit images, RGBA - best alpha quality, use this for patterns etc.

So: Got an alpha channel (like Patterns have)? Use DXT5 otherwise use DXT1. Do not bother using the DXT1a or any other format, partly because Pioneer doesn't support anything but DXT1/DXT5, but also because you get worse quality with only a tiny saving in memory usage :(

Beware of forum threads that discuss the "performance" benefits of DXT1 vs DXT5 - if you're using any DXTn format on anything more powerful than a mobile phone then you've already gotten all the performance benefit you will be seeing.

MipMaps

These are half-size images of your texture, they form what are called a "mip-chain" going from the full resolution image and halving in size until they are either 4x4 for DDS (DXT1/5) or 1x1 for uncompressed textures. They are used to improve the quality of the texture on the 3D models when it is viewed at high angles or as it gets smaller on screen. AMDs The Compressonator can generate the mip-chain for you if you ask it too, when I did the batch conversion it seems as though ImageMagick did the correct thing and generate mipmaps for all of the textures too, I don't know what the GIMP plugin will do.

Neat Trick:

You can manually edit the sub-mips (the lower resolution copies) in a mip-chain to useful effect - make the full resolution image a distinct colour, then make all of the lower mip levels a different colour. Then when you look at the model ingame you can see if the highest resolution is ever actually used. If you make each level of the mips different colour you can even find out which mip is most commonly seen.

Reasons to use DDS (& DXT1/5)

PNG files look like they are smaller, they are only smaller on your harddrive. Once loaded onto the GPU they are between 4 and 6 times bigger than the same texture compressed using DXT1 or DXT5. This has two drawbacks. The first is simply that they take up more room, OpenGL only has a finite amount of memory on the GPU to work with and once it's gone we get bugs saying that the game is crashing. The main problem here is OpenGL doesn't let us know how much memory we can use!!! This is for political, stupid and plain fucking wrong reasons that were decided by total morons who have never had to support software in the real world. AMD and nVidia do provide ways of getting this information, but since they're good graphics card makers they're not the ones that cause us grief, Intel who do cause us all of the grief don't provide us this information. The second problem is not one we have to worry about very much but in theory if we started drawing a LOT more stuff, like trees/grass/rocks/animals/etc on planets, then we might start to use textures a lot more and that would eat up memory bandwidth between the GPU and ram. This is a bit of a worry with integrated GPUs (like the Intel ones) since they share the GPU bandwidth with a CPU, and it's a LOT (LOT LOT LOT) less than a dedicated GPU has available. In practical terms however I've not seen any evidence that this is a problem for Pioneer yet.

For us this is mainly about GPU memory saving, loading time reduction and controlling the final quality of the textures.

DXTn compression does introduce blocky artefacts into textures, so it does create quality issues of it's own, it is a lossy compression method. This makes it unsuitable for most UI, character and some other uses however it's worst problems can be avoided with care.

Use it for 3D models like ships, stations, buildings.

I won't be removing support for PNG files ever, they're useful for development and sometimes, just very very rarely, they're higher quality is useful so use them exceedingly sparingly :)

Useful Articles:

Gamasutra article on DXTn textures from a programmers perspective: http://www.gamasutra.com/view/feature/130906/texture_compression_techniques_and_.php

Gamasutra article on DXTn textures from a artists perspective: http://www.gamasutra.com/view/feature/130877/making_quality_game_textures.php?page=1 this is particularly helpful when authoring textures in such as way that you avoid the worst blocking and colour distortion problems common to the DXTn compression scheme.

Software for working with DDS files