Difference between revisions of "Creating an armour for Skyrim. Part 2"

From Nexus Mods Wiki
Jump to: navigation, search
(Add the armour to the game using the CK)
(Added shader flags for working transparency)
Line 148: Line 148:
  
 
===== Add transparency =====
 
===== Add transparency =====
 +
[[File:AlphaTut.jpg|right|thumb|Shader flags for working transparency]]
 +
 
You may need to have a part of the mesh transparent or semitransparent. To do that:  
 
You may need to have a part of the mesh transparent or semitransparent. To do that:  
 
# Select the ''NiTriShape'' node that contains your mesh and right click on it
 
# Select the ''NiTriShape'' node that contains your mesh and right click on it
Line 157: Line 159:
 
## Expand the ''Properties'' and in the second row value change the ''None'' to the number of the node you've added (29 in the example). Now the ''NiAlphaProperty'' node has moved and is shown under the ''NiTriShape'' node as shown in picture ''Adding transparency''.
 
## Expand the ''Properties'' and in the second row value change the ''None'' to the number of the node you've added (29 in the example). Now the ''NiAlphaProperty'' node has moved and is shown under the ''NiTriShape'' node as shown in picture ''Adding transparency''.
  
Select the NiAlphaProperty node you've just add and in Block Details look for the Flags parameter and set it to a the value that makes the armour look better in game. Some values that work:
+
Select the NiAlphaProperty node you've just add and in Block Details look for the Flags parameter and set it to a the value that makes the armour look better in game. The values that work:
* Flags = 4844, Threshold = 127: this works for ENB series but in some lighting conditions produces some artifacts.
+
* Flags = 4845, Threshold = 0
* Flags = 4845, Threshold = 0: this seems to work fine in most cases.  
+
* Add also the ShaderFlag ''SLSF2_Assume_Shadowmask'' to the ''Shader Flags 2'' as shown in picture ''Shader flags for working transparency''. This way the meshes with transparency won't loose their colour (won't turn black) when close to a lightins source.
  
 
Once you've modified all these parameters, save the nif file of your armour.
 
Once you've modified all these parameters, save the nif file of your armour.

Revision as of 18:41, 25 March 2012

Overview

This is the part 2 of the tutorial for creating an armour or outfit for Skyrim. You can find the first part of the tutorial here Creating an armour for Skyrim. Part 1

Creating an armour for Skyrim

Create the _0.nif armour mesh

Cut parts of the body hidden by the armour

Cutting the hidden body parts

Once you've copied all the weights from the body to your armour and set the dismemberment vertext groups select the body in Object mode and go to Edit mode. In Edit mode select all the faces of the body that are completely hidden by the armour or outfit you are creating. Make sure that all the faces you are selecting are completely inside the armour because if you delete a face that is only partially hidden by the armour you'll see a hole in your character's body when using the armour.

This step is optional but it is worth doing it because:

  • you won't have to solve clipping problems because in almost no pose the body will go through the armour
  • the size of the mesh will be smaller, increasing performance
  • Bethesda does it ;)

Export the armour

Importing a new skeleton
Exporting the armour

Now you are ready to export your armour in nif format, that is the one Skyrim's meshes use.

First thing is to import a new skeleton for your armour:

  1. Make sure that on the Blender screen you see all the objects that form the armour, including the parts of the body that are not hidden by the armour, and that you don't see anything that is not going to form part of your armour (like the light or the camera. If you see those objects move them to another Blender layer and set that layer to invisible or Blender will export those objects toghether with your armour).
  2. Make sure that you have deleted all the skeletons you imported with the parts of the body, as explained at the beginning of this tutorial.
  3. In Object mode select one of the objects that form part of your armour and press the A key twice so as to select all objects of the armour.
  4. Select the menu option File -> Import -> NetImmerse/Gamebyro and select the _0.nif file of the body you imported before for creating the armour (for example the modified femabody_0.nif).
  5. In the screen that contains the importing parameters select the option Import Skeleton Only + Parent Selected as shown in picture Importing a new skeleton and press the OK button.

