DDS creation: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
m (Done, peter_spy & Geep)
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This quick guide will describe the steps you'll have to follow in order to create DDS files suitable for use in your Dark Mod maps and how to convert from DDS to other image formats using "[http://darkmod.taaaki.za.net/tools/ati_compressonator_v1.21.zip The Compressonator]". DDS files are a lot smaller than the uncompressed TGAs, often around 15% of the size. The greatest benefit of this is seen in performance and the benefit of using higher res textures.  
''This page was entirely rewritten in August 2020 by peter_spy and Geep - A shortened version of the prior content here may be found at new page [[DDS Creation with ATI Compressonator]].


It is strongly suggested that while you are creating and adjusting your texture that you should use TGA until you are ready to release it and then compressing the relevant images to DDS for release.
==Introduction to DDS==


== Guidelines for DDS Textures ==
DDS (Direct Draw Surface) is an image format often used in games due to its significant advantages over other file types:


Due to these reasons it is '''strongly recommended''' that you compress both '''diffuse''' and '''specular''' textures. Normalmaps should however not be compressed, please use TGA!
'''No need for conversion during load''': This is a target format in which textures are stored in your GPU memory. Other image types, like TGA, have to be converted during loading, and that makes the whole process longer.


*'''Diffusemap :'''
'''Better image quality with mipmapping''': Game engines use LOD systems to generate textures further away from the player, but (without mipmaps available) that results in blurred image and moire patterns. Mipmaps are scaled-down versions of your texture, stored within the same file as the full-scale texture. Mipmaps will improve image quality, the transition between LOD stages, and overall performance. More on mipmapping: https://en.wikipedia.org/wiki/Mipmap
:Does the texture have '''transparency'''?(i.e leaves, spiderwebs etc)
:*If '''NO: DXT1'''
:*If '''YES: DXT5''' and read the following note:
Note : Please be aware that at the moment TDM/Doom 3 only supports hard edges for transparency, as such you wont get the gradual blending from transparency, however in the future it is likely that we will be able to have this smooth blending, so saving your transparency in with DXT5 and then using the alphaTest keyword in your material will allow you to control where the hard edge is located easily. If your texture is meant to only ever have a hard edge you may also experiment with using the explicit alpha in DXT1 as this compresses much better.
*'''Specularmap :'''
:*'''DXT1''' - should be more than adequate as specular does not require alpha information.
*'''Normalmap :'''
:*'''NONE''' - Use TGA!


'''Very efficient compression''': Depending on the DDS compression format, a typical results is around 25% of the original uncompressed file. For example, a 2048x2048 px RGB texture saved as uncompressed TGA will be around 12 MB. Save it as DDS, and you'll go below 3 MB. Other formats like PNG or Zip compression will give you around 9 MB.


DXT3 can be used, however it has very little benefit and is not worth using unless you have a specific reason.
==Textures in TDM==


TDM can handle textures in either TGA or DDS formats. For guidance in preparing compliant texture files, applicable to both formats, see:
* [[How_to_add_Textures_to_The_Dark_Mod]]
* [[Texture_Guidelines]]




==Converting Image To DDS==
'''Folder structure in your FM'''
You'll need [http://darkmod.taaaki.za.net/tools/ati_compressonator_v1.21.zip ATI's "The Compressonator" application version 1.21.1044] with this exact version - other versions might work for diffuses and speculars, but for compressing DXT5 RXGB normalmaps this is the only version that works. Install/unzip it to a folder and create a shortcut if you like.


=== Compress Diffuse/Specular Maps ===
While all TGA files go to:
* Open your source (TGA) file
* Create Mip Maps using the '''Box-Filter''' with the lowest mip map size of '''1x1'''.
[[Image:01_mips.jpg|frameless]]


* Click the Compress button next to "ATI 3Dc Compression"
    yourFmRootFolder/textures/''[optional subfolder(s)]''
