Convert Bioware DDS to TGA/PNG/whatever
Japualtah
Member Posts: 165
Hi folks, I'd like to texture some models with the original Bioware textures so the objets blend perfectly into the scene, but unfortunately I've been unable so far to convert their DDS either with Photoshop with the NVidia plugins or various DDS converters I found on the web.
It looks like a poprietary format, should I just screenshot the textures from nwnexplorer or is there some way to convert those files ?
Cheers
It looks like a poprietary format, should I just screenshot the textures from nwnexplorer or is there some way to convert those files ?
Cheers
0
Comments
TR
Anyways, I'm old school so I value a 4.5 compression factor and still compress my textures when a model is done.
TR
So for everyone that does not know, there are several different compression types for dds, here are the ones that show up when you try to export from the GIMP dds plugin.
BC1/DXT1
BC2/DXT3
BC3/DXT5
BC3nm/DXT5nm
BC4/ATI1 (3Dc+)
BC5/ATI2 (3Dc)
RXGB (DXT5)
Alpha Exponent (DXT5)
YCoCg (DXT5)
YCoCg scaled (DXT5)
This link will tell you "everything" tech and spec wise about the dds format:https://docs.microsoft.com/en-us/windows/desktop/direct3d11/texture-block-compression-in-direct3d-11
And here are two more links from people testing and explaining in more normal less tech minded detail here:http://www.reedbeta.com/blog/understanding-bcn-texture-compression-formats/
And here:http://docs.garagegames.com/torque-3d/official/content/documentation/Artist Guide/Formats/TextureCompression.html
As far as I can tell right now, after testing all the compression types, NWNEE will render BC1/DXT1,BC2/DXT3 and BC3/DXT5 textures with and without a alpha that are exported from the gimp plugin.
You can also select "none" on the compression setting, if you do this you will have to select a format, I tested every format and I could not get any uncompressed dds to render properly in NWNEE.
So what type of compression should we use? I read around the internet and here is the general Consensus, for getting the best performance and file size without losing to much quality.
If you are using a bitmap/diffuse or specular map texture that will not make use of a alpha channel, remove the alpha channel and compress into a BC1/DXT1.
If you are using texture that will have a alpha channel and it will be used as a mask, meaning the pixels of the alpha are mostly all black or all white, which I do not think anything is in nwn, use BC2/DXT3. If you are using the alpha to blend or anything else use BC3/DXT5, most of the time people will use BC3/DXT5 with a alpha, I just wanted to throw it out there that there are people that say BC2/DXT3 is better for masking.
Ok normal maps are a bit of a pickle right now as the only type of compression that will not mangle a normal map is BC3nm/DXT5nm which NWNEE does not support. I saw a post on the internet that showed a 256x256 uncompressed looked better and had less artifacts than a 1024x1024 compressed into BC3/DXT5. You can look here:https://forums.nexusmods.com/index.php?/topic/214873-correct-dds-texture-compressionformat/ I do not know if it is this bad in every game, but me, I would stick with TGA for the normals for now unless you want all the performance you can get, then go BC1/DXT1.
I could not find a whole lot of information on the Use perceptual error metric setting, but I read somewhere that it is designed to increase visual quality in compressed dds images.
I have not played with the mipmap settings much yet, but from what I have read the best mipmap filter is in Kaisers favor, they say you have to test the wrap modes in your application to get the best results with it.
Oh and on the one texture I have used that had a alpha I had to turn on Preserve Alpha Test Coverage and I kept the Alpha Test Threshold setting at 0.50. Without turning it on, the transparent part of the texture was rendered all black. I read somewhere that it is best to use Preserve alpha test coverage anytime you use alpha, and now I know why.
Because dds is lossy anytime that you edit a dds and recompress it, the entire image will lose quality, so make sure you do all your editing and testing on a TGA in game, then when your texture is done and in its final finished state you compress into a dds, and keep your original TGA/PNG somewhere safe on your pc or on a usb drive, that way if you ever want to go back and edit it you can.
Also as many people have already said nwn 1.69/diamond edition or anything before NWNEE, DOES NOT support normal dds textures, you have to use the nwndds tool to convert normal TGAs to nwndds or NWN Crunch for the older versions,
And so if you do make normal dds textures and export them from GIMP, they are not compatible and will not work with 1.69./diamond edition or anything before NWNEE.
you have to use the nwndds tool to convert normal TGAs to nwndds for the older versions
Correction. You do not need to use that ancient tool. There is a newer one written by @symmetric called "NWN Crunch". It supports a number of different file formats. There are binaries for both windows (32 & 64 bit versions) and linux (32 & 64 bit versions).
TR
- Compressonator (standard dds)
- Nvidia Texture Atlas (standard dds)
- NWN Crunch (both standard and nwn dds)
- Bioware DDS Converter (nwn dds only)
The gimp plugin is fine for opening dds files though.From here on it get's a little technical and NWN doesn't support most of what I lay out here. If you don't care about all that, then read no further.
DDS compression
I recommend reading this article about dds compression. It also contains a comparison table.
In short: DDS compression works by dividing images into 4x4 blocks and reducing the number of colors. Instead of saving the full palette of colors for each pixel (8 bit per channel/ color in tga, i.e. 24 or 32 bit) the palette will only contain as few as 4 colors per 4x4 block. It's actually more complicated than that, but that explanation will suffice to understand the following.
(That's why the compression is abbreviated to BC1 = Block Compression 1)
The following formats are available:
- BC1 (DXT1) - 4 colors per block
- BC2 (DXT3) - 4 colors per block, 4 bit explicit alpha uncompressed (not commonly used anymore)
- BC3 (DXT5) - 4+8 colors per block, 4 for color and an extra 8 for the alpha channel
- BC4 - Grayscale, 8 colors per block (also known as ATI1 or 3DC+)
- BC5 - 2xGrayscale, 8 colors per channel =2x8 per block (also known as ATI2 or 3DC or DXN)
NWN currently only supports BC1/ DXT1 and BC3/ DXT5. As you can see there are many names floating around for the same formats, with BCx being the modern/ most recent names.Compressing Normal Maps
As you might know normal maps are basically images where each pixel represents a vector, i.e. RGB values are used to represent XYZ components.
DXT5nm/ BC3nm has been mentioned and it is essentially the same as DXT5/ BC3 with swizzled channels. Basically the Y-coordinate is stored in the Green channel, the X-coordinate in the Alpha channel and Z is dropped and later re-calculated (the normals have to be unit vectors for that). Reasons for using those particular channels:
- Colors are stored as RGB 5:6:5, i.e. the green channel is considered more significant than red or blue meaning better quality when using that one.
- The alpha channel uses an 8 color palette leading to again better quality.
That format is still not ideal however. Ideally one would use BC5/ ATI2/ 3DC to store normals maps, because there each block contains 2 x 8 color palettes (one for each channels) to store X and Y components for each normal - as opposed to 4 + 8 color palette when using DXT5nm/ BC3nm.For normals, perceptual color metrics have to be disabled in the compressor. All it does is weighting the color to match the perception of the human eye (we are most sensitive in the green-yellow spectrum).
While this results in better quality for diffuse images it is absolutely horrible for normal maps. Normal maps are simply vectors stored in the image colors, e.g. Red = X, Green = Y, Blue = Z. And the Y component is certainly not more significant than either X or Z.
TL:DR: BC5 & uniform/euclidean color metrics is best for normal maps.
For single channel maps BC4/ ATI1 would be best, as it offers the best quality (8 color palette) while only storing a single channel, meaning there would be no wasted space because of unused channels.. (Single channel maps = specular, roughness, glowmap, etc.)
Compressonator is good choice. The files it produces conform to the standards. You don't have to build it yourself, there are binaries available on the github page: https://github.com/GPUOpen-Tools/Compressonator/releases. Granted it's a bit hidden.
The gimp plugin and the nvidia tools don't always conform to the standards. So personally I'd recommend Compressonator or Crunch. But with crunch you have to set the right options, which are not documented all that well - something I will have to rectify sooner or later.