Now you have a skeleton in Blender and it is the parent of all the objects that form your armour.

To export the armour:

  1. In Object mode select the skeleton you've just imported and press A twice to select all parts of the armour and the skeleton.
  2. Press the Ctrl + A keys and select the option Scale and Rotation to ObData from the pop up menu.
  3. Keeping the skeleton and all the parts of your armour selected, select the menu option File -> Export -> NetImmerse/Gamebyro, enter the name of the nif file for your armour (for example MyArmour_0.nif) and the folder where you want to save it.
  4. Set the exporting parameters as shown in the picture Exporting the armour. It is important that the parameters are set like this:
    1. Fallout 3 -> selected
    2. Stripify geometries -> deselected
    3. Smoothen Inter-Object Seams -> selected
    4. Flatten Skin -> deselected
    5. Export Skin Partition -> selected
  5. Press the OK button and wait until Blender finishes saving the nif file.

Adjust the armour in Nifskope

Adjust the armour properties
Editting the NiHeader in NifSkope
Getting rid of the Scene Root node
Getting rid of the Scene Root node 2
Deleting unwanted nodes
Setting the properties of the body data
Adjusting the dismemberment data

As the modelling tools are not yet fully adapted to Skyrim, we need to do several adjustments in NifSkope before we can test the armour mesh in game. I am explaining the steps in the order I find it makes things faster and easier (after having done this more than 10 times for only one mesh, I think I've finally found the fastest way! :) )

  1. Load the mesh you've just created into NifSkope (for example MyArmour_0.nif)
  2. First of all, edit the NiHeader to make it compatible with Skyrim (this is the reverse step of what you did for being able to import Skyrim meshes into Blender):
    1. In the Block detais section, expand the NiHeader property as shown in picture Editting the NiHeader in NifSkope
    2. You'll see that the User version property has a value of 11. Double click on the 11 and then change it to 12.
    3. Then go to the User version 2 property, that has a value of 34. Double click on the 34 and then change it to 83.
  3. Next thing is to get rid of the Scene Root node that Blender has exported with the armour:
    1. Expand the Scene Root node as shown in picture Getting rid of the Scene Root node.
    2. Browse down the Block details section until you see the Children property.
    3. Expand the Children property. You'll see it contains the node of the armour (in the picture, the 1-bbe2femalebody_0 node). Double clik on the number of this node and delete it, so the Children property points to None.
    4. Now you'll see something like what is shown in picture Getting rid of the Scene Root node 2: the bbe2femalebody_0 is not under the Scene Root node anymore.
    5. Select the Scene Root node and press Ctrl + Del or right click and select Block -> Remove Branch.
  4. Save the nif file.

Now you are ready for the second batch of adjustments:

  1. Load the nif file again in NifSkope.
  2. You'll see that some new nodes appear just below the armour node (bbe2femalebody_0 in the example) as shown in picture Deleting unwanted nodes. These nodes correspond to properties that are not compatible with the nif version used by Skyrim, so you have to delete them.
    1. Select the first one (BSShaderPPLightingProperty in the picture) and press Ctrl + Del or right click and select Block -> Remove Branch.
    2. Do the same with all the other nodes (NiSpecularProperty, NiMaterialProperty, etc) until you only see the armour node (bbe2femalebody_0 in the example).
    3. Save the nif file (this is not strictly required but is a good practive to save often just in case).
  3. Expand the root Ninode (bbe2femalebody_0 in the example) as shown in picture Setting the properties of the body data.
  4. Expand the node that contains the body parts that are shown by the armour (the newBBE_1_noweight in the picture).
  5. Select the NiTriShapeData node of the body parts.
  6. Browse down in its Block details until you see the Num UV sets and the Has Normals properties:
    1. The Num UV sets will have a value of 4097. Double click on the 4097 and change its value to 1.
    2. The Has Normals property will have a value of yes. Double click on the yes and change it to no.
    Note: You only have to edit these properties for the body nodes. They are fine as they are for the armour/clothing nodes.
  7. Select the BSDismemberSkinInstance node of one of the NiTriShape nodes of your armour as shown in picture Adjusting the dismemberment data.
  8. In the Block details section expand the Partitions property.
  9. Expand the second Partitions property.
    1. Make sure that the Part Flag property has bloth flags selected: PF_EDITOR_VISIBLE and PF_START_NET_BONESET. If not, double click and select both flags from the drop down list.
    2. The Body Part property will contain one or more of the body parts ypu've created in Blender (BP_TORSO, BP_LEFTLEG or BP_RIGHTARM). Double click on these values and change them to:
    3. From BP_TORSO to 32
    4. From BP_RIGHTARM to 34
    5. From BP_LEFTLEG to 37
  10. Repeat this steps for all the BSDismemberSkinInstance nodes of all the NiTriShape nodes of your armour.
  11. Save the nif file.
Add materials and textures
Adding a BSLightingShaderProperty node
Moving the BSLightingShaderProperty node to its right position
Moving the BSShaderTextureSet node to its right position
BSLightingShaderProperty settings for the body
BSLightingShaderProperty settings for the armour
BSShaderTextureSet block details
Texture files for the body
Texture files for the armour
Adding transparency

The next step consists in adding materials and textures to all the NiTriShape nodes that form your amour. To do that:

  1. Load the nif in NifSkope
  2. Select one of the NiTriShapes, for example the newBBE_1_noweight in the example nif)
  3. Right click and select Block -> Insert from the menu
  4. A new menu will pop-up. Select Bethesda -> BSLightingShaderProperty. This will add a new node at the end of your nif file.
  5. Select the NiTriShape node but it is not under the NiTriShape node, as shown in picture Adding a BSLightingProperty node. To correct this:
    1. Note down the number of the new node you've just added (2 in the example picture)
    2. Select the NiTriShape node again and browse down in the Block Details until you see the Properties property as shown in picture Moving the BSLightingShaderProperty node to its right position.
    3. Expand the Properties and in the first value change the None to the number of the node you've added (2 in the example). Now the BSLightingShaderProperty node has moved and is shown under the NiTriShape node.
  6. Select the BSLightingShaderProperty node, right click and select Block -> Insert.
  7. A new menu will pop-up. Select Bethesda -> BSShaderTextureSet. This will add a new node at the end of your nif file. To correct this:
    1. Note down the number of the new node you've just added (3, for example)
    2. Select the BSLightingShaderProperty
    3. Browse down the Block details sections until you see the Texture Set property and change its None value to the number of the BSShaderTextureSet node (3, in the example). This will move the new node under the BSLightingShaderProperty node.
  8. Repeat these steps for all the NiTriShapes that form your armour, adding to them a BSLightingShaderProperty and a BSShaderTextureSet nodes.

The next step consists in setting the right properties for the BSLightingShaderProperty nodes you've just added.

  1. Select the BSLightingShaderProperty node you are going to edit.
  2. Set its properties in the block details:
    1. Picture BSLightingShaderProperty settings for the body shows the settings for all the properties that are used for the body nodes (the parts of the armour where the body is shown).
    2. Picture BSLightingShaderProperty settings for the armour shows the settings I've used for all the properties that are used for the armour nodes.
  3. Repeat this for all the BSLightingShaderProperty nodes of all the NiTriShape nodes that form your armour.

The last step is to add the textures to your armour:

  1. Expand the BSLightingShaderProperty node.
  2. Select the BSShaderTextureSet.
  3. In the Block detils section you'll see that the Num Textures properties is set to 6 as shown in picture BSShaderTextureSet block details. Skyrim uses 9 textures so you will have to fix that:
    1. Double click on the 6 and change it to 9.
    2. Right click on the purple flower of the Textures property and select Array -> Update. Now you will have 9 lines to add textures.
  4. Expand the Textures properties and associate the texture files you created previously in GIMP:
    1. Picture Texture files for the body shows the texture files associated to the body (the parts of the armour that show the skin).
    2. Picture Texture files for the armour shows the texture files associated to the armour.
    3. Repeat this for all the BSShaderTextureSet nodes.
  5. Save the nif file.

It is important that each texture type goes to the right place. The top one has to be the diffuse map (the colour), the second one the normal map.

Check that the texture files begin like this: textures\... as shown in the Texture files for the armour image. If the links to the files begin like C:\Program files\Steam\SteamApps\Common\Skyrim\Data\textures\..., or \textures\... the game may not be able to upload them and you'll see the armour black, purple or invisible.

Apply the textures on both sides of the mesh

Some armour or outfit meshes are made by flat surfaces, and then, if the textures are only applied to the top of the surface, the cloth will be invisible in game when viewed from some angles (for example, the inner part of some skirts will be invisible).

You can tell the mesh to apply the texture on both sides to fix this problem. To do this:

  1. Select the BSLightingShaderProperty of the NiTriShape where you want to apply the texture to both sides.
  2. In the Block details section look for the Shader Flags 2 property.
  3. Select the SF_Double_Sided flag as shown in picture BSLightingShaderProperty settings for the armour.
Add transparency
Shader flags for working transparency

You may need to have a part of the mesh transparent or semitransparent. To do that:

  1. Select the NiTriShape node that contains your mesh and right click on it
  2. Select Block -> Insert from the pop up menu
  3. Select NiA... from the drop down list and then select NiAlphaProperty.
  4. The new node will be added at the end of the nif file. To place it in its right possition:
    1. Note down the number of the new node you've just added (29, for example)
    2. Select the NiTriShape node again and browse down in the Block Details until you see the Properties property as shown in picture Moving the BSLightingShaderProperty node to its right position.
    3. Expand the Properties and in the second row value change the None to the number of the node you've added (29 in the example). Now the NiAlphaProperty node has moved and is shown under the NiTriShape node as shown in picture Adding transparency.

Select the NiAlphaProperty node you've just add and in Block Details look for the Flags parameter and set it to a the value that makes the armour look better in game. The values that work:

  • Flags = 4845, Threshold = 0
  • Add also the ShaderFlag SLSF2_Assume_Shadowmask to the Shader Flags 2 as shown in picture Shader flags for working transparency. This way the meshes with transparency won't loose their colour (won't turn black) when close to a lightins source.

Once you've modified all these parameters, save the nif file of your armour.

Add the armour to the game

Add the armour as a replacer of an existing armour

You can add the armour as a replacer of an existing one. For doing that you have to name your mesh like the one in game that you want to replace, and place it under the same folder where the vanilla mesh is. You can use SripterRon's FO3 Archive Utility to look at the name of the nif files and folders used in game. For example, for making a replacer of the wedding dress:

  • place the nif file in the folder Data\meshes\clothes\weddingdress\
  • rename your nif file to outfit_0.nif
  • make a copy of your nif file and rename it to outfit_1.nif.

We are going to test first the _0.nif armour mesh. When it works perfectly in game, we will create the mesh for the _1 body. As the _0.nif and _1.nif files of the armour are exactly the same, you will see no changes when you move the weight slider for your character.

Add the armour to the game using the CK
Armour Addon properties
Armour properties

To add the armour to the game as a new item you have to use the CK. The steps to follow are:

  • First create a new armour addon. To do it the easiest thing is to look for an existing armour addon in game, double click on it to open the screen showing its properties and change the ID of the armour addon (the first box at the top left of the screen as shown in picture Armour Addon properties). Click on the OK button and CK will ask you if you want to create a new object. Answer yes.
    Note: the CK has a bad habit of showing lots of warning messages. When the first one appears click on the Cancel button and you won't see more of these warnings.
  • Open again the sceen showing the properties of the armour addon you've just created with your own ID and name and modify the values you want.

Some useful parameters are (see picture Armour Addon properties):

  • In the Male area you have to indicate what meshes will be used by the male characters equipping the armour and in the Female area what meshes will be used by the female characters equipping the armour.
    • Biped Model: the nif file containing the mesh of your armour when seen in 3rd person mode, or when looking at an NPC wearing the armour. Indicate here the _1.nif mesh of your armour. The game will use the _0.nif model when needed, even though you don't have a place to link it to the armour addon.
    • First person: the nif file containing the mesh of your armour when seen in 1st person mode. Indicate here the _1.nif mesh of your armour. The game will use the _0.nif model when needed, even though you don't have a place to link it to the armour addon.
  • Biped Object: the selected objects in this list are the dismemberment parts that form your armour. For armour covering the body you usually will select 32-Body, 34-Forearms and 38-Calves. For boots, you will select 37-Feet. Note that the number before the name is the same number you wrote in the Skin partition nodes of the nif file.
  • Once you've created the armour addon, create a new armour. Again, the easiest thing is to look for an existing armour in game, double click on it to open the screen showing its properties and change the ID and name of the armour (the first two boxes at the top left of the screen as shown in picture Armour properties). Click on the OK button and CK will ask you if you want to create a new object. Answer yes.
  • Open again the sceen showing the properties of the armour you've just created with your own ID and name and modify the values you want.

Some useful parameters are (see picture Armour properties):

  • Flag Playable: select it to indicate that your character can use the armour.
  • Biped Object: the slot used by your armour when equipped.
  • In the Male area you have to indicate what meshes will be used in the inventory if your character is male and in the Female area whatwill be used if your character is female.
    • World model: the nif file containing the mesh that you have created and that will be shown when you throw the armour to the ground (you can leave the world model the original armour had).
  • Models: the list of Armor Addons that will be equipped at the same time by your character when equipping the armour.
  • Keywords: the groups the armour belongs to. They can indicate if it is a piece of clothing (in the example, ArmorClothing), what kind of vendor will buy/seel it (in the example, VendorItemClothing), the quality of the armour (in the example, ClothingRich), etc.


To place the armour in the world:

  • select the cell where you want to place the armour in the Cell View section and double click on it to open the Render window.
  • drag the armour object you've created to the Render window and drop it.
  • save the esp file with your armour, activate it and test your armour in game :)

Adjust the armour after testing it in game

Clipping

Test your armour in game. Test it with your character in several poses: standing up, holding a weapon, walking, running, etc.

Most likely in some poses you will see parts of the body clipping throught the armour, as shown in picture Clipping.

If this only happens in some unusual poses, like some added by mods, you can leave your armour as it is. But if this happens in usual poses in game you'll have to work a little more on your armour to eliminate this clipping effect.

Load your armour into Blender again and in the areas where the body clips through the armour try some of the following methods:

  • move the vertices out, separating them from the body. After doing this take a look at your armour's shape in those areas and, if it has deformed too much, move the surrounding vertices to fix the shape.
  • cut the parts of the body that are under the armour in those areas, if it is possible to cut them without leaving holes in parts that are not covered by the armour.
  • if you cannot fix the clipping issues with any of the two previous methods you will probably have to slightly modify the weights of those areas. Try different weights until you find out what works better.

Repeat the testing and fixing process until the armour works fine in game and you'll be done with the _0.nif.

Create the _1.nif armour mesh

Once the _0.nif works fine in game, you are ready for creating the _1.nif file of your armour. You don't have to create the _1 version from scratch (actually, if you did, the game won't probably like it). What you have to do is to adapt the working _0.nif armour mesh to the _1.nif body.

  1. Open Blender and load the last _0 mesh of your armour.
  2. Delete all the parts of the body that came with the _0 mesh and leve only the armour objects in Blender.

Import into Blender all parts of the _1.nif body

Then import into Blender all the parts of the _1.nif body:

If you are going to create the armour for a male, you'll have to import the following body parts:

  • malebody_0.nif: In Skyrim this nif file contains the torso, arms and legs.
  • malehands_0.nif: If you want to create gloves for your armour, import this mesh that contains the hands.
  • malefeet_0.nif: If you want to create gloves for your armour, import this mesh that contains the hands.

If you are going to create the armour for a female, you'll have to import the following body parts:

  • femalebody_0.nif: In Skyrim this nif file contains the torso, arms and legs.
  • femalehands_0.nif: If you want to create gloves for your armour, import this mesh that contains the hands.
  • femalefeet_0.nif: If you want to create gloves for your armour, import this mesh that contains the hands.

Delete all the the skeletons you've imported with the _1.nif body parts.

Adjust the _0.nif armour shape

You'll see that the armour you created for the _0 body doesn't fit very well the _1 body you've just imported. So you need to adapt the existing armour to the bigger body. You don't have to create new UV maps, only adjust the shape of the armour.

Things you can do:

  • You can move vertices of the armour from one position to another.
  • You can use the Shrink/Wrap or Scale funcionalities.
  • You can repaint the weights of some vertices but only if you do it by [Creating_an_armour_for_Skyrim._Part_1#Paint_the_weights_by_hand Painting weights by hand]. You cannot use any script to copy weights to the _1.nif.
  • You can hide vertices temporarily when working with the mesh.

Things you cannot do:

  • You cannot add new vertices (nor by hand nor by using funcionalities or modifiers that add new vertices like Subdivide or Subsurf)
  • You cannot delete or merge existing vertices.
  • You cannot use any script for copying weights to the _1 armour.
  • You cannot split the armour into two objects and after you've done join them again.

If you have deleted some of the vertices of the body for the _0.nif armour, you have to delete the same vertices of the body in the _1.nif armour.

The number of vertices of both meshes _0 and _1 have to be the same because Skyrim merges both meshes when showing them on characters with intermediate weights. If one vertex is in one of the meshes and not in the other one, Skyrim will not know what to do with it and you'll see strange things happening in game. Also, both meshes need to have the vertices in the same order. If you do things like split the armour and then join the parts again, or use a script for recreating the weights, the vertices will be probably reordered and you'll see again strange effects in game.

Once you've done adjusting the shape of the armour to the _1 body:

  • Import the skeleton of the _1.nif file of the body you are using.
  • Export the _1.nif for your armour repeating all the same steps that you did for exporting the _0.nif of your armour.
  • Load the _1.nif armour in NifSkope and repeat all the steps you did for the _0.nif armour for adjusting the settings and adding materials and textures.

Add the armour to the game

Place the _1.nif file you've just created in the same folder where you have the _0.nif and name it accordingly.For example, for making a replacer of the wedding dress:

  • place the nif file in the folder Data\meshes\clothes\weddingdress\
  • rename it to outfit_1.nif.

Now you can test the _1.nif armour file in game and how it works toghether with the _0.nif file you created before.

Adjust the armour after testing it in game

Test your armour in game. Things you should test now:

  • Test the clipping for the _1.nif mesh: move the weight slider of your character completely to the left and test the armour in several poses: standing up, holding a weapon, walking, running, etc. If there is clipping fix it the same way you did for the _0.nif armour mesh.
  • Test how the _0 and _1 meshes work toghether: moev the weight slider of your character and check that in all positions the armour looks fine. If strange things happen in intermediate weights, don't despair: the best thing you can do is repeat the process of creating the _1.nif file from the beginning, to assure that the number and order of the vertices in both nif files are exactly the same.

Repeat the testing and fixing process until the armour works fine in game with all weights and you'll be done :)

References