[TUTORIAL] Texture batch conversion and modification (Albedo-ready)

Lazza,
i usually use a couple of scripts in Photoshop but just used your file and it worked great, good job on the exe.
 
@philrob Yeah, I tended to use PS for this (not CS2; @FuNK! I'd only seen the 'headlines' back when that CS2 happened, I've only now read up and seen what the reality was, shame it got reported wrong on tech sites) but still got annoyed at having to separate the different formats. I sort of shortcutted it by using a file search tool and searching for the dxt strings in the files (which should almost always work out correct anyway), but since I was still pulling them into PS and batching them that way it didn't seem worthwhile trying to do it better. But with command line tools it suddenly made more sense to make it happen :D

It's a shame we can't automate separating out normal and spec images. Filenames can be a clue but I've seen some tracks where mult and spec are named the wrong way round lol
 
@Lazza
thanks for your reply, i agree regarding bumps, specs, mult etc.

The new tools make it so much quicker to get a running updated track.You can then isolate any troublesome texture and adjust it manually.Working on a track update at the moment and it has really sped up the job.
 
Last edited:
@Lazza
thanks for your reply, i agree regarding bumps, specs, mult etc.

The new tools make it so much quicker to get a running updated track.You can then isolate any troublesome texture and adjust it manually.Working on a track update at the moment and it has really speeded up the job.
That was the plan! Glad to hear this worked out ;) But of course let us know any observations!
 
Thank you very much @Lazza . I was going to do the same.
I didn't know AutoIt, but seems easy.
I have to run the command as "magick mogrify", too.
I suppose that this is an environment variables issue.
 
A couple of questions @FuNK!
You use these parameters for dxt1and dxt5 formats
  • -format png
  • -define png:compression-level=0
  • -define png:compression-filter=5
  • -define png:compression-strategy=2
  • -depth 8
  • -channel RGB +level 7.8%,78.4%
Is it correct to use the same parameters for both formats?

I've found some dds in dxt3 format ¿Do we have to use the same parameters for these files too?

Thanks
 
A couple of questions @FuNK!
You use these parameters for dxt1and dxt5 formats
  • -format png
  • -define png:compression-level=0
  • -define png:compression-filter=5
  • -define png:compression-strategy=2
  • -depth 8
  • -channel RGB +level 7.8%,78.4%
Is it correct to use the same parameters for both formats?

I've found some dds in dxt3 format ¿Do we have to use the same parameters for these files too?

Thanks
Some comments on the parameters:

format png
the PNG format is used because it allows graphics with or without compression and all channels RGB + alpha, so this is just perfect for dealing with the different textures...I don't know all the details, but DXT1 and DXT5 have some main difference: One important is the alpha as DXT1 has none but DXT5 does and DXT3 has an alpha too but AFAIK has another compression...again, PNG is the perfect format to keep the alpha if there is any
png:compression-level=0
null compression, to not reduce the quality of the already compressed original texture again before conversion
png:compression-filter=5 + png:compression-strategy=2
these two were suggested in context of loss-less or loss-free conversion to PNG, I cannot really rephrase what they do, but reading they are the best for this purpose was enough for me :D
depth 8
ImageMagick works with 16 bit by default but the DDS textures use 8 bit, so this mainly avoids any trouble with the conversion/manipulation
channel RGB
the command "channel RGB" limits the following manipulation to the RGB channels - RGBA would manipulate the alpha channel too, but we don't want this here
+level 7.8%,78.4%
these are the translated RGB values in percentage for black-point 20 and white-point 200, "+" instead of "-" will cause the operator to do the reverse of the level adjustment (this is required to achieve the wanted effect)
 
Just a small update to the first post: I've added separated commands for DXT1 and DXT5 conversion because the combined command will fail in case there is only one source format (i.e. one folder is empty).
 
Last edited:
Thanks for the tutorial, have been using for a few month now, saved so much time.

Here is some additional useful commands for imagemagick, modify value is in bold, also add link to detailed description from official site.
----------------------------------------
Change texture opacity (sometimes a lot old mod texture isn't 100% opacity. "multiply 2" means original opacity is doubled, 0.5 would be halved):
-alpha set -channel Alpha -evaluate multiply 2

Increase darkness (note difference compare to +level):
-level 3%,100%,1

Increase overall darkness without affect saturating highlights or shadows:
+sigmoidal-contrast 3x0%

Make certain color transparent (HEX color code):
-transparent #878787

Change brightness, saturation, hue:
-modulate 100,80,100

Change gamma (less than 1.0 darkens the image, greater than 1.0 lightens it):
-gamma 1.0

Add alpha channel (ex. batch converting BMP to PNG won't automatically add alpha channel):
-alpha on

Change output DDS compression to lossless (if you don't want to have some purple/red artifacts from other lossy compression like DXT1 DXT5, note file size will be LARGE):
texconv -nologo -timing -y -f R8G8B8A8_UNORM

Add color tint (might useful to fix some color issues):
-fill rgb(0,10,80) -tint 15

Resize or scale image (note they are not exact same, detailed tutorial):
-resize 50%
-scale 400%
Note you can add filter type before -resize
:
-filter Lanczos2 -resize 50%
----------------------------------------
And last, opensource tool to upscale low resolution texture with AI Neural Networks upscaling:
1. ESRGAN Installation Guide for Windows
2. Using ESRGAN, Links, And Other Information (recommand to use IEU.Winforms which has GUI)
3. Get pretrained Model for your image, different model suits different type of photo or image

Good luck!
 
Last edited:
You may want to exclude real road textures from batch conversion. Check you racesurface GMT material (real road), and find the texture names (maybe exclude main texture), then restore those textures to original ones. Usually those textures called Asphalt_MULT, Asphalt_NORM, Asphalt_SPEC, racegroove, marble. If you are using new PBR/json, it probably uses different texture names, you can find names in json file.
 
for my texture conversions i use the dds tools from nvidia https://developer.nvidia.com/legacy-texture-tools
.. there is also a "command-line binary version", the nvDXT.exe, that i use vor (Batch) generating f.e
icons : nvdxt -dxt3 -file *.PNG -outdir ..\ -nomipmap -quality_highest
solid dds: nvdxt -dxt3 -file *.BMP -outdir ..\ -quality_highest
transparent dds: nvdxt -dxt5 -file *.tga -outdir ..\ -quality_highest
As source (BMP, PNG, TGA, TIF) i use any kind of bitmaps (including selfmade albedos) comming from any grafic tool.

May be, that could be helpful :)
 
Last edited:
Back
Top