Recolouring an armour for Dragon Age 2

From Nexus Mods Wiki
Revision as of 21:22, 20 November 2018 by Zaldiir (talk | contribs) (Updated the pyGGF link to point to Nexus Mods instead of the dead Bioware forums.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

This tutorial shows how to recolour an armour or outfit for Dragon Age 2.

Required tools

Recolour an armour

Armour file structure in Dragon Age 2

Armours and outfits are defined in several files in Dragon Age 2. The more relevant ones are:

  • item_variations.gda: all equippable items in Dragon Age (armours, outfits, weapons, accesories) have an entry in this file. In this entry there are defined the unique code that identifies the item, its name, the path where the mesh and texture files for this item are stored, the type of item, the icons shown for the item, etc.
  • mesh files: Meshes in Dragon Age 2 are defined in four different type of files:
    • *.mmh: defines the path and name of the other 3 file types of the mesh and has global data of the mesh.
    • *.msh: contains the vertex data of the mesh
    • *.phy: contains the weight data of the mesh (rigging)
    • *.mao: defines the material properties of the mesh and defines the path and name of the texture files.
  • texture files: armour meshes use four different texture files:
    • *_0d.dds: diffuse map. It defines the colour of the different parts of armour.
    • *_0n.dds: normal map. It defines the volume (i.e. the relative heights) of the different parts of the armour.
    • *_0s.dds: specular map. It defines how the different part of the armour reflect light and what light colour they reflect.
    • *_0t.dds: tint map. It defines what parts of the armour can be tinted and how they react to tints.

Finding out the texture files to modify

Selecting a .gda file from the 2da.rim
item_variations.gda
Noble outfit A

This tutorial explains how to recolour an existing armour, so the first step is to find out which are the texture files that are applied to the armour we want to recolour. As Dragon Age 2 doesn't have a toolset, in most cases we have to examine several files until we get the texture files we want to work on. See Extracting files from erf and rim files for Dragon Age 2 for more information on how to extract the game files.

Examine the item_variations.gda file

  1. Launch the editor.exe of the pyGFF tool.
  2. Select the menu option File -> Open and select the 2da.rim file. A window will pop up like the one shown in picture Selecting a .gda file from the 2da.rim
  3. Go down until you see the item_variations.gda file, highlight it and press the OK button.
  4. Now examine the contents of item_variations.gda:
    1. Expand the G2DA_ROW_LIST by clinking on the + box at the left side and you'll see the row contents as shown in picture item_variations.gda
    2. Look at the Value column. Each row displays a number (the item code) and then a name (the item name). Browse down until you find the name of the armour you are looking for. In this tutorial we are going to recolour one of the noble outfits, Noble outfit A, so we browse down until we find it in row 234, as shown in picture Noble outfit A.
    3. Expand the row and look at its contents:
      1. GDA_COLUMN_6 indicates the path where the mesh and textures files are. In this case it is art\characters\playercharacter
      2. GDA_COLUMN_7 indicates the name of the mesh files. In this case it is cth_noba
    4. Take down this information and proceed to the next step.
      Note: It is possible that you don't know the exact name of the armour you want to recolour. For example, let's say that you want to recolour one of the noble outfits but you don't know if it is the Noble outfit A, B, C, D or E. It doesn't matter. By looking at the item_variations.gda you'll see that all noble outfits files are stored under the same folder and are named cth_nob+ a letter (cth_noba, cth_nobb, and so on). This information will help you to narrow the search in the next steps.

Examine the *.mmh file

Noble outfit A *.mmh file

Now that you know the name of the mesh files (or at least, have a short list of possible names), the next step is to examine the mmh file of the armour to find out the name of the corresponding mao file.

  1. Launch the editor.exe of the pyGFF tool.
  2. Extract the contents of the artfp.erf file to a temporary folder. (see Extracting files from erf and rim files for Dragon Age 2 for more information on how to extract the game files).
  3. Select the menu option File -> Open, go to the temporary folder where you've extracted all the mesh and textures files and go down to the folder that was indicated in the item_variations.gda. For the Noble outfit A the folder was art\characters\playercharacter.
    1. You'll see there several subfolders: children, dwarfmale, elfmale, ... one for each race and gender. In this tutorial we are going to recolour the human female Noble outfit A, so the mesh files we are looking for are in the \humanfemale\ subfolder.
  4. Inside this subfolder there are lots of files: all the *.mmh, *.msh and *.phy files corresponding to almost all the armours and clothes of the game for human female characters. Look for the mesh files with the name that was indicated in the item_variations.gda file, in our case cth_noba.mmh, cth_noba.msh and cth_noba.phy.
  5. For recolouring we are only interested in the cth_noba.mmh file. Open it with pyGFF tool and examine its contents.
    Note: In case you didn't know which noble outfit was the one you were looking for, you'll have to examine all the cth_nob files, i.e. cth_noba.mmh, cth_nobb.mmh, cth_nobc.mmh, cth_nobd.mmh and cth_nobe.mmh
    1. Expand the root node (0)
    2. Expand the first MMH_CHILDREN node (6999)
    3. Expand the next root node (0)
    4. Expand the next MMH_CHILDREN node (6999)
    5. Expand the last node (6)
    6. Look at the value of the MMH_MATERIAL_OBJECT node (600) as shown in picture Noble outfit A *.mmh file. This is the path and name of the *.mao file used by the mesh where the texture files are defined. For the Noble outfit A, the *.mao file is art\characters\playercharacter\humanfemale\cth_noba + .mao.
    Note: In case you didn't know which noble outfit was the one you were looking for, you'll see that the corresponding *.mao files follow the same naming convention, i.e. cth_noba.mao, cth_nobb.mao, cth_nobc.mao, cth_nobd.mao and cth_nobe.mao

Examine the *.mao file

Noble outfit A *.mao file
Noble outfit A texture files

Now let's examine the mao file for the armour.

  1. Launch the editor.exe of the pyGFF tool.
  2. Extract the contents of the globalmao-core.rim file to a temporary folder. (see Extracting files from erf and rim files for Dragon Age 2 for more information on how to extract the game files).
  3. Select the menu option File -> Open, go to the temporary folder where you've extracted all the mao files and go down to the folder that was indicated in the *.mmh file. For the human female Noble outfit A the folder was art\characters\playercharacter\humanfemale and then open the mao file that was indicated there, cth_noba.mao in our case. Open it and examine its contents.
    1. Expand the root node (0)
    2. Expand the last node (33020). You'll see that it has 5 different subnodes as shown in picture Noble outfit A *.mao file. Each subnode indicates one of the texture files used by the armour:
      1. mml_tDiffuse: indicates the diffuse map
      2. mml_tNormalMap: indicates the normal map
      3. mml_tSpecularMask: indicates the specular map
      4. mml_tTintMask: indicates the tint map
    3. Expand each node and take down the paths and names of the texture files indicated in the mao file, as shown in picture Noble outfit A texture files. For the Noble outfit A the texture files are stored in the folder art\characters\playercharacter\humanfemale\textures\ and the file names are hf_cth_noba_0d.dds for the diffuse map, hf_cth_noba_0n.dds for the normal map, hf_cth_noba_0s.dds for the specular map and hf_cth_noba_0t.dds for the tint map.
      Note: In case you didn't know which noble outfit was the one you were looking for, you'll see that the corresponding texture files indicated in their *.mao files are all stored in the same subfolder and follow the same naming convention, i.e. hf_cth_noba_0d.dds, hf_cth_nobb_0d.dds, hf_cth_nobc_0d.dds, and so on

Modify the texture files

Noble outfit A diffuse map
Selecting an area to recolour
Desaturating the selected area
Setting blend mode for the new layer
Recolour of the selected area
Recoloured diffuse map
Parameters for saving the DDS file

At last we know what texture files we want to modify and the real recolouring work can begin. For a simple recolour we only need to modify the diffuse and specular maps and this is what we are going to do in this tutorial (if you are going to retexture the armour, then you'll have to edit the normal map, too, and probably the tint map).

  1. Go to the temporary folder were you extracted the contents of the artfp.erf file and search for the texture files indicated in the *.mao file. For the female Noble outfit A go to the art\characters\playercharacter\humanfemale\textures\ subfolder and look for the hf_cth_noba_0d.dds and hf_cth_noba_0s.dds files.
    Note: If you have the high resolution texture patch you may want to use the texture files in that patch. Extract the contents of the highrescharacterartfp.erf into a temporary file and look for the textures there instead of the ones that were in the artfp.erf file.
  2. Open the diffuse map in GIMP as shown in picture Noble outfit A diffuse map.
    Note: If you didn't know which one of the noble outfits was the one you wanted to recolour, open the five diffuse maps in GIMP and look at each of them until you recongnise the one you want to modify.
  3. Select one of the selection tools from the Toolbox (in most cases the Free Select Tool is the most useful as you will want to select an area that hasn't a geometrical shape).
  4. Select the area you want to recolour. In picture Selecting an area to recolour you can see how we have selected the light pink area.
  5. In the layer stack, select the diffuse map you imported and select the menu option Colors -> Desaturate. Select the desaturation option you prefer and click OK. Now the selected area has lost its original colour and is painted in shades of grey as shown in picture Desaturating the selected area.
  6. Add a new transparent layer on top of the diffuse map:
    1. Select the menu option Layer -> New Layer
    2. Add a name for the new layer, select Transparency on the pop-up window and click OK
      Note: To see and work with the different layers that you have in your image:
      • Select the menu option Windows -> Dockable Dialogs -> Layers '
      • This will open a window with the layers stack for your image as the one shown in picture Layers stack'
        • To work on one of the layers, select the corresponding layer in the stak and then work in GIMP main edition window: all you do (painting, erasing, resizing, etc) will be done on the selected layer.
        • To hide/show one of the layers, click on the eye icon at the left of each of the layers in the layer stack.
  7. Set the foreground colour to the colour you want to use (for this tutorial I've used a light blue, the d1def1 colour).
  8. Select the Bucket fill tool from the toolbox and fill the selected area on the new transparent layer with the colour you've selected.
  9. In the layer stack select the layer that contains the colour and change the Layer mode to Color and set the Opacity to 50 as shown in picture Setting blend mode for the new layer (you can try other layer modes and opacities until you find the values that you prefer).
  10. Now you'll see that the area we've selected previously and that had a light pink colour has changed into a light blue colour as shown in picture Recolour of the selected area.
  11. Repeat the steps 4 to 10 (selecting an area, desaturating the diffuse map for that area, adding a new transparent layer, filling the new layer with another colour and setting its blending mode) as many times as it is required. I strongly recommend that:
    1. you work with different layers for the different parts of the armour you want to recolour. This way you can set the layer blending modes differently for each part of the armour.
    2. you don't merge the layers to the base image until the end and save a backup copy containing all the layers. This way you can always change one layer colour, blend mode or opacity easily if when texted in game you don't like the results, without affecting the rest of the work you've done.
  12. Once you've recoloured all the parts of the armour you wanted to recolour merge down all the layers into the base image.
    IMPORTANT: Save a backup copy of the image and all the layers you've created to recolour the diffuse map before merging them down.
    1. Select the layer that is just on top of the base image in the layer stack and select the menu option Layer -> Merge down.
    2. Repeat the merging down process for all layers, merging always the layer that is on top of the base image, until you have only one layer as shown in picture Recoloured diffuse map,
  13. Save the image as a dds file (that is the type of file the game recognises):
    1. Select the menu option File -> Save As
    2. Save the diffuse map in the same folder and with the same name the original diffuse map had (we are recolouring an existing armour and want to replace the existing colour with the new one). For the female Noble outfit A that means that we have to save the file to the art\characters\playercharacter\humanfemale\textures\ folder and with the name hf_cth_noba_0d.dds
    3. A window will pop up asking for the parameters for saving the dds file. Check the Generate mipmaps flag and select the BC3/DXT5 compression as shown in picture Parameters for saving the DDS file.

Now we are going to recolour the specular map, too, to get the armour to reflect light with the new colours we have given it.

  1. Open in GIMP the specular map of the armour. For the Noble outfit A it is the hf_cth_noba_0s.dds file.
  2. Open also in GIMP the backup copy of the file you've used for recolouring the diffuse map, with all the coloured layers.
  3. Copy the specular map into the backup copy as a new layer:
    1. Go to the specular map image and select the menu option Edit -> Copy.
    2. Then go to the backup copy and select the menu option Edit -> Paste as -> New Layer.
    3. On the layer stack you will see now the original specular map you've added as a new layer. Move it to the bottom of the layer stack by pressing the green down arrow.
    4. Delete the layer that contains the diffuse map base image (select that layer and click on the dustbin icon in the layer stack window)
  4. Now you will have an image that will have the specular map as the base image (the bottom layer) and all the colouring layers on top of it.
  5. Change all the blending modes of the colour layers to Color.
  6. Merge down all the colour layer to the specular image as you did before to merge them down to the diffuse map image:
    1. Select the layer that is just on top of the specular map image in the layer stack and select the menu option Layer -> Merge down.
    2. Repeat the merging down process for all layers, merging always the layer that is on top of the specular map image.
  7. Save the image as a dds file (that is the type of file the game recognises):
    1. Select the menu option File -> Save As
    2. Save the specular map in the same folder and with the same name the original specular map had (we are recolouring an existing armour and want to replace the existing colour with the new one). For the female Noble outfit A that means that we have to save the file to the art\characters\playercharacter\humanfemale\textures\ folder and with the name hf_cth_noba_0s.dds
    3. A window will pop up asking for the parameters for saving the dds file. Check the Generate mipmaps flag and select the BC3/DXT5 compression as shown in picture Parameters for saving the DDS file.

Create an erf file

For Dragon Age 2 to recognise new texture files you need to pack them into erf files.

  1. Create a new folder with the name of your mod (for example: Noble_outfit_A_blue_recolour)
  2. Create under this folder all the required subfolder structure (for example, for the textures of the human female Noble outfit A, create the subfolder structure art\characters\playercharacter\humanfemale\textures\
  3. Copy the new texture files you've just created in that subfolder (in this tutorial that would be the hf_cth_noba_0d.dds and hf_cth_noba_0s.dds files).
  4. Create and erf file by dragging and dropping the new folder (the Noble_outfit_A_blue_recolour in this tutorial) to the erfpack-rev21.zip (see Creating and erf file for Dragon Age 2 for more information).
  5. This will create an erf file with the name of the new folder you've created (Noble_outfit_A_blue_recolour.erf in this tutorial).
  6. Copy this erf file to your override folder \My documents\Bioware\Dragon Age 2\packages\core\override\, and see how the new recoloured armour looks in game! :)

Fixing the tint map

Setting a black tint map

It is possible that when you try the new recolour in game the colours look dim and without life (it also happens to lots of clothes in vanilla game). This is due to the tint map. The easiest way of fixing it is by setting the tint map for your armour as a black image. To do that you have to edit the *.mao file as shown in picture Setting a black tint map.

  1. Launch the editor.exe of the pyGFF tool.
  2. Select the menu option File -> Open, go to the temporary folder where you've extracted all the mao files and go down to the folder that was indicated in the *.mmh file. For the human female Noble outfit A the folder was art\characters\playercharacter\humanfemale and then open the mao file that was indicated there, cth_noba.mao in our case. Open it and examine its contents.
    1. Expand the root node (0)
    2. Expand the last node (33020). You'll see that it has 5 different subnodes as shown in picture Noble outfit A *.mao file. Each subnode indicates one of the texture files used by the armour:
      1. mml_tDiffuse: indicates the diffuse map
      2. mml_tNormalMap: indicates the normal map
      3. mml_tSpecularMask: indicates the specular map
      4. mml_tTintMask: indicates the tint map
    3. Expand the mml_tTintMask node and select the 33011 subnode, where the path and filename of the tint map dds file is stored
    4. Replace the contents of the node with default_black.dds
    5. Click on the Save button under the text box
    6. Save the modified *.mao file in the art\characters\playercharacter\humanfemale\ subfolder of your mod
    7. Create the erf file again, this time including the new *.mao file and test the results in game.

 

Related Pages