About the project

Since Substance Painter doesn’t have a DDS export option, I took it upon myself to write a plugin that does that for me. It has saved an immense amount of time for the artists in my game projects, since it allows them to focus on working inside Painter, and not worry about external tools; my plugin handles everything for them automatically. It utilizes Microsoft’s Texconv, and converts all textures to BC7 with proper gamma depending on what texture is being exported. It also resizes images that have very low color variations, and shouts at the user if it detects any problems regarding our naming conventions.

How it works

Our pipeline works as follows: artists export textures to a temporary folde, and from there, the DDS converter steps in, and puts the DDS' in the game folder, and the raw files in a storage folder. This way we always have backups of all the textures without having to export from Painter again.

Even though plugins for Substance Painter are written in QML, this one is almost entirely written in C#. I know it better, and it's easier to write in, thanks to Intellisense, which means I don't have to scavange the scarse plugin documentation for Painter. All I really do in QML is in the onExportFinished function. There I check if the export path is our temporary folder. If it's not, the artist is probably just working on their own stuff, and don't want the converter to run. If it is our temporary folder, however, it will start a subprocess with the texture converter, and return a callback which logs whether the conversion was successful or not. Worth noting is that this tool could easily be reworked to just export the DDS' directly from Painter to a folder, regardless of what folder and files, no miscellaneous files need to be saved. It's just an extra safety precaution I took to save us some work.

Cleaning Up

The cleanup process is fairly basic. First it uses Regex to match some common naming convention errors such as "low", "lowpoly". After that it goes through every other pixel of the texture (for some performance benefit, not that it actually matters since it's so fast anyways), and checks if it's brighter or darker than any other pixel has been before. If it reaches a "soft threshold" difference between min and max it will exit the loop, since there is enough data in the texture to warrant its size. If it never reaches it though, I check if it's greater than my main threshold, in which case I just half the size; else I scale it down to be a 8x8 texture, since it's just a color at that point anyways.

Final thoughts

I would’ve loved to have this tool during my game projects as an artist. So much time was spent thinking about the file conversion, and just letting it handle everything automatically is fantastic. After reflecting on it, however, there is one potential improvement I would’ve wanted to consider. If I made a separate export button just for DDS, the tool would get a lot nicer interface to the end user, since the current way of deciding whether to convert or not is very crude. Creating a button that does everything seems like a reasonable extension to the plugin, that could make it more usable.