Alchemy 5 Texture Replacement Method by MrKablamm0fish, incl. FAQ by ak2yny

Started by ak2yny, February 07, 2021, 06:52PM

Previous topic - Next topic
February 07, 2021, 06:52PM Last Edit: June 16, 2024, 06:26AM by ak2yny Reason: Replaced expired Discord links
Alchemy 5 Texture Replacement Method
Method & optimization sets by MrKablamm0fish. Tutorial by ak2yny.

Requires Alchemy 5. Please follow the instructions.
This also works with Alchemy 2.5, but only for Option 1. It has been reported that there is a path issue when injecting. Alchemy 2.5 specific instructions. Let us know, if you figure out injection.
Check this guide for incompatible games and platforms.

Download the optimization sets here, to avoid to have to deal with settings.
Tutorial on Discord

1) Open the skin in Finalizer
2) Load optimization set "Extract_Textures_from_IGB.ini". You can use drag & drop.
3) Run optimizations to create TGA. All mip-maps will be exported as separate textures.
    IMPORTANT: Save the new IGB and close Finalizer. The new IGB is smaller, because it now only references the images.
4) You're now ready to modify the textures.
    - If you only want to colour-swap them, you can use IrfanView or XnView, which support batch processing.
    - Modify the TGA with an image program, such as GIMP or Photoshop (with the help of Insight Viewer)
5) Save your new images as TGA, replacing the original images.
    Don't forget the mip-maps, if the skin has them (see Question 2 below).
    Make sure the TGA files are in the same folder as the IGB.

There are now two options.
6) Copy or move the IGB and TGA files to the actors folder.
6) Open the saved, smaller IGB in Finalizer.
7) Load optimization set "Inject_Textures_into_IGB.ini". You can use drag & drop.
    (If your skin has mip-maps, check Question 2 below.)
8) Run optimizations to import the new textures. Save the IGB.

Use Option 1, if you want to modify skins a lot, and for your personal use.
Use Option 2, if you want to release the skin, or if you want to run additional optimizations (such as Global Color).

Alchemy 5 Texture Replacement FAQ
By ak2yny.

1) Question: How do I load optimization sets into Finalizer?
    Drag & drop them into the optimization filed:
    Or, you can right click in the optimization field and select "Add optimization set". Then find the ini-file.
    (Btw., if we're talking about optimization sets, we're talking about optimizations saved/exported as ini-files.)
    Bonus question: Can I make my own optimization sets?
    Yes, of course: You can add as many optimization from the "Optimizer Palette" (left of the optimization field) as you want.
    Customize them by double-clicking on them.
    To save, right-click and select "Save all as optimization set". Choose a path and filename.
    Here is a video by UltraMegaMagnus of an extraction process of images.

2) Question: What are mip-maps, what is IrfanView, what is colourswap, and what do I do, if I only want to add my new texture? But for what we want to do, we only want to know three things:
      I:  Only default skins (and re-skinned default skins) have mip-maps. There is no custom skin that has mip-maps AFAIK.
      II:  If you edit a default skin, all mip-maps are extracted as separate images with the same name as the full texture, but an additional number.
      III: All mip-maps are the exact same picture as the full texture only scaled down (a quarter each time).
    IrfanView is only useful if you want to colourswap a texture, because you can use its batch function.
    What I call colourswap is switching the blue and red channel of an image. In IrfanView it's "Image">"Swap Colors">"RGB->BGR".
    For replacing a texture of a custom skin (without mip-maps), you can save your new custom texture in the same format (TGA) and then copy-replace the extracted texture.
    For replacing a texture of a default skin, with mip-maps, you have to save your texture to each mip-map size and replace them all.
    But I'm not going into the How-To, because there's an easier way:
    Just replace the full texture and follow the steps to internalize. When you're done, generate mip-maps (settings).
    Tip: Save additional optimizations to a new set - scroll down to Run Optimizations.

3) Question: I have seen those default skins with removed mip-maps and they look better. Can I do that?
    Thanks to UltraMegaMagnus we can.
    Good to know: if you did that, you can handle the skins like the custom skins. No need to deal with mip-maps anymore.

4) Question: What are all those images (TGA) that I have now? I only want to replace the skin...
    Many skins consist of multiple textures, especially if they're from MUA PC or custom ones.
    Unfortunately, it's not very easy to explain them. Some of the textures can be mip-maps (see Q.2).
    Other textures can be maps, which are different layers to the skin with different functions.
    And lastly there can be multipart textures. E.g. The head can have a separate texture.
    Let us look at an extracted IGB and the textures:
    The red arrows mark the full textures, which aren't mip-maps. It's fairly easy to identify those.
    To replace a skin, you only want to deal with full textures. The filename can be an indicator to what's inside, but not always.
    You can open each image to see what they are. Let's have a look at Iron Man's textures to have a guide:

0 diffuse1 normal2 specular
3 environment4 environment mask5 gloss (aka emissive)

    More explanation about maps can be found here under "UnitIDs that MUA use with some notes".
    Usually it's enough to replace the diffuse texture, or one or multiple textures of a multipart texture.
    If you re-skinned a skin with additional maps, and made enough changes to want to edit the maps as well, you can do that. It may be required to convert extra texture maps to a format that the game supports. For MUA PC 2006 this is DXT1, except the normal map, which is DXT5. To filter them, you must define the texture names in an exclude text file (details in igConvertImage). Put the normal map into the exclude text file and add it to the DXT1 convert optimization with "exclude", and to the DXT5 convert optimization with "include". You can save the set for later use.

5) Question: Okay, I know now what the textures are, but I really only want to edit the diffuse texture. How do I get rid of the others?
    With the skin still open in Finalizer, click on the search tool. Enter "igTextureBindAttr" (without double quotes) and select "by type".
    Now search for all instances of "igTextureBindAttr". Check the UnitID by expanding this node, or by clicking on "Edit object fields".
    To only keep diffuse textures, you delete every "igTextureBindAttr" node, except the ones with UnitID 0.
    For each deleted "igTextureBindAttr" node, also delete the "igTextureStateAttr" node right underneath, as shown in this video:
    Make sure to always delete both. Also delete all instances in a skin with multiple elements (eg. head and body),
    so don't finish the search until all nodes are deleted, except the ones you want to keep. Save and continue with step 2 (or 3).

6) Question: What do I do, if I want to change the normal texture as well or if I want to keep the normal texture?
    The normal map needs to be DXT5. The default optimizations convert everything to DXT1.
    This archive includes a Inject_Textures_into_IGB_withMaps'n'MipMaps.ini, to use instead of Inject_Textures_into_IGB.ini.
    After step 5, add the name of all normal maps, including extension, to the excl.txt (e.g. 0701_n.tga), each on a new line.
    Make sure all files (including skin, textures, both files from this archive) are in the same folder.
    Load the Inject_Textures_into_IGB_withMaps'n'MipMaps.ini optimization of this archive (in place of step 7). Follow the rest of the process as usual.
    This will generate mip-maps. Delete the optimization from the list, if they are not required.
    Video Tutorial

7) Question: Can I preview the new textures, without having to go into the game?
    Depends on the skins. Many skins have a structure that prevents us to preview them in Insight Viewer.
    If the custom skin can be previewed with Alchemy Insight Viewer, you can see the updated texture as soon as the TGA is replaced.
    Just open the saved, smaller IGB with insight.exe.