Fix Opening Repaint Tool DDS Output Files

Road-hog123

An Orange Bus
Administrator
UKDT
Dec 10, 2015
1,784
The OMSI SDK comes with a tool called the "Repaint Tool" that can be used to repaint the default buses, as well as some of the DLC buses. Many AI or static vehicles also seem to use these files. They are *.dds files, however attempting to open them with my go-to image editor (Paint.NET) results in an error:
upload_2017-4-14_21-19-53.png
What is perhaps more strange than a DDS file apparently not being DDS is that the files preview file in File Explorer and appear to open fine in Paint or GIMP.
Previously it has been possible to get around this by using Paint or GIMP and then copying to Paint.NET to do the edits, before saving again as a DDS. The issue here is that the original DDS images are in fact mostly transparent, but the images in Paint/GIMP are opaque. This is not desirable, because the alpha channel of the original DDS image is used for setting how much reflection a particular bit of the texture should have (how chrome that part is). An opaque image is 100% chrome, so you get a bus that looks like this:
8f291be877ffcc42b5125f05f2c9dd3e.png
A question was asked today about repainting default AI, so I thought I would investigate to see what was going on. Analysis of the file headers reveal that actually these "DDS" images are 32-bit BMP images with the *.dds file ending.

A little research and it turns out that there is a filetype plugin available for Paint.NET that allows the opening and saving of 32-bit bmp files. Simply download the "BmpX.zip" file from post #7 (link should take you to it) and copy "BMP32 Paint.NET FileType.dll" to the Paint.NET\FileTypes directory to install. You can then open these dds files by renaming them to *.bmpx (this slightly different ending is used so the plugin does not overwrite the default *.bmp filetype) and opening them with Paint.NET.

Now, when editing these files it may be best to open the *.bmpx file and then use a plugin from BoltBait's Plugin Pack to convert the alpha to grey-scale (Effects > Object > Switch Alpha to Gray). If you then rename the file to *.bmp and open it again, you get an opaque file to edit (this avoids the issue with Paint.NET interpreting 100% transparent pixels as white, regardless of what colour they should be). Once you've completed your edits you can copy the grey-scale image and use the "Paste Alpha" plugin from the same menu to put the alpha channel back, so you can save the image with variable alpha. You can either save as *.bmpx and rename to *.dds to get the same "DDS" images as before, or just save as an actual DDS. Either works (so long as your DDS format isn't DXT1, as that doesn't support the full alpha channel), but a real DDS will have a significantly smaller file size (BMP images are not compressed in any way).

Hopefully this helps. :)
 

0118999

Do'er of administrative things
Administrator
Premium Subscriber
Oct 24, 2016
548
For DDS files in Ext32 or DXT5 format I typically use DXTbmp freeware. There is also an nVidia plugin for Photoshop. All my repaints thus far I've just done in native Photoshop (I appreciate this it not cost effective for most, I just happen to get the software through work)