Beta: SOTS2 Texture File Extractor

Moderator: Makail

User avatar
willdieh
Posts: 105
Joined: Mon May 08, 2017 4:41 pm

Re: Beta: SOTS2 Texture File Extractor

Post by willdieh » Sun Oct 07, 2018 4:42 pm

It's a command line utility, so you need to open a command prompt window to run it

Scottish Kiltz
Posts: 6
Joined: Thu Aug 16, 2018 9:11 am

Re: Beta: SOTS2 Texture File Extractor

Post by Scottish Kiltz » Mon Oct 08, 2018 9:14 am

Morning,

Of course! Am a donut. I was clicking it like it was an ordinary application. Conversion from .bmp~ and .tga~ works great.


However, converting back to game required files, gives me white or missing images for the .bmp~ I notice this thread talks about .tga~ files so does it convert back to .bmp~ or am I do something wrong maybe? I was hoping it would work on Tech Icons and Weapon Icons.

My test was a particle beam icon turned green using paint.net.

Thanks
Last edited by Scottish Kiltz on Mon Oct 08, 2018 5:24 pm, edited 1 time in total.

User avatar
willdieh
Posts: 105
Joined: Mon May 08, 2017 4:41 pm

Re: Beta: SOTS2 Texture File Extractor

Post by willdieh » Mon Oct 08, 2018 1:39 pm

Hmmm, I'll take a look at it. If I recall, the bmp~ files are uncompressed, so it should just be stripping off the SOTS header. Will update this post with my results.

Scottish Kiltz
Posts: 6
Joined: Thu Aug 16, 2018 9:11 am

Re: Beta: SOTS2 Texture File Extractor

Post by Scottish Kiltz » Mon Oct 08, 2018 5:37 pm

Fantastic.

Am looking forward to hopefully swapping out weapon icons or modifying to show dual turrets or like.

I noticed someone mentioned earlier about effect files. I realised that this convertor will enable modders to alter the texture files which then get used by an effect file. Sadly, it won't enable extra versions like a red version disruptor bolt and the original blue/white at the same time but its something, where before it was just vanilla stock.

Massive thumbs up for this work.

User avatar
willdieh
Posts: 105
Joined: Mon May 08, 2017 4:41 pm

Re: Beta: SOTS2 Texture File Extractor

Post by willdieh » Wed Oct 10, 2018 4:59 pm

Scottish,

I tested the current version against .bmp~ files and it worked as expected (at least for some of the tech tree icons I was using for testing). If you give me the filename you were having trouble with, perhaps I can test it specifically.

Keep in mind that the output from a .bmp~ file will be in DDS format - they are not standard .BMP files... you won't be able to just open them up in Paintbrush. Instead, you'll need to open them in an image editor that supports DDS format (like GIMP and the GIMP DDS Plugin, linked near the top of this thread).

I did fix a bug that Visual Studio introduced when I recompiled the utility from 64bit down to 32bit for one user who only had 32bit Windows.
Visual Studio's C++ libraries don't support wildcard globbing on the command line without linking an alternative argv library (setargv.obj) which I didn't do, so wildcards weren't supported in the last build. Unfortunately, the MS solution of using setargv.obj doesn't seem to work properly in Windows 10 since some recent build release of Windows, so I had to switch back to MinGW as a compiler which uses the GNU C++ libaries. At any rate, wildcards are now supported once again. Eg,

Code: Select all

Extract *.tga~
...will result in a bunch of matching .dds files

Scottish Kiltz
Posts: 6
Joined: Thu Aug 16, 2018 9:11 am

Re: Beta: SOTS2 Texture File Extractor

Post by Scottish Kiltz » Wed Oct 10, 2018 5:53 pm

Thanks for checking,

I only tried with the Particle beam icons from both the tech icon folder and the weapon icon folder. I extracted them using your programme into .dds,


extract ParticleBeam.bmp~ Tech Icon
extract bem_part.bmp~ Weapon Icon

opened them in paint.net and recoloured them to a green hue, saved still as a .dds, then used your programme again to convert back to .bmp~.


extract -S ParticleBeam.dds -O ParticleBeam.bmp~ Tech Icon
extract -S bem_part.dds -O bem_part.bmp~ Weapon Icon

User avatar
willdieh
Posts: 105
Joined: Mon May 08, 2017 4:41 pm

Re: Beta: SOTS2 Texture File Extractor

Post by willdieh » Wed Oct 10, 2018 5:59 pm

Ah, sorry, I misunderstood... so the game is unable to work with them after you've re-converted them. I'll have to test that out. I only tested ship textures and another user tested some galaxy backgrounds, so I'll have to see what's going on with the tech tree graphics.

I didn't use paint.net though, so not sure if that's the cause. Didn't even know it supported DDS. Nice. I'll have to try it out.

Scottish Kiltz
Posts: 6
Joined: Thu Aug 16, 2018 9:11 am

Re: Beta: SOTS2 Texture File Extractor

Post by Scottish Kiltz » Wed Oct 10, 2018 6:05 pm

Hi,

