Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: EatThePath on September 29, 2021, 08:42:09 pm

Title: Conversions to new better texture format
Post by: EatThePath on September 29, 2021, 08:42:09 pm
On discord over the past year or so there's been a mounting body of knowledge and experience with a newer, more advanced version of the .dds file format, called BC7. These files are still saved as .dds, but most programs still don't know what to do with them.

Which is a shame, because BC7 textures can be much, much better at preserving soft gradients and certain colors that get mangled in DXT1 and 5 textures, while still retaining many of the advantages of dds textures. FSO added support within the last year, and DahBlount has been advocating their use since, and experiments have shown them to be pretty suited for anything but effects textures so far.

Paint.net has the ability to open and save them, and I hear the latest GIMP has other gotten it or will soon. And there's a tool AMD has published, Compressonator, (https://github.com/GPUOpen-Tools/compressonator) that can do lots of neat technical things including this. Of course, all the hundreds of textures used in a big mod make it utterly impractical for a switch over in large scale, even with an accessible tool like Paint.Net. Compressonator has some ability to do mass conversions, but honestly it's kind of busted and the documentation is bad.

So let me do it for you! I've got a scripted pipeline partly done, using Compressonator at it's core, and yesterday I pitched in to convert all of the NTF reskins that just got released. it took longer to zip and start the upload of the results than the actual conversion process. If you've got a bunch of textures you'd like to give this treatment to and clicking dozens of times in Paint.Net kills that idea, just give me a poke here or on discord. I'd like to make the scripts available to everyone, but honestly I don't know when I'll in a good place to do that with everything else I'm working on or planning to. But five minutes to convert an arbitrary number of files and help out, that's something I can fit into most days somewhere.

Now, one caveat is that this has the most actual improvement to offer if you have original, uncompressed textures to work with. I can convert an old .dds file to a new one, but honestly there's not a lot of point to it unless there's some form of cleanup being done in the middle. Otherwise you'll just have the old texture artifacts very accurately encoded into the new file. And I can't promise instant turn-around times, especially if tons of people want things done or people want to do it a little at a time, but I don't expect that'll be a huge problem.

Also if you want to try to make Compressonator do things yourself, check my crazed rantings notes on the wiki (https://wiki.hard-light.net/index.php/Making_BC7_Textures), they might save you some stress.
Title: Re: Conversions to new better texture format
Post by: Col. Fishguts on October 03, 2021, 09:55:05 am
Interesting, I was not aware of that format.
Does it do both with/without alpha, meaning can it replace both DXT1 and DXT5?
Title: Re: Conversions to new better texture format
Post by: EatThePath on October 03, 2021, 12:24:41 pm
Yes. In very high level, as I understand it, a BC7 texture can use any one of 7 different compression methods on different parts of the image, with the tools hopefully picking what gives the best results for that part. Some of these methods devote lots of space to alpha, some don't spend much or any on it. So you can do either just fine.

The only problem we've identified is that effects textures always render as if they've been given a transparent image, which is to say, very badly. I suspect that needs engine side fixes.
Title: Re: Conversions to new better texture format
Post by: Col. Fishguts on January 03, 2022, 08:27:44 am
*bump*

So I have been testing BC7 maps, they are definitely an improvement in anything that has smooth gradients (e.g. glowmaps with baked-in lighting)

One question popped up... when exporting I can choose "linear" or "sRGB" color profiles. From what I understand, that choice depends on what the engine expects as input.
So does FSO expect one or the other when loading a BC7 encoded file? Or does it read the setting from the file header and convert as needed?
If it does convert, which profile is better suited for the types of maps used?
Title: Re: Conversions to new better texture format
Post by: wookieejedi on January 03, 2022, 09:36:01 am
According to DahBlount you should save them as sRGB.