Jump to content


Photo

How to convert almost all Kotor2 textures to DDS (and why)

dds tga conversion kotor2 performance loading

  • Please log in to reply
No replies to this topic

#1 metamorphosis

metamorphosis

    Jedi Apprentice

  • Members
  • PipPip
  • 11 posts
  • LocationNew Zealand

Posted 30 November 2017 - 03:49 AM

Overview

DDS is a file format which contains a texture already in a format that a graphics card can accept (typically compressed and containing prerendered mipmaps). Many but not all games use these files as they effectively reduce both loading (as the files are smaller) and processing (as the files are already in a format acceptable to the graphics card) times. KOTOR2 is one of these games. Unfortunately it's dds support is non-standard, and not complete. Non-pot (power-of-two) texture dimensions are not possible like they are for modern dds files, and the format which obsidian uses for it's dds files is non-standard. Therefore you may only use the bioware dds convertor and not more modern, better alternatives, and also NO dds file viewer will be able to view the files generated by this convertor.

With that out of the way... why bother?



Motivation

I did the Quake Epsilon Build many moons ago, and knew from that that converting textures to dds sped up loading times by 400%. While I enjoyed the newer, better texture packs the community had brought to KOTOR2, I got fed up with the loading times and set about finding out which textures could be converted and which couldn't - starting with all of them, and whittling the number down from there. The resultant conversion made the game loading times acceptable. I've now played through the whole game and corrected all DDS files which would not work as DDS and had to be TGA.



What texture packs did I test/convert?

To save time I haven't put the full names of each of these packages, but anyone familiar with them will know what they are:

 

Spoiler

 

As a general rule, what kinds of textures will convert?

Almost anything, except for:
* Textures which are used as animations
* Some textures which contain transparency (some work, some don't)
* Some textures which are texture atlases, like the ebon hawk texture atlases (some others, like the swoop bikes, are converted fine)
* Some textures which are stretched in-game (some grass/rock textures) don't work properly when converted

All character models can be DDS. Overall it's hit-and-miss. I had to go by trial-and-error to find out which worked and which didn't, and the above rules don't always work. One mandalorian blaster texture wouldn't work, for no apparent reason, when all others did! And while I've taken my time, I haven't stopped to inspect every single blaster in the inventory, so there is a small possibility I may've missed one or two.



What is needed to convert textures?

Firstly all textures must have width and height which are powers-of-two eg 512, 1024 etc. I don't think anything in-game should be 4096, that's killing it, asides from some skyboxes, but up to 2048 is fine. Mostly I rounded up to the nearest power of two when the texture wasn't a power of two, resized then used photoshop's 'sharpen edges' filter to remove the resultant edge-blur. This worked very well. Total image sharpening is not recommended. However if you have a resizer that does Lanczos filter resizing, any additional sharpening should not be necessary. Only for images where the original size was very much closer to a lower power of two (eg. 560, would resize down to 512), did I resize down - and then, no sharpening is needed.

Then simply convert the files using Bioware's dds convertor.

Finally, move the specific TGA files out of your override folder, and put the replacement DDS files in there, instead.



How would I know if a given file doesn't work as DDS?

Either it will be invisible, look like rainbow-coloured static, or be completely white or completely black, in-game. I had to play through the entire game to correct all of these - as some dantoine textures, for example, are used in telos's citadel, and will work as dds on dantoine, but not in the way they're used on the citadel!!!



Okay, so which files can be converted?

The following textures (in tga format) can be converted to dds without issue - for some you may have to resize them to power-of-two dimensions:

Spoiler

 
Please note, load_101PER (from Peragus Large Monitor Adjustment) must be resized down to 1024x1024 (like the other loading screens) in order to work as a dds file in-game.



And which files cannot be converted to DDS (must stay as TGA)?

Spoiler


Can I make DDS packs of the above textures and supply them, save you some time?

No, that'd be up to the authors. If they give their permission, I can, otherwise, I can't really.
I'd actually quite like to compile an all-in-one KOTOR2 HD texture pack, for beginners, but I doubt so many authors would give their permission.



Anything else you should know?

KOTOR2 will read files in both override and any of override's subfolders - so you can create a subfolder called DDS with all your .dds files if you like. Just don't include both TGA and .dds version of the same file - KOTOR2 will load them both (and your loading times will stink).

Otherwise this should at least halve your loading times. Also, although the telos signs in the overhaul pack cannot be converted (since they're animations) I found that resizing some of them to lower powers-of-two resulted in them a. loading faster, b. playing faster/more fluidly as well as c. being displayed in a slightly jumpy way, like signs that are slightly crappy/glitchy - it looks better - try it. Of course, you can also alter the speed of animation in the .lxi file - but this is more fun!



Closing arguments

It was the first time I'd played through with the TSLCRM, and I'm glad I did - the game felt way more complete than it did the first time, ten years ago- but the ending still sucks. Oh well. Thanks to the whole community for coming up with all the great mods, textures and the sound packs. Great, well-rounded game. Now.
 
Attached File  K2_00005.jpg   320.49KB   0 downloads


By the power of grayskull, may the force be with you and also live long and prosper or whatever.






Also tagged with one or more of these keywords: dds, tga, conversion, kotor2, performance, loading

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users