Marvel Mods

XML and MUA - Common Items => Knowledge Base - (not for questions) => Tutorials => Topic started by: LarsAlexandersson on July 13, 2022, 08:05PM

Title: [MUA1] Convert Normal Map Color Between 2006 PC/PS3 & 2016/Xbox 360
Post by: LarsAlexandersson on July 13, 2022, 08:05PM
[/size]

(https://cdn.discordapp.com/attachments/450488661461565441/1027049195821076520/MUA_Texture_Channel_Methods.png)[/list]

Differences:
Title: Re: [MUA1] Convert Normal Map Color Between 2006 PC/PS3 & 2016/Xbox 360
Post by: ak2yny on September 15, 2023, 06:24AM
Alternative way for those that don't have Photoshop.

Based on this article: https://steamcommunity.com/app/1840/discussions/0/3276824488721253491/

The article mentions methods with GIMP, but if it's at all possible, the process is a pain in the ass. Your best bet with GIMP currently is using a white blue channel. You can use the same calculation as below by using math plugins (but implementing these in a script might not be possible).


With ImageMagick (https://imagemagick.org/script/download.php#windows) (available as app and portable tool) you have a command line tool that can convert the textures with a single command. You can write a batch file to make this even faster.

The command is:
magick <input-file> -channel R -fx A -channel B -fx "sqrt(1-((2*R-1)^2+(2*G-1)^2))/2+0.5" -alpha off -alpha on <output-file>
This command works if ImageMagick is installed or if magick.exe is in the current folder (or same folder as the batch).

There are many tutorials and videos about how to write commands and batch files. The construction of this command is:
program (magick) --- input file --- options --- output file

program: This can be "magick" or the full path to the .exe. If ImageMagick is installed, this can be "magick".
input file: full path to the green texture or name and extension if it's in the current folder (or same folder as the batch)
options: -channel R -fx A -channel B -fx "sqrt(1-((2*R-1)^2+(2*G-1)^2))/2+0.5" -alpha off -alpha on
output file: full path to the new texture (which will be the blue one) or name and extension to create it in the current folder (or same folder as the batch)