It extracts them fine to .dds and paint.net seems able to open most things (its also a free software).

The tech icon went back in and was just white. The weapon Icon was invisible.

I realise your programme was intended for TGA~s, and it was curiosity that made me check the BMP~s. It works fab on TGA~s and I'm certainly getting some cool results in game.

Its impressive work you have achieved.

User avatar
willdieh
Posts: 105
Joined: Mon May 08, 2017 4:41 pm

Re: Beta: SOTS2 Texture File Extractor

Post by willdieh » Fri Oct 12, 2018 1:34 am

Okay, I had a chance to briefly test the tech tree .bmp~ files with Extract.exe. Unfortunately, I didn't find any problems with the utility. Here was my testing process:

1.) Open a command prompt
2.) cd <sots2>\assets\base\tech\icons, mkdir temp, copy *.bmp~ temp, cd temp
3.) Copy Extract.exe into <sots2>\assets\base\tech\icons\temp
4.) run Extract *.bmp~ (converted the entire contents to .dds)
5.) run Extract -S *.dds (convert the entire contents back to SOTS2 format [defaults to name *.tga~]
6.) ren *.tga~ *.bmp~ (rename the default .tga~ extension to the correct .bmp~ extension)
7.) cp *.bmp~ .. (overwrite the original files)
8.) Launch SOTS2 and view the tech tree (looks fine)

This showed the conversion to DDS and back to SOTS2 format without editing works properly

1.) Convert fusion.bmp~ to fusion.dds
2.) Edit fusion.dds in Gimp, save by exporting to fusion.dds with "no compression" set as the option (.bmp~ files dont usually have compression)
3.) run Extract -S fusion.dds (this saves it to fusion.tga~)
4.) ren fusion.tga~ fusion.bmp~ (rename from the default extension to the correct extension)
5.) copy the edited fusion.bmp~ file into the <sots2>\assets\base\tech\icons folder, overwriting the original
6.) Launch SOTS2 and view tech tree. Modified Fusion tech icon is visible with edits

So it seems to work properly for me. The tricky part for most would probably be the edit/export process as you need to select the correct DDS options (no compression for .bmp~. A .tga~ file would be bc3/dxt5 compression).

The fact that you saw white blocks suggests either 1.) you didn't copy the edited file into the correct folder and the game considered it a missing file or 2.) your edit/export process saved the file in the incorrect DDS format (compress instead of uncompressed?) before you ran it back through Export -S and the game couldn't read the result.

For most .tga~ files, after editing the DDS in an editor, you'd export it as DDS with block compression of type BC3/DXT5. BMP~ files are different though as they're uncompressed bitmaps in the game. So exporting after editing you'd select DDS with no compression before running them back through Extract -S

Hope that helps!!

Scottish Kiltz
Posts: 6
Joined: Thu Aug 16, 2018 9:11 am

Re: Beta: SOTS2 Texture File Extractor

Post by Scottish Kiltz » Fri Oct 12, 2018 10:55 am

Hi, success!!!

paint.net appears to be the hitch as it doesn't allow for no compression. its either High, Med or Low.

I downloaded Gimp plus the plugin for DDS and it all worked great. I tested the UV Beamer Icons. changed them to a weird teal colour and loaded them back through and they appeared! Am sure many modders will be happy to know this as now we can swap out some the icons that just don't look right like the EMP. Looks like a blue fart!

With regards to the tech Icons, because the techtree describes the extension I found that both BMP~ and TGA~ can be used so long as you write it in the correct place. So it either comes down to renaming the file extension as you described, or the techtree icon description. In this test it was either for the techtree hook;
<Icon>.\icons\uv_beamer.bmp</Icon> or

<Icon>.\icons\uv_beamer.tga</Icon>

The weapon icon however does have to be converted and renamed back into *.bmp~.

Thank you for all your help with this.

I did quickly try and test if I could change an effect file (i tested on mass driver bullet) but sadly just editing via Notepad++ and clicking save doesn't work. I created a green texture instead of the blue version, found it in the effect file description and changed the word Blue to Green but it just stopped the effect file working sadly. Don't suppose you can do an extract programme for those effect files too??

User avatar
willdieh
Posts: 105
Joined: Mon May 08, 2017 4:41 pm

Re: Beta: SOTS2 Texture File Extractor

Post by willdieh » Fri Oct 12, 2018 3:13 pm

Awesome! Glad you could get it working!

As for the models and effects, as you can imagine, they're much more complex than image formats.
I've been working on and off on decoding the model format and have made some decent progress but am not really that close to having a working solution. I think I've decoded the logic of the model format's data structures, but converting that to a file format that can be used with Blender or other 3D editor is going to take some work.

The effects, well I haven't really even started looking at them as I don't know how 3D animations are generally stored.

I'm kind of a noob when it comes to 3D/graphics programming. It took me months to figure out the 2D image format. It all comes from byte by byte analysis using a hex editor and I had to learn about things like little/big endianess and DirectX texture formats along the way. If only we had the developer pipeline tools to convert these files :sots1:

Post Reply

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 3 guests