* Select the correct compression type by reading the section above, [[DDS creation#Guidelines for DDS Textures|Guidelines for DDS Textures]]
* Make sure that the channel weighting values are as follows :
:'''red=0.3086'''
:'''green=0.6094'''
:'''blue=0.082'''
* Click Compress
[[Image:02_compression.jpg|frameless]]


* Save your DDS to the '''dds/''' tree, e.g. dds/textures/darkmod/stone/blah.dds.
DDS files should go to:


    yourFmRootFolder/'''dds'''/textures/''[optional subfolder(s)]''


'''Note about file locations:'''
In other words, you need to copy-paste your folder structure into the dds directory. (At one time, the DDS hierarchy could be no more than 5 deep; this is no longer an issue.)
If the TGA version of your image (e.g a working diffuse) was located at :
:/doom3/mymission/textures/brick/mybrick.tga
You will save the dds to :
:/doom3/mymission/dds/textures/brick/mybrick.dds
However in the material file you will still refer to it as :
:textures/brick/mybrick
Make sure to remove your TGA to test the finished DDS, if you have followed this it will work flawlessly.


'''Priority''': TDM gives DDS files higher priority than TGAs. If you have both for a given material, the engine will only load the DDS.


=== Change the File Extension to lowercase ===
'''Leave Normal Maps as TGA''': You can safely convert diffuse and specular textures to DDS. But normal (bump) maps are not images in the traditional sense; they're more like vector maps. Any lossy compression will always introduce some artifacts and otherwise damage that data. To be on the safe side, keep normal maps as TGAs.
The Compressonator automatically names the file *.DDS, but all files should be lowercase (including TGAs). Be sure to rename the files to a lowercase .dds extension before uploading them.  


Option A: Use Windows Explorer. You need to change your Explorer settings to display the file extension:
==DDS Creation, In General ==
# Open up Windows Explorer
# Go '''Tools''' > '''Folder Options'''
# Click the View tab and disable '''Hide extensions for known file types'''


Then you can highlight your file and hit F2 (or right-click > Rename) and change the extension to lowercase.
'''Compression Formats''': DDS files can be compressed in different ways, depending on source image requirements. As a general rule, use -
* DXT1 compression with RGB images
* DXT5 for textures with alpha channel transparency
More info on compression formats: http://wiki.polycount.com/wiki/DXT


Option B: This can also be done via the command line '''Start''' > '''Run...''' > '''cmd''' (then cd to your textures folder) and rename the files via:
'''Mipmaping''': Mipmap generation is mandatory in TDM. Otherwise DDS textures won't show in game and you'll get console errors.
:ren *.DDS *.dds


== Working with Transparency/Alpha==
TIP: You can improve texture quality - at no additional performance cost - by using the best mipmaps scaling filter available in the DDS file export settings. Usually they're ordered from faster/low-quality to slower/high-quality.
Quite often when working with alpha and converting from TGA to DDS you will have trouble getting the alpha to work correctly. There are a number of causes for this however the easiest way to deal with it is to rather save your texture out as a TIFF and then open it in The Compressonator, if you are saving from Photoshop/GIMP disable layers in the save options but make sure its set to preserve transparency. When opening it in The Compressinator remember to right click in the image and view RGBA/Alpha to check that it is correct before generating mipmaps or compressing.


==DDS Creation with Specific Tools==
* [[DDS Creation with GIMP]]
* [[DDS Creation with ATI Compressonator]]


==General Workflow Tips==


== Batch Processing ==
* Convert to DDS only after you have finalized textures that make up your material. There are at least two reasons for that:
Choose '''File > Batch Compress''' or hit F4 to open the batch compression dialog. Choose the same compression settings as described above for your diffuse and normal maps. Don't mix diffuse/speculars with normals as they require different compression settings.


[[Image:dds_batch_screenshot.jpg|frameless]]
: '''DDS format isn't suited for fast iteration''': You have to restart the game and reload the map to see the any changes. With TGA files, you just need to use a refresh command to see your changes in an instant.


: '''DDS compression is lossy''': While the compression ratio is pretty great, it slightly reduces image quality. You shouldn't work on DDS textures directly, as you'll decrease image quality with each save. Keep your source files and work on them instead, then export TGAs to DDS when you're happy with the final result.


* Planning to revise and test your material's textures? Besides re-exporting the updated textures as TGA, be sure to delete its old DDS textures, that would have priority.


== Command Line Parameters ==
==Testing Your DDS Texture==
ATI's compressonator provides some command line parameters to compress the textures:
Mipmapping is affected by in-game Anisotropic Filtering. Set it to x16 to ensure maximum image quality while testing your materials.
thecompressonator -convert "normal.tga" "normal.dds" RXGB +red 0.0 +green 0.5 +blue 0.5 -mipmaps
thecompressonator -convert "specular.tga" "specular.dds" DXT1 -mipmaps
thecompressonator -convert "diffuse.tga" "diffuse.dds" DXT1 -mipmaps
thecompressonator -convert "diffuse_with_alpha.tga" "diffuse.dds" DXT5 -mipmaps
 
 
 
==Converting FROM DDS to common image file formats==
 
This is trivial but slightly confusing on The Compressonator:
 
* File Menu > Save Original
* At the bottom of the dialog below the file name input select ''save as type''. It may show DDS by default so don't be put off.
* Select file format from BMP, PNG, or TGA (use TGA generally for Dark Mod.)
* Make sure the filename you want is shown in the input box and click ''save''.
 
 
 
== Compressing Normalmaps (for reference) ==
{{important|headline=Important|text=The normalmap DDS compression section is here for documentation purposes only. You '''don't''' need to compress the normalmaps for using them in The Dark Mod.}}
* Open your source (TGA) file
* Create Mip Maps using the '''Box-Filter''' with the lowest mip map size of '''1x1''' (same as for the diffuse maps).
[[Image:01_normal_mips.jpg|frameless]]
* Compress your normalmap using the '''UberCompressor''' in '''DXT5 RXGB''' format with the colour weighting of '''red=0, green=0.5, blue=0.5''' and '''"adaptive" ticked off'''.
[[Image:02_normal_compression.jpg|frameless]]
* Save your DDS to the '''dds/''' tree, e.g. dds/textures/darkmod/stone/blah_local.dds. You won't need to add the dds/ path prefix to your shader definition, this is automatically added by the game.


==See Also==
* [http://wiki.polycount.com/wiki/DXT DDS compression formats]
* [https://en.wikipedia.org/wiki/Mipmap Mipmaps]
 
[[Category:Tutorial]]
[[Category:Tutorial]]
[[Category:Textures]]
[[Category:Textures]]

Latest revision as of 15:51, 1 September 2020

This page was entirely rewritten in August 2020 by peter_spy and Geep - A shortened version of the prior content here may be found at new page DDS Creation with ATI Compressonator.

Introduction to DDS

DDS (Direct Draw Surface) is an image format often used in games due to its significant advantages over other file types:

No need for conversion during load: This is a target format in which textures are stored in your GPU memory. Other image types, like TGA, have to be converted during loading, and that makes the whole process longer.

Better image quality with mipmapping: Game engines use LOD systems to generate textures further away from the player, but (without mipmaps available) that results in blurred image and moire patterns. Mipmaps are scaled-down versions of your texture, stored within the same file as the full-scale texture. Mipmaps will improve image quality, the transition between LOD stages, and overall performance. More on mipmapping: https://en.wikipedia.org/wiki/Mipmap

Very efficient compression: Depending on the DDS compression format, a typical results is around 25% of the original uncompressed file. For example, a 2048x2048 px RGB texture saved as uncompressed TGA will be around 12 MB. Save it as DDS, and you'll go below 3 MB. Other formats like PNG or Zip compression will give you around 9 MB.

Textures in TDM

TDM can handle textures in either TGA or DDS formats. For guidance in preparing compliant texture files, applicable to both formats, see:


Folder structure in your FM

While all TGA files go to:

    yourFmRootFolder/textures/[optional subfolder(s)]

DDS files should go to:

    yourFmRootFolder/dds/textures/[optional subfolder(s)]

In other words, you need to copy-paste your folder structure into the dds directory. (At one time, the DDS hierarchy could be no more than 5 deep; this is no longer an issue.)

Priority: TDM gives DDS files higher priority than TGAs. If you have both for a given material, the engine will only load the DDS.

Leave Normal Maps as TGA: You can safely convert diffuse and specular textures to DDS. But normal (bump) maps are not images in the traditional sense; they're more like vector maps. Any lossy compression will always introduce some artifacts and otherwise damage that data. To be on the safe side, keep normal maps as TGAs.

DDS Creation, In General

Compression Formats: DDS files can be compressed in different ways, depending on source image requirements. As a general rule, use -

  • DXT1 compression with RGB images
  • DXT5 for textures with alpha channel transparency

More info on compression formats: http://wiki.polycount.com/wiki/DXT

Mipmaping: Mipmap generation is mandatory in TDM. Otherwise DDS textures won't show in game and you'll get console errors.

TIP: You can improve texture quality - at no additional performance cost - by using the best mipmaps scaling filter available in the DDS file export settings. Usually they're ordered from faster/low-quality to slower/high-quality.

DDS Creation with Specific Tools

General Workflow Tips

  • Convert to DDS only after you have finalized textures that make up your material. There are at least two reasons for that:
DDS format isn't suited for fast iteration: You have to restart the game and reload the map to see the any changes. With TGA files, you just need to use a refresh command to see your changes in an instant.
DDS compression is lossy: While the compression ratio is pretty great, it slightly reduces image quality. You shouldn't work on DDS textures directly, as you'll decrease image quality with each save. Keep your source files and work on them instead, then export TGAs to DDS when you're happy with the final result.
  • Planning to revise and test your material's textures? Besides re-exporting the updated textures as TGA, be sure to delete its old DDS textures, that would have priority.

Testing Your DDS Texture

Mipmapping is affected by in-game Anisotropic Filtering. Set it to x16 to ensure maximum image quality while testing your materials.

See Also