December 21, 2024, 17:17:58

Author Topic: [Tool] Texture Converter  (Read 39241 times)

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
[Tool] Texture Converter
« on: January 19, 2010, 19:34:01 »
Since there's none readily available, I made a simple texture converter for converting Nexus' .tex files to .tga format. It's only a one-way converter, so in order to get the modified or replaced textures back into the game, just use the game's standard texture converter for that.

Capabilities:
- should be able to read all .tex files without errors
- outputs to 24-bit .tga or 32-bit .tga files, depending on if there is an alpha channel or not

Requirements:
- .NET Framework 3.5

How to use:
- extract the NexTexC.exe somewhere and drag some files or folders onto it using Windows Explorer (or similar programs)
- the converter will create a subfolder "textures" storing all converted texture files
- it'll scan subfolders and preserve the folder structure
- you can also use it as a strict command line tool, just enter "NexTexC <path>"
- patience, it may take a few minutes, if you're trying to convert all textures at once

Limitations:
The standard Nexus texture converter changes the input textures somewhat... bump maps will be transformed into normal maps, luminosity maps will be inversed and stored in the color map's alpha channel, specular maps will be stored in the normal map's alpha channel, etc.
This converter won't reverse these changes, so before converting modified textures back into Nexus' format, you'll need to get them prepared for that.

Download Texture Converter
« Last Edit: April 15, 2011, 01:15:05 by Arparso »

Offline DreamorCZ

  • Petty Officer
  • **
  • Posts: 110
  • Karma: 1
    • View Profile
    • Czech Gaming Nexus
(No subject)
« Reply #1 on: January 19, 2010, 19:56:21 »
Thanks for this amazing tool.  It's great help for restar of B5 project.
Editor in Chief at http://www.cgnexus.eu/

Offline GeoModder

  • Chief Petty Officer
  • **
  • Posts: 279
  • Karma: 4
    • View Profile
    • http://
Re: [Tool] Texture Converter
« Reply #2 on: April 06, 2011, 22:41:12 »
Arparso, could you give some tips on how to keep data stored into a .tex file when converting it to a Targa file and back to .tex format?

What I tried to do was converting a file to the Targa format, resaving the Targa to .dds and then converting this .dds file back to .tex format. I did the .dds step because only doing the .tex --> .tga --> .tex steps seem to create huge-sized luminosity and/or bump maps. The extra .dds step solves the size issue, but I'm losing detail in either pixels or 'depth' perception.

Offline Arparso

  • Administrator
  • Lieutenant
  • *****
  • Posts: 558
  • Karma: 14
  • I can see you...
    • View Profile
    • http://arparso.de/nexus
Re: [Tool] Texture Converter
« Reply #3 on: April 06, 2011, 23:40:52 »
Note the part I put under "Limitations:"
Quote
The standard Nexus texture converter changes the input textures somewhat... bump maps will be transformed into normal maps, luminosity maps will be inversed and stored in the color map's alpha channel, specular maps will be stored in the normal map's alpha channel, etc.
The tga-textures you have BEFORE the first conversion to .tex get converted in this way:

  • XXX.tga -> stored in RGB channels of XXX.tex
  • XXX__lum.tga -> the inverse (!) will be stored in alpha channel of XXX.tex
  • XXX__bump.tga -> a normal map will be calculated from this and stored in RGB channels of XXX__bump.tex
  • XXX_spec.tga -> stored in alpha channel of XXX__bump.tex
To get the original TGAs out of the .tex files, you'd need to use my texture converter and afterwards reverse the above process. E.g. after the use of my converter, extract the alpha channel from XXX.tga, invert the colors and save it as XXX__lum.tga and you've got the original luminosity map (more or less).

The bump map can't be retrieved this way, since after using my converter you'll only get the normal map calculated by Nexus' texture converter. There are tools to reverse this process, but the results are rarely satisfying.

I wouldn't recommend using .dds textures. These are highly compressed with a rather visible decrease in quality and should only be produced as the very last step of optimization, when the texture is final. For Nexus it's not necessary at all, because Nexus' texture converter does this compression all by itself, if selecting the proper conversion setting.

The increase in size by the .tex->.tga->.tex conversion most likely results from this. If you convert a compressed .tex to .tga with my converter, the file size will dramatically increase (since the TGAs aren't compressed at all). To make the resulting .tex smaller, just choose a different compression setting in the converter.

Offline GeoModder

  • Chief Petty Officer
  • **
  • Posts: 279
  • Karma: 4
    • View Profile
    • http://
Re: [Tool] Texture Converter
« Reply #4 on: April 07, 2011, 22:00:22 »
Ah, too bad on the bump maps.
Basically I was converting Earth's .tex files from "Nexus - tji" to the targa format, flipping and mirrorring them, and convert these reversed .tga's back to .tex. Those flipped textures let the Earth rotate in the correct direction ingame when switching the view upside down.
Those (original) bump files give a profound relief effect around the terminator where there are mountain ranges and such. I can of course just use the regular bump files, but someone who knows his geography would certainly notice the mountains aren't on the right locations. :(