Author Topic: Idea: Easier TGA/DDS Conversion  (Read 1034 times)

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« on: November 22, 2011, 06:24:57 pm »


               So, I'm in the process of making some newer weapon models (and matching inventory icons) for my PW, and I've come across an inconvenience that I think one or more of the programming geniuses around here might be able to help with.  Simply put, a default .dds version of an inventory icon (or any other image) will override a .tga version held in either the override folder or a hak file.

Currently, if one wishes to convert a .tga image into a NWN-compatible .dds image, one needs to vertically flip the image (using something like Photoshop or TGAFlipper), then use DDSTools (a command line program) to convert it into a proper .dds for NWN.  This is workable for one or two images, but is a huge time-sink when one has a pile of hundreds of inventory icons to convert.

Yes, you can use TGAFlipper to do a mass/batch flip of .tga images.  And you can write two batch files to a) get a list of files in a directory and then 'B)' instruct DDSTools to run once for every single file in that directory.  However, not everyone knows how to write batch files, and TGAFlipper deletes the original files when flipping (requiring the user to remember to make a backup every time).

---------------------

My idea: a brand new, stand-alone program that correctly converts a .tga into a .dds for NWN, without having to first flip the image, and without having to use a command line or batch file. Basically, a program where you can either a) browse to set source and target directories for conversion or 'B)' just drag and drop one or more .tga files and it/they will be converted to .dds in the same directory.

If the same program were capable of converting .dds to .tga, instead of producing 10 .tga versions of the image, it could produce just the largest (highest resolution) version found within the .dds.  Seriously, does anyone ever use the lower-sized versions produced by DDSTools?  I usually get my .dds to .tga conversion one file at a time using NWN Explorer Reborn (that, too, is limited to one conversion at a time).

I'd write this program if I could (for both Windows and Linux, and call it "The NWN TGA/DDS Headache Cure"), but my programming knowledge right now is limited to html, nwscript, and the barest notion of copy & paste for batch files. '<img'>

If someone takes this on, you can be sure I'll be promoting the resulting software on neverwinternights.info, calling into the NWN Podcast, linking on Facebook, and anywhere else I happen to post about NWN custom content.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« Reply #1 on: September 09, 2012, 03:12:53 pm »


               Did this result in anything?

Actually nevermind... I used this:
http://nwvault.ign.c...r.Detail&id=108 

and discovered that it does all the flipping for you.
               
               

               


                     Modifié par henesua, 09 septembre 2012 - 03:13 .
                     
                  


            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« Reply #2 on: September 09, 2012, 05:01:00 pm »


               I think that's the one I've been using.  I have a couple of folders and run a batch file to do the conversion of tga to dds.  It's very helpful when converting dozens of tgas at a time.
               
               

               
            

Legacy_henesua

  • Hero Member
  • *****
  • Posts: 6519
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« Reply #3 on: September 09, 2012, 05:18:22 pm »


               This is different than DDSTools.

You download it and receive a directory. It has an "in" folder and an "out" folder and a script and a batch file. I used it to make DDS' out of your reforged icons. I needed to since I am also using Project Q.
               
               

               


                     Modifié par henesua, 09 septembre 2012 - 04:18 .
                     
                  


            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« Reply #4 on: September 09, 2012, 06:26:45 pm »


               I would support having a better option like this as well.  So many steps to remember, for everything.

I think the TGA flipping thing is related to extremely old DDS extraction code which I assume made it into a lot of community tools which are still around today.  If you search for "no flipping" in the Omnibus, it appears that this bug was fixed by roboius back in 2003- but I don't recall that he shared the code and so everyone else tool's which did that function suffers from the bug.  That's my guess, anyway.

The Amethyst Dragon wrote...
Seriously, does anyone ever use the lower-sized versions produced by DDSTools?

That's more related to how DDS files are made in the first place.  When an image is compiled, the DDS compression program compresses those 10 (or whatever) images like that to be used as Level Of Detail.  So the decompiler is just decompressing what's there.  Funny/sad thing I've noticed using GLIntercept to see how NWN communicates with OpenGL: Looks like the graphics engine ever only uses 2 of those images, the biggest and the smallest.

All that errata aside, something such as you described would be so much nicer.

The tool that Heneusa is talking about is the internal Bioware DDS compiler which Bioware released- way after everyone else wrote other stuff from scratch.  The problem, IIRC, is that it only compiles.  So it's only one-way.  Which brings us back to the issue of decompressing DDS into TGA in the first place.
               
               

               


                     Modifié par OldTimeRadio, 09 septembre 2012 - 05:27 .
                     
                  


            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« Reply #5 on: September 14, 2012, 02:09:38 am »


               Quick question (but I hope for a detailed reply) - How does bioware dds differ from vanilla dds? What extra information does it carry and where in the file is it?

TR
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« Reply #6 on: September 14, 2012, 04:56:23 am »


               (From memory, at the moment) I'm shooting from the hip on this but IIRC it's purely in the form of a proprietary header.  I believe behind that header it uses DXT1 compression for non-alpha channel textures and DXT3 or 5 for those with alpha.  From everything I've ever read, the header was pure obfuscation.  It was my personal belief that at the time they might have been concerned about potential licensing fees and so pulled the same thing they did with MP3/BMU.  This is all off the top of my head, though.  If you're working on something, PM me and I can try to direct you to some more useful clues.
               
               

               


                     Modifié par OldTimeRadio, 14 septembre 2012 - 04:00 .
                     
                  


            

Legacy_T0r0

  • Sr. Member
  • ****
  • Posts: 380
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« Reply #7 on: November 16, 2015, 01:56:47 pm »


               

*thread resurrection*


 


Did anything come of this idea? Are people still doing mass dds -> tga and vice versa in steps and still using the flipper ?



               
               

               
            

Legacy_Zwerkules

  • Hero Member
  • *****
  • Posts: 1997
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« Reply #8 on: November 16, 2015, 07:02:26 pm »


               


*thread resurrection*


 


Did anything come of this idea? Are people still doing mass dds -> tga and vice versa in steps and still using the flipper ?




Flipping the image is only necessary if it was saved in a different TGA format than the DDS converter expects. If the TGA was saved by Photoshop Elements (and my guess is Photoshop as well) it will work withouth having to be flipped. And when you save it with the Gimp and turn compression off, it will also work without having to be flipped.


You have to use 'save as' instead of just 'save' though because otherwise if it was in the wrong TGA format, it will be saved in the wrong format again. Use 'save as' and give it the same file name it had before.


               
               

               
            

Legacy_T0r0

  • Sr. Member
  • ****
  • Posts: 380
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« Reply #9 on: November 17, 2015, 12:50:13 am »


               

You know,,, so that's why that issue was so inconsistent with me. I couldn't nail down why it only happened occasionally for me. I use photoshop. Thxs for clearing that up Zwerk. So many nuances to remember for this game.


 


So back to original question, no mass dds to tga ? I need to redo all my minimaps so I want to throw all the textures into a folder for TSC to make minimaps.


               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« Reply #10 on: December 02, 2015, 03:57:35 am »


               

So back to original question, no mass dds to tga ?



You can do mass DDS to TGA by using NWN Explorer Reborn.  Just select any "Textures, DDS" entries, right click on it, select "Export TGA", select a folder to dump them to and you're good.



               
               

               
            

Legacy_Tarot Redhand

  • Hero Member
  • *****
  • Posts: 4165
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« Reply #11 on: December 24, 2015, 05:11:16 pm »


               

What would be useful would be the ability to convert other formats into bioware dds without having to create TGAs as an intermediary. Say from png (or any other format that supports transparency) to dds.


 


TR



               
               

               
            

Legacy_Asymmetric

  • Sr. Member
  • ****
  • Posts: 289
  • Karma: +0/-0
Idea: Easier TGA/DDS Conversion
« Reply #12 on: December 24, 2015, 10:57:42 pm »


               

Hmm, well. I could write a gimp plug-in to handle bioware dds files. Maybe in addition to standard dds files, maybe extend this plug-in. But I make no promises and it could take some time as I have my hands full with neverblender atm.