Difference between revisions of "Choose the right DXTC compression algorithm"

Byline removed
imported>Blade9722
imported>QQuix
(Byline removed)
 
(31 intermediate revisions by 12 users not shown)
Line 1: Line 1:
[[Category:Texturing_Tutorials]]
[[Category:Tutorials]]
[[Category:Tutorials]]
[[Category:Modeling and Texturing Tutorials]]
--[[User:Blade9722|Blade9722]] 07:33, 23 November 2006 (EST)


{{Tools|req0=(re)texture tools}}


=Preface.=
=Preface.=


Altough most of what I'm describing should appear obvious and trivial to those skilled in the arts, I noticed there are some common mistakes which regularly appears also in the work coming from well-experienced texturers, so I think there's need for some clarifications.
Altough most of what I'm describing should appear obvious and trivial to those skilled in the arts, I noticed there are some common mistakes which regularly appears also in the work coming from well-experienced texturers, so I think there's a need for some clarifications.


=Common DXTC compression formats.=
Here's a brief description of the most common DXTC compression formats.


 
==DXT1C/DXT1A==
=Brief description of most common DXTC compression formats.=
 
'''DXT1C/DXT1A.'''


Channels bit depth: 8:8:8:1 RGBA.
Channels bit depth: 8:8:8:1 RGBA.
Line 19: Line 19:


The DXT1A is often described as "RGB texture with one-bit-depth alpha". Actually, for each pixel there are two available configurations:  
The DXT1A is often described as "RGB texture with one-bit-depth alpha". Actually, for each pixel there are two available configurations:  
if the alpha channel is set to 1 (white), RGB channels store usual color info
if the alpha channel is set to 1 (white), RGB channels store usual color info. Instead if the alpha channel is set to 0 (black), upon saving the texture RGB channel are set to 0 as well. In other words, each pixel could contain color info only if the alpha channel is set to white.  
if the alpha channel is set to 0 (black), upon saving the texture RGB channel are set to 0 as well. In other words, each pixel could contain color info only if the alpha channel is set to white.  
This makes a sense, as a black alpha channel usually means that the pixel is completely transparent (invisible), so there's no need to store color info.
This makes a sense, as a black alpha channel usually means that the pixel is completely transparent (invisible), so there's no need to store color info.
This algorithm is tipically used for icons, decals, blood, tatoos, i.e. texture with a completely transparent part.
This algorithm is typically used for icons, decals, blood, tatoos, i.e. texture with a completely transparent part.


Instead, DXT1C is often described as "RGB texture withouth alpha channel". This is not true: the alpha channel is still present, but it completely white. Actually, there's no physical distinction between this and DXT1A, simply upon choosing DXT1C as compression algorithm the alpha channel is set to be completely white just before saving. This is tipically used for common completely opaque textures.
Instead, DXT1C is often described as "RGB texture withouth alpha channel". This is not true: the alpha channel is still present, but is completely white. Actually, there's no physical distinction between this and DXT1A, simply upon choosing DXT1C as compression algorithm the alpha channel is set to be completely white just before saving. This is typically used for common completely opaque textures.


'''DXT3.'''
==DXT3==


Channels bit depth: 8:8:8:8 RGBA.
Channels bit depth: 8:8:8:8 RGBA.
Line 34: Line 33:
This is often described as "RGB texture with explicit alpha". It's commonnly used for partially transparent textures. There application field is the same of DXT5, theoretically you should use this when alpha channel is featuring steep variations. However, I must point out that from my personal experience in 99% of cases DXT5 will preserve better alpha channel detail, so if you don't have time enough to make a comparison, I recommend using DXT5 instead.
This is often described as "RGB texture with explicit alpha". It's commonnly used for partially transparent textures. There application field is the same of DXT5, theoretically you should use this when alpha channel is featuring steep variations. However, I must point out that from my personal experience in 99% of cases DXT5 will preserve better alpha channel detail, so if you don't have time enough to make a comparison, I recommend using DXT5 instead.


'''DXT5.'''
==DXT5==


Channels bit depth: 8:8:8:8 RGBA.
Channels bit depth: 8:8:8:8 RGBA.
Line 47: Line 46:
'''The most common mistake is this: some modders probably thinks that DXT5 is increasing RGB visual quality, so they systematically use it without caring whether alpha channel is used or not'''
'''The most common mistake is this: some modders probably thinks that DXT5 is increasing RGB visual quality, so they systematically use it without caring whether alpha channel is used or not'''


'''Uncompressed dds'''
==Uncompressed dds (8.8.8.8 Unsigned)==


Channels bit depth: 8:8:8:8 RGBA.
Channels bit depth: 8:8:8:8 RGBA.


Wel, I think there is no need to explain this
Well, I think there is no need to explain this.


Now, in Oblivion engine there are three common texture types:
Sometimes useful if you really want to avoid compression artifacts in a normal map, but be careful because the file size will be huge.  On normal maps, if no compression-introduced artifacts are already present, you can afford to reduce the texture size to a smaller one and still maintain a quality normal map.


=Texture Types=
Now, in the Oblivion engine there are three common texture types:


=Color map= (aka base texture or diffuse map)
==Color map==
(aka base texture or diffuse map)


'''RGB Channels''': texture pattern (i.e what you see without effects or lights)


'''RGB Channels''': texture pattern (i.e what you see without effects or lights)
'''Alpha Channel''': the function is dependent on what is the texture function
'''Alpha Channel''': the function is dependent on what is the texture function


'''If the texture is an icon or a decal'''
'''If the texture is an icon or a decal''':
The alpha channel stores the transparency info, based on greyscale (White: completely opaque, black: completely transparent). All the pixels outside the icon/decal shape contour should be completely black, to make them completely transparent. If the alpha channel is one bit depth (i.e all pixels are white or black, no grey pixels), choose DXT1, otherwise choose DXT3 or DXT5.
The alpha channel stores the transparency info, based on greyscale (White: completely opaque, black: completely transparent). All the pixels outside the icon/decal shape contour should be completely black, to make them completely transparent. If the alpha channel is one bit depth (i.e all pixels are white or black, no grey pixels), choose DXT1, otherwise choose DXT3 or DXT5.


'''If the texture belongs to a mesh'''
'''If the texture belongs to a mesh''':
You have to check the mesh in order to understand the function of the alpha channel.
 
- If parallax shader is enabled (look here for the details  [http://cs.elderscrolls.com/constwiki/index.php/Enable_or_Disable_Parallax_shader_on_meshes lnk]), the alpha channel greyscale act as a heightmap for the parallax shader (Black: the pixel is carved, white: the pixel is popping out). Choose DXT3 or DXT5 (recommended the latter).


You have to check the mesh in order to understand the function of the alpha channel.
- If NiAlphaproperty is present, the alpha channel is used for transparency. Choose DXT3 or DXT5 (recommended the latter).
 
- Otherwise, the alpha channel is being ignored, in this case choose DXT1
 
'''If it's a landscape texture'''(i.e. is inside the textures\landscape folder):
the alpha channel is usualy not needed. However, some objects (mostly big rocks) do use landscape textures with alpha, so if you're modifying an existing texture you should keep the alpha if it already exists. If you don't need alpha, I recommend using DXT1.
 
*NOTE: If using the '''OVEP/OBGE Detailed Terrain shader''' mod (http://tesnexus.com/downloads/file.php?id=15245), the alpha channel is used in improving terrain transition blending.
 
'''If you don't know how or simply don't have time to check this''':
if you're replacing a Vanilla Oblivion texture, simply mantain the original choice.
 
==Normal map==
(identified by the _n.dds suffix)
 
'''RGB Channels''': store the normal map info.  Red stores X-axis changes from left to right in height (white = lowering, dark = raising, 50% gray = flat).  Green stores Y-axis changes in height in a manner similar to the Red channel but from top to bottom.  Blue stores Z-axis changes in height (white = steady, grays = change)
 
'''Alpha Channel''': if specular map is enabled, stores the specular highlighting info (white: shine, Black: dull)
 
'''How to enable specular mapping''':
It's based upon compression algorithm
 
- DXT3,DXT5,uncompressed: specular map is enabled
 
- DXT1: specular map is disabled.
 
'''Notice that the common mistake of choosing DXT5 instead of DXT1 in this case is even worse, as the completely white alpha channel will make the texture shining like a star!!'''. For the same reason, if you decide to store the normal map as uncompressed to get rid of the DXTC blockiness, remember to change the alpha channel into black if the texture is meant to be dull.


If parallax shader is enabled  "APPLY_HILIGHT2"
==Glow map==
(identified by the _g.dds suffix)


'''RGB Channels''': Stores the ''minimum'' amount of lighting used on the texture.  White = full lighting, Black = no lighting (the same as if there were no glow map), #2080FF = a blue light, etc.  Note that regular light brighter than the glow map will override it, so if you put a dull red glowmap on a white texture, it will appear red in the dark but normal white under good lighting conditions.  Also note that it is the minimum amount of light, so a green glowmap on a texture which has nothing in the green channel will appear black.


=Normal map=
'''Alpha Channel''': from my knowledge, is never used, so I recommend using DXT1 in all cases.


=Glow map=
==See also==
- To be continued (later, I'm leaving now)
*[[DDS_Files]]
*[http://tesalliance.org/forums/index.php?/topic/1139-guest-speaker-texturing-101-by-vince/ Texturing 101] at TES Alliance
Anonymous user