Community News Tracker
Select a topic:  

PPM News Tracker
Select a topic:  

Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.
C&C3 Texture formats
November 12, 2013 - 16:48
A quick review of C&C3 dds texture formats and the effect they have on a 512x512 .psd texture.



DXT1
8:1 compression (file size 171kb, TGA 769kb).
Diffuse


This is surprisingly bad.
Firstly you can see how the DXT compression has done a good job with all of the texture with the exception of the star decals.
DXT3 & DXT5 (4:1 compression, both 342kb) do not do any better when it comes to fixing the compression artefacts generated by the star area.

Unless you are using an alpha channel, there's mostly no point in choosing anything other than DXT1 (unless you specify via code, the default format that the compiler compresses textures to is DXT1. If it detects a 1bit alpha it will choose DXT1A, if it detects an 8bit alpha channel it will choose DXT3 or DXT5).


Specular


This is actually not too bad. Small, single colour details will often show the kind of compression artefacts that the arrows point too, but this is often not so big a deal.

Where I have found the most issues is with the house colour channel of the specular map (especially the Nod specular map). If you get compression artefacts on the borders of the house colour, then things can look quite unsightly (you can spot this in standard C&C3 art if you know what to look for).
I would certainly recommend checking to see how the house colour will look with DXT compression (the C&C3 shaders in 3D max have a house colour preview) to see whether any adjustments are needed to minimise the impact of house colour artefacts.
(There are no significant improvements with DXT3 or DXT5, you might has well use DXT1 for specular maps if you do not mind the compression issues).


Normal


Where DXT compression is truly rubbish is with normal maps.
They almost never fail to wreck them in some manner. The above is typical of what DXT compression does to a normal map. Has well has the random destruction of diagonal lines, it can also randomly wreck even straight lines. DXT compression is well known for the issues that it has with normal maps (to be fair efforts were made to improve this by having a DXT format that was specifically designed for normal maps, DXT5_NM, but since C&C3 does not recognize it, it is not relevant for this tutorial).
The arrow that has the letter A in brackets close by, is pointing out another common compression artefact issue. These darker blobs will show up quite strongly in the specular map, provided that the right ( or wrong! ) camera angle is seen.

Once again DXT3 & DXT5 makes no noticeable difference.

The best way to avoid noticing the normal map issues that DXT compression causes is to not look for it in the first place! Once you know what to look for you will spot it readily on the texture and in turn you will spot it easily in game.




5:6:5

The 5:6:5 format is not an image compression format but a bit reduction format. Which is to say that it recreates your texture using less colours... a lot less colours (5bits for R,B, 6bits for G channel, instead of 8bitsper channel).


Diffuse (5:6:5)


No issues with the star decal!
A look at the above and you can overall see how much lower quality the texture is in the darker area. You can see banding in various areas of the texture, I highlighted one easily spotted area, and because of the file size (683kb) this is simply not worthwhile for this type of texture.
Indeed I struggle to think of a situation where this format would be useful. I suppose if you had a very cartoon like texture that did not have a lot of colour variation, and DXT compression was destroying it with colour bleed and artefacts, then maybe this could be useful? but even then it is a relatively large texture file so surely you may has well go with the 24bit options?


Specular (5:6:5)


The above specular is not making use of the blue channel at all has you can probably tell, and because of how noisy the texture is, it is difficult to tell if there is any banding issues.
There is a slight hue difference, with the 24bit TGA being slightly more orange, which would indicate that there is a difference in the green channel between the 5:6:5 and the TGA. So let us investigate that further.

Specular Green channel (5:6:5)


What the hell is that?

Again that is surprisingly bad. It must be said that I could still hardly make out any difference in the red channel (probably due to the noise), but that is a destruction of the green channel!

I can see nothing to recommend using this format for the specular map at all.


Normal (5:6:5)



Pretty poor has expected, yet it is important to note that it does not destroy diagonals, unlike DXT compression.

There is also once again a slight overall hue shift, so this will not do for normal maps at all.




3D Review
W3X - DXT1




W3X - DXT5





W3X - 5:6:5



W3X - X8R8G8B8



The above was done so you could see all the textures working together on the model instead of separate 2d images.
It does not help that the lighting is at a different angle for the uncompressed 32bit image (X8R8G8B8), but you can still get a quick look at the differences of the formats (it helps if you are viewing their original size). For example you can see how awful DXT compressed normal panel lines are and all the specular compression artefacts they add. You can see how the 5:6:5 format creates a texture with less detail (in terms of colour variation). You can also see the small differences between DXT1 & DXT5 compression.


Conclusion and notes
Here are the formats that C&C3 supports:
DXT1 = Compresses image at 8:1 ratio (file size of 512x512 = 171kb)
DXT1A = Same has above but with a 1bit alpha channel (only black & white, file size of 512x512 = 171kb )
DXT3 = Compresses image at 4:1 ratio, supports an 8bit alpha if necessary (file size of 512x512 = 342kb)
DXT5 = Same has DXT3, but supports an interpolated 8bit alpha (file size of 512x512 = 342kb)
R5G6B5 = Uses 5bits each for the R,B channels, and 6bits for G channel, no alpha channel supported (file size of 512x512 = 683kb)
X8R8G8B8 = 32bit, but there is no support for 8bit alpha (file size of 512x512 = 1,366kb!)
A8R8G8B8 = Same has X8R8G8B8, but includes full support for an 8bit alpha channel (file size of 512x512 = 1,366kb!)


Some notes about the above list.
There is no point ever using DXT3 in my opinion has the only thing it provides is worse alpha channel support. Here it is important to specify on your texture xml code that you want DXT5 specifically (If you leave it up to the compiler it will probably choose DXT5 if it detects an 8bit alpha).

For whatever bizarre reason, the engine developers did not include the R8G8B8 format which would have created a smaller (1,025kb) file size then the X8G8R8B8 file, which essentially waste 8bits.
If you go to 1024x1024 the file size jumps to 5,462kb!, so care is needed if using either of the 32bit uncompressed formats that C&C3 supports, because texture memory usage could become an issue.

Generally speaking you want to be using DXT1 most of the time, using DXT1A if you are going to use the alpha channel to make certain parts of your model invisible (alpha test option), or DXT5 if you are using the alpha channels with greyscale.
The 32bit uncompressed formats are a luxury whose use you would want to limit for special items (has a small mod maker I admit that I use far more than I really should!).

From an artistic point of view it is important that you preview your texture in the format that you intend on using, while you are making it, if you want the best results. This will allow you to attempt to compensate for the various issues that the compressed formats bring to your texture, instead of being 'surprised' by the compilers conversion of your texture!
Do not forget to add the appropriate 'OutputFormat' code to your texture xml so the compiler is not making the format choice, you are!

For example:
<Texture id="SASpyPlane" File="SASpyPlane.dds" OutputFormat="X8R8G8B8"/>

PS
The reason that I often work with 24bit & 32bit targas, is that I find that Nvidia's dds plugin does not work well with Photoshop actions (using a single button to preform a recorded task that normally takes multiple clicks, I use it to flatten the psd for previewing the texture on a model in 3d Max).

PPS: This article can be reproduced anywhere in any language has long has the correct credit is given.

Link to NVIDIA Texture Tools for Adobe Photoshop:  https://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop