Porting hairs to Fallout
- 1 Overview
- 2 Required tools
- 3 Porting a hair to Fallout
This tutorial shows all the main steps you need to follow to port a hair from another game to Fallout 3.
If you create a hair from scratch, apart from the steps explained here you will have to create the hair mesh, its UV map and its textures.
- Note: If you are porting the hair to distribute it you must ask permission first to the original author of the hair, and always credit him for his work
Porting a hair to Fallout
The main steps to follow when porting hairs to Fallout are:
- Importing into Blender the Fallout head mesh and the hair mesh
- Modify the hair mesh to fit Fallout head mesh
- Export the hair mesh
- Modify the hair textures
- Adjust the hair mesh in NifSkope
- Create an egm file
- Add the hair to the game using the GECK
Importing into Blender the Fallout head mesh and the hair mesh
First step is to import the head mesh you want to work with. In Fallout there are several head meshes depending on the age and gender of the charaters (there is even a different head mesh for ghouls). Head meshes are usually located in the \Data\Meshes\characters\head\ folder.
The head meshes of player characters are:
- headhuman.nif: head mesh for male characters
- headfemale.nif: head mesh for female characters
Import the head mesh you want to adapt the hair for using the menu option File -> Import -> Netimmerse/Gamebyro (.nif)
- * The meshes and textures of the game are inside compressesd files with BSA format. To extract then you can use the "BSA Browser" utility that comes with Fallout Mod Manager.
- * If you cannot find that option it is because you haven't installed NifScripts. Follow the instructions given here: Installation of Blender to install everything you need.
Then import the hair mesh of the hair you want to port to Fallout using the same menu option (if it is a nif file) File -> Import -> Netimmerse/Gamebyro (.nif) or the option that corresponds to the format of the mesh you are importing.
Modify the hair mesh to fit Fallout head mesh
Once you have imported the hair, you'll probably see that it doesn't fit the head as in the example shown in picture Imported hair mesh. To fix this work in Edit mode. Select all vertices of the hair (press A once or twice to select them all) and move them and scale them as required until the hair fits the head mesh. Try to fix the hair mesh by selecting all vertices at the same time: this way you'll keep the shape of the original hair. Only if needed work with some of the vertices (to get them out of the head, for example), but be careful and try to keep these modifications to the minimum.
- Note: don't move or rotate the hair mesh in Object mode because you want your hair to have the same center than the Fallout hair in Object mode. Do all required modifications in Edit mode.
Export the hair mesh
To export the hair mesh:
- In Object mode select the hair mesh.
- Press the Ctrl + A keys and select the option Scale and Rotation to ObData from the pop up menu.
- Keeping the hair mesh selected, select the menu option File -> Export -> NetImmerse/Gamebyro, enter the name of the nif file for your hair (for example Hair.nif) and the folder where you want to save it.
- Set the exporting parameters as shown in the picture Exporting the hair mesh. It is important that the parameters are set like this:
- Fallout 3 -> selected
- Stripify geometries -> deselected
- Smoothen Inter-Object Seams -> deselected
- Flatten Skin -> deselected
- Export Skin Partition -> deselected
- Press the OK button and wait until Blender finishes saving the nif file.
Modify the hair textures
Hairs in Fallout use three different texture files:
- .dds file: diffuse map. This image file contains the painted hair and accesories (ribbons, hats, etc)
- _n.dds file: normal map. Fallout uses this file to give sense of volume to the hair and also influences how bright it will be seen in game.
- _hl.dds file: this image file tells Fallout waht parts of the hair mesh are colourable. Your hair requires this file to be colourable in game.
.dds image file
Usually Fallout hairs look better if you take off all the colour of this image file. To do this:
- Open the texture file of the hair you are porting to Fallout in GIMP
- If it contains something that doesn't have to be colourable in game (like a ribbon or a hat) select everything except that part
- Select the menu option Colors -> Desaturate and select any of the three options (Lightness, Luminosity or Average)
- Save the image file as dds as this is the image format that the game requires. As hair textuures usually use transparency, save it as DTX3 or DTX5. Make sure that the Generate mipmaps flag is marked when you save the texture.
_n.dds image file
This step is exactly the same than the one explained in the tutorial Creating a sword for Fallout because it doesn't matter the mesh you are working with: you will create the normal maps following the same steps.
You can create the normal map from the dds texture you've saved before, to do it this way just follow these steps:
- Select Colors -> Color to alpha and then select black or 000000 as the source colour.
- Select Filter -> Map -> Normalmap. A window will pop up like the one shown in the Normal map window picture.
- pressing 3d preview you will be able to see in another screen how the changes in the parameters give more or less deep to the normal map.
- select the Wrap flag and change the value of Height source to Alpha.
- select a filter (I usually select 3x3 but you can try different filters and see which one works better for you)
- modify the scale value to add more or less deep to the normal map (I usually set this to 3 or 4)
- Press the OK button and the image will show now a blueish look: this is the normal map. Save it with the same name than your texture file + the _n.dds extension and choose the DTX5 compression. Make sure that the Generate mipmaps flag is selected when saving it.
- Note: In Fallout light colours look very bright, and often they look too shiny. If you want to make your textures less shiny:
- make your textures a little darker: for example, don't paint white parts in white but in a light grey.
- make the normal map a little more transparent: if you are generating them from the textures, you can try the following:
- before generating the normal map, add a black layer to the texture and merge it with the texture using a % of opacity (like 50%, or 25%).
- merge down the black layer onto your original texture and then generate the normal map.
_hl.dds image file
This kind of image files are only used by hairs in Fallout. This image file controls waht part of the hair mesh is colourable. If part of your hair mesh doesn't have to be colourable (as a ribbon or a hat) you have to paint that part of the alpha channel of this image in black (opaque) as shown in picture _hl.dds file colour and alpha channels. White parts (transparent) of the alpha channel of this image file will be coulourable.
- Note: In GIMP, if you are looking at the Alpha channel on the Channels dialog window, colours are reversed, i. e. there you'll see opaque parts of the image painted in white and transparent parts in black.
In this example, the right bottom part of the image corresponds to a ribbon that doesn't have to change its colour in game when you change the coulour of your character's hair, and that is why that part of the alpha channel is completely black.
Save the image file with the same name than your texture file + the _hl.dds extension and choose the DTX3 or DTX5 compression. Make sure that the Generate mipmaps flag is selected when saving it.
Adjust the hair mesh in NifSkope
Each Fallout hair mesh is actually made of two meshes: a mesh that is equipped by your character when wearing a hat (the mesh in the NiTriShape called Hat) and a mesh that is equipped by your character when not (the mesh in the NiTriShape called NoHat), as shown in picture Hat and NoHat NiTriShapes. The NiTriShapes must be called Hat and NoHat for the game to choose the right one when your character equips a hat (hat, helmet, cowl, etc).
You can create a mesh for your character when wearing a hat by editting the hair you are porting in Blender, modifying the top and sides of the hair mesh until they are very close or even into the head (the part of the hair that is going to be covered by the hat) or use one of the existing vanilla hair meshes.
If you are using a vanilla Hat mesh:
- Open two NifSkope instances. In one of them load the nif file that contains the hair mesh you are porting to Fallout (Hair.nif in the example) and in the other one open the nif file of a vanilla hair mesh.
- In the vanilla hair mesh, delete the Hat NiTriShape. It is best that you save the existing hair from the game with a new name, like FalloutHair.nif, to prevent overwriting it. To delete it select the Hat NiTriShape node of the vanilla hair you are going to delete and right click. Then select Block -> Remove Branch from the pop up menu.
- Copy the shape of your hair in the nif file of the vanilla hair following this steps:
- In your hair file (Hair.nif in the example) select the NiTriShape node that contains your hair's shape and right click on it. Select the option Block -> Copy Branch from the pop up menu.
- Go to the vanilla hair mesh (FalloutHair.nif in the example) and select the top node (the NiNode that is called HairBaseF in the example picture, right click and select the option Block -> Paste Branch from the pop up menu.
- Select the NiTRiShape you've just copied and then, in the Block details part of the screen click on the txt little button (see picture Hat and NoHat NiTriShapes) to change the name of the NiTriShape. Select or type NoHat in the pop up window and click on OK. Now the name of the NiTriShape of the hair you've ported is NoHat.
- In the NiTriShapeData of the NiTriShape node you've copied you can change the value of TSpaceFlag from 240, that is the default value that Blender sets when exporting, to 16 that is the value that the vanilla meshes use in game. Once you've changed the value of this parameter go down a little and you'll see the parameters Binormals and Tangents. Right click on the green round arrows that are beside these two parameters and select Array -> Update. Then select the main node NiNode Sceene Root at the top and from the top menu select Spells -> Batch -> Update All Tangent Spaces and wait until NifSkope finishes the calculations.