Author Topic: TGA to DDS Errors  (Read 345 times)

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
TGA to DDS Errors
« on: December 15, 2011, 04:49:30 am »


               Got me a problem that I'm hoping the texture experts around here might be able to help with.

I'm trying to turn some 32 bit .tga files into NWN .dds files.  I've
already vertically flipped the original images (trying with both Photoshop and
TGAFlipper), but when I run them through DDSTools.exe (from the Vault),
all of my new textures end up littered with black pixels in-game and in the
toolset.  The same thing happens with 24 bit .tga images.

I'm making a few hundred inventory icons intended to override default BioWare ones via hak (rather than override), so they need to be in .dds format (as well as .tga for in the toolset).

What does everyone else use for properly making .dds textures for NWN?  I'm running Windows Vista, but I get this same problem on an older XP machine as well.

Thanks for your help.
               
               

               
            

Legacy_Bannor Bloodfist

  • Hero Member
  • *****
  • Posts: 1578
  • Karma: +0/-0
TGA to DDS Errors
« Reply #1 on: December 15, 2011, 05:21:34 am »


               Hmmm... the last time I heard about something like this happening, the person in question was not using an NVidia vid card.  I know that both DDSTools, and the TGA flipper were originally written with specific NVidia command codes.  But I thought I read somewhere around here that you already use NVidia for your vid.

The one other thing that you might want to ensure, is that you have collapsed/flattened the layer stacks in the original TGA.  (Be sure to first make a backup, just in case!)
               
               

               
            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
TGA to DDS Errors
« Reply #2 on: December 15, 2011, 06:30:10 am »


               Ah, that might be the issue then.  My laptop (where I do all my NWN work) runs a built-in ATI Radeon graphics processor.  My desktop (the older XP machine) does have an NVidia GeForce card...the .dds textures look good on that machine, but look like crap when ported to my laptop.

The laptop doesn't have a problem with the .dds textures found in others' works that I've gotten from the Vault though...only the ones I've made on either of my PCs.  I've collapsed (flattened) all layers in Photoshop before saving as 24 and 32 bit .tgas.

Maybe I'll try running the images one more time through TGAFlipper on the other (NVidia-using) computer before using that computer again to run DDSTools.  *sigh*  I wouldn't have this problem if .dds weren't needed in order to hak-override default inventory icons...one just can't rely on players of a PW using specific overrides though like you can with hak files.
               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
TGA to DDS Errors
« Reply #3 on: December 15, 2011, 06:48:51 am »


               The only thing I can think of which is going to produce noise like that is RLE encoding, AKA TGA compression.  It usually screws up textures more but it's the only thing that comes to mind.

I use this one from BioWare.  I've used other ones but settled on that sometime back.
               
               

               


                     Modifié par OldTimeRadio, 15 décembre 2011 - 06:49 .
                     
                  


            

Legacy_The Amethyst Dragon

  • Hero Member
  • *****
  • Posts: 2981
  • Karma: +0/-0
TGA to DDS Errors
« Reply #4 on: December 15, 2011, 08:37:06 am »


               Thanks, OldTimeRadio.  That one works like a charm, even on my ATI-running laptop.  Not even any need to write a batch file or flip the .tga images beforehand.

Gotta love a community that can (and will) so quickly help with one another's quandries. '<img'> 
               
               

               


                     Modifié par The Amethyst Dragon, 15 décembre 2011 - 08:51 .
                     
                  


            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
TGA to DDS Errors
« Reply #5 on: December 15, 2011, 09:13:10 am »


               Glad that works for you!  If you wanted to be really sure that everything is working well, here's a little trick you can use to sanity check your work and make sure everything is really being compressed correctly: Download this tool from the Vault if you don't already have it and then use it to decompress a texture you compressed with the utility I recommended.

Run this command line on one of your newly converted images:
ddstools.exe -d (filename).dds

It should produce a number of tga files named (filename)(x).tga where x is probably going to be a number from 0 to 8 and which, when viewed, should be smaller versions of your original texture.  Those are the mipmaps and the reason I bring it up is because it was once mentioned that if there were incompatibilities with BioWare's tool it might manifest itself in an inability to correctly create those mipmaps, which are used to save graphics texture memory when an object is far from the viewer.
               
               

               
            

Legacy_Bannor Bloodfist

  • Hero Member
  • *****
  • Posts: 1578
  • Karma: +0/-0
TGA to DDS Errors
« Reply #6 on: December 15, 2011, 09:18:44 am »


               I knew I was forgetting something... I also knew it was something to do with the vid drivers used, and in this case, the dds compression tool used.

Ahhh well, glad you have it working now.  Most of this stuff, well, I use the same routines for everything, so I sometimes forget to tell folks what I have had to do.

1) Create/modify whatever original TGA
2) Flatten all layers.
3) convert to dds, and yes, I always used the dds tool that OMB linked with.

Going other way, from DDS to TGA
1) Export dds, typically using nwnexplorer, but sometimes just copying that file out of a hak etc.
2) convert to tga with following steps
..a) copy and original .dds files to a sub folder called ..\\in
..'B)' run the dds2tga.bat file

cd in
REM First we rename all *.DDS to *. so we can remove the .DDS extension
REM For the mipmap processing
ren *.dds *.
REM Cycle every *. in the /in/ directory
FOR %%i in (*.) DO (
   ECHO Processing %%i.dds
   
   REM Rename it back to a .DDS
   ren %%i %%i.dds
   REM Convert it from DDS to TGA
   ..\\DDSTools.exe -d %%i.dds
   
   REM delete the mipmaps
   IF EXIST %%i1.tga DEL %%i1.tga
   IF EXIST %%i2.tga DEL %%i2.tga
   IF EXIST %%i3.tga DEL %%i3.tga
   IF EXIST %%i4.tga DEL %%i4.tga
   IF EXIST %%i5.tga DEL %%i5.tga
   IF EXIST %%i6.tga DEL %%i6.tga
   IF EXIST %%i7.tga DEL %%i7.tga
   IF EXIST %%i8.tga DEL %%i8.tga
   IF EXIST %%i9.tga DEL %%i9.tga
   IF EXIST %%i10.tga DEL %%i10.tga
   
   REM Rename the 0 to remove the 0 index
   IF EXIST %%i0.tga ren %%i0.tga %%i.tga
   
   REM And move it to the /out/ folder
   IF EXIST %%i.tga move %%i.tga ..\\out\\
)
pause
..c) run tga_flipper.exe twice on the files.  Taking ..\\out as input first time, and exporting to ..\\in  then doing the tga_flipper.exe again using ..\\in and placing output into ..\\out.

Anyway, that seems to solve 99.9% of any issues I have with DDS-TGA conversions.

Note that I have not had an ATI card, since, well, long, long time.  I used to swear by ATI, but when I first purchased NWN, I had considerable difficulty with the card I had, and switched to NVidia... problems were vastly reduced by going that route.

I don't bother updating vid cards, unless I am also upgrading main cpu as well, and as such, have not upgraded in a few years, but so far, have not seen a reason to go purchase the latest/greatest/most expensive vid cards, since they truly don't offer that much more with the cpu setup I have.

Next pc will have all the greatest crap available, and then must last me at least 5 years, which my current pc has done other than 2 failed vid cards.  It is pushing the envelope now though, on just how much more use I can get out of it.  Fine for NWN, and even some of the latest games, but is locked down with XP and directx9c, and not worth upgrading to Win 7 as I would have to purchase ram and this motherboard only takes a max of 8 gig regardless of OS.

Anyway, good to hear you have things working now.