Difference between revisions of "NifSkope Comprehensive Guide"

18,319 bytes added ,  01:33, 27 July 2007
Added: Sections 5.3, 5.4; Section 6 & 7; Updated Glossary; Minor updates to other sections; Added Wiki catagorys
imported>Chuey
(Added 5.5.2 NiTriShape, Added section 6.*)
imported>Chuey
(Added: Sections 5.3, 5.4; Section 6 & 7; Updated Glossary; Minor updates to other sections; Added Wiki catagorys)
[[Category:Tools]]
[[Category:Tools: Meshes and Textures]]
 
== Introduction ==
The purpose of this guide is to explain and walk you through the ins and outs of working in NifSkope. This guide should continue to be updated as new releases of the NifSkope tool is released. The guide should remain centered around the [http://en.wikipedia.org/wiki/The_Elder_Scrolls_IV:_Oblivion TES:Oblivion] [http://en.wikipedia.org/wiki/Modding modding] community by providing information and tutorials on creating mods for TES:Oblivion. Areas that need more information are noted throughout the guide so editing is encouraged if you have useful and correct information to add.
* Reopen your iron battleaxe model. [Data\meshes\weapons\iron\battleaxe.nif]
 
== Scene Root Node ==
= '''Blocks & Block Details Overview''' =
 
== '''Scene Root Node''' ==
All NIF files start with a Scene Root Node (0 NiNode). This is the location of X0,Y0,Z0 in 3D space. Everything in the game environment is positioned based on the location of it's associated Scene Root Node. You cannot move the Scene Root Node, but can move the associated model in relation to it. This enables you to position the model to a specific location in reference to other objects in the game environment.
 
::* A numerical value of gloss effect applied to the model. The higher the value the greater the gloss effect is applied. Most general objects in Oblivion possess a base value of 10.
: '''Alpha'''
::* Specifies the material's level of alpha/transparency in a numerical value. A value of 1 means the object is not transparent. A decrease in the value from 1 increases the object's alpha/transparency. This floating variable requires the node NiAlphaController and NiAlphaProperty to correctly render transparency in the game environment. It is used on objects such as ghost models and glass. SpecifyingWe Alphawill Channel/Transparencygo isinto anmore advanceddetail topicon outsideapplying theAlpha scopeChannel oflater thisin the guide.
 
=== '''Changing Colors in NiMaterialProperty''' ===
 
You now see three text boxes: Red, Green, and Blue specified by the first letter of each. The value 1 means that the associated color is at its minimum shade. The value of 0 means the associated color is at its maximum shade. Meaning, a primary color will become darker as the value approaches 0. For example, if you enter 0 for each of the primary colors you will end up with black. You can use variations of 0 - 1 in each of the primary colors to produce a specific hue and shade of your liking.
 
== ''' NiTexturingProperty ''' ==
This data block contains all the information pertaining to the model's different types of image maps. The texture map is what gives your model color and definition and the most common type of map. Maps can also create visual effects on your model like a glowing appearance or artificial 3D. This section we will go over the basic concepts behind the different variables.
 
: '''Num Extra Data List'''
::* The quantity of extra data strings assigned to this material property. To add extra data strings see section: Adding Extra Data Strings.
: '''Extra Data List'''
::* List of extra data strings added to the material property. UPB is an example of an extra data string. Extra data strings are not typically applied to texture property nodes.
: '''Controller'''
::* Specifies the block number for a NiTimeController. The time controller is used to specify the amount of time (and other variables) between sequences of textures defined within alpha property nodes. In the case of textures, it gives the perception of transparency like used on ghosts. We will go into more detail on applying Alpha Channel later in the guide.
: '''Apply Mode'''
::* Defines how the texture will be applied to the model. There are preset ways the game engine can render the texture applied to the model to give it different appearances. Each apply mode is customized for a particular purpose. See the Glossary for more information on the various apply modes.
: '''Texture Count'''
::* NifSkope: Number of textures. Always 7… No further information available on why this must be 7 or what this variable actually controls. Example, it's obviously telling the game engine that this object can have up to 7 textures: Base, Dark, Detail, Gloss, Glow, Bump Map, and Decal. But not all objects contain each of these and none contain all 7. ''Needs further explanation?''
 
=== ''' Texture Types ''' ===
The next seven variables will determine what types of texture maps have been created for this mesh. A value of yes means the game engine will search for that texture type. Later in the guide we will go into more detail on each of the different types of texture maps. The variables contained within each of these sections are the same so this guide will only explain them once.
 
: '''Source'''
::* Specifies the Block number containing the texture file path.
: '''Clamp Mode'''
::* Determines how the texture is applied onto the mesh. Don't confuse this with Apply Mode. Clamp Mode effects how the texture is wrapped around the mesh surface and will also affect the appearance of stretching on the pixels. Typically, you want to wrap a texture onto the mesh in both directions.
: '''Filter Mode'''
::* This sets the way the mipmaps will be rendered when looking at an object from a distance. Since there are only a set number of mipmaps (typically 9 in Oblivion) it is necessary for the game engine to blend two mipmaps together to produce the image at every possible distance. Tri-linear filtering is the most commonly used in Oblivion and should be your default.
: '''UV Set'''
::* NifSkope: The texture coordinate set in NiGeometryData that this texture slot will use. Nothing else is known about this variable. ''Needs further explanation''
: '''Has Texture Transform'''
::* NifSkope: Determines whether or not the texture's coordinates are transformed. Nothing else is known about this variable. ''Needs further explanation''
 
== ''' NiSourceTexture ''' ==
This data node contains the file path to the mesh's texture map. There several variables that need to be defined that pertain to the texture map. Some examples are the use of mipmaps and alpha channel. This section we will go over the basic concepts behind the different variables.
 
: '''Num Extra Data List'''
::* The quantity of extra data strings assigned to this material property. To add extra data strings see section: Adding Extra Data Strings.
: '''Extra Data List'''
::* List of extra data strings added to the material property. UPB is an example of an extra data string. Extra data strings are not typically applied to texture property nodes.
: '''Controller'''
::* Specifies the block number for a NiTimeController. The time controller is used to specify the amount of time (and other variables) between sequences of textures defined within alpha property nodes. In the case of textures, it gives the perception of transparency like used on ghosts. We will go into more detail on applying Alpha Channel later in the guide.
: ''' Use External '''
::* Defines whether the texture is applied to the outside or inside of the model. The internal/external of a mesh is determined by the direction of its normals. A value of 1 tells the game engine to render the texture map on the external surfaces.
: ''' File Name '''
::* The file path to the texture map.
: ''' Unknown Link '''
::* Appears to be asking for a link to an NiObject such as bhkCollisionObject. ''Needs further explanation''
: ''' Pixel Layout '''
::* Defines the way the image will be stored. For example: Grayscale, 8-Bit, 16-Bit. For use in Oblivion, this variable is always set to 6.
: ''' Use Mipmaps '''
::* Specifies if mipmaps are used. [http://en.wikipedia.org/wiki/Mipmap Mipmaps] are generally always included in Oblivion textures so this setting is typically: MIP_FMT_YES. Use MIP_FMT_NO to disable the use of mipmaps. We will go into more detail on mipmaps later in the guide.
: ''' Alpha Format '''
::* Used when a NiAlphaProperty node is preset in the Block List to define an Alpha Channel/Transparency. Otherwise this is set to either ALPHA_NONE or ALPHA_DEFULT. We will go into more detail on applying Alpha Channel later in the guide.
: ''' Unknown Byte/Byte 2 '''
::* Unknown variables. Recommend to set as 1. ''Needs further explanation''
 
= '''Importing Meshes and Textures''' =
You now have a basic understanding of what is contained in a NIF file from the Blocks to Block data. Now we will focus our attention on how to edit a NIF file. In this section we will learn how to perform the following:
* Import an existing mesh
* Import a new mesh
* Import an existing texture
* Import a new texture
* Import existing Material Properties
* Renaming a NIF file
* Saving a NIF File
* Saving a New Texture File
 
Open your battleaxe.nif file if you haven't done so already.
 
== '''Importing An Existing Mesh''' ==
One of the most fundamental tasks to modding any game is the ability to add new meshes. NifSkope makes this a very simple task.
 
* Expand: 0 NiNode BattleAxe
* Right-Click: 16 NiTriStrips BattleAxe:1
* Select: Mesh -> Remove Branch
 
<blockquote>'''NOTE:''' You might have noticed a selection in the editing menu for Remove. This option will remove only the currently selected node and not all the children below it. Remove Branch, however, will remove both the currently selected node and any children below it. </blockquote>
 
You have successfully deleted 16 NiTriStrips BattleAxe:1 and you will notice that the battleaxe's handle is missing from the model in the render window. Now lets import a new mesh to replace it.
 
* File menu -> New Window
* Toolbar -> Click: Load
* Open: Data\meshes\weapons\daedric\battleaxe.nif
* Expand: 0 NiNode BattleAxe
* Right-Click: 16 NiTriStrips BattleAxe:1
* Select: Block -> Copy Branch
 
<blockquote>'''NOTE:''' Same applies for copy as with remove. Copy Branch will not only copy the selected node but also all of the children below it.</blockquote>
 
* Now activate the NifSkope window with your handless iron battleaxe.
* Right-Click: 0 NiNode BattleAxe
* Select: Block -> Paste Branch
 
You've done it! The iron battleaxe has been modded to add the daedric handle. Now be very careful not to save this file over your existing iron battle axe or the change will be permanent. You can go ahead and close the other window with the daedric battleaxe, but leave this modded iron battleaxe open as we'll be using it in the next few sections.
 
== '''Importing A New Mesh''' ==
You now know how to import existing meshes from other NIF files. This section is an example of how to import an entirely new mesh like those created using [http://www.blender.org/ Blender].
 
If you already have Blender and have created a mesh, you are welcome to use it in place of the one provided.
 
* Click here and download the new mesh NIF file I've created for you.
* Save the NIF file to your desktop.
 
If you don't have the modded battleaxe.nif file from the previous section open go ahead and open it now.
 
* File menu -> New Window
* Toolbar -> Load
* Open: Desktop\newmesh.nif
 
Now you are in the mesh file I created for you. One thing to point out is that Blender can only export NIF files to the 20.0.0.4 version. Oblivion, however, uses the 20.0.0.5 version of NIF files. The process explained in the next few steps is referred to as the Blender workaround or sometimes even the NifSkope dance.
 
Now activate your modded iron battleaxe NifSkope window. What we will do now is import the older 20.0.0.4 NiTriShape into our newer 20.0.0.5 NifSkope window. This will enable the Oblivion game engine to use the new mesh. First we need to remove the old battleaxe blades from our modded iron battleaxe. Activate that window now.
 
* Right-Click: 10 NiTriStrips BattleAxe:0
* Select: Block -> Remove Branch
 
We have successfully removed the old battleaxe blades and are ready to import the new ones. Go back and activate the newmesh.nif window.
 
* Expand: 0 NiNode newmesh
* Right-Click: 1 NiTriShape BattleAxe:0
* Select: Block -> Copy Branch
 
Return to the modded iron battleaxe window.
 
* Right-Click: 0 NiNode BattleAxe
* Select: Block -> Paste Branch
* At the warning prompt Select: Continue
 
Now you will notice that the new blades have been imported into 16 NiTriShape and the blades are visible in the render window. We must now convert the new mesh into a NiTriStrips Block for use as a weapon.
 
* Right-Click: 16 NiTriShape BattleAxe:0
* Select: Mesh -> Strippify
* Expand: 16 NiTriStrips BattleAxe:0
 
Notice that the mesh data block as also converted from 17 NiTriShapeData to 17 NiTriStripsData (you can go back to the newmesh.nif file to see this). But we are still missing a very important data block: NiBinaryExtraData Tangent space (binormal & tangent vectors). We must now add that data block to our new NiTriStrips block.
 
* Right-Click: 16 NiTriShape BattleAxe:0
* Select: Mesh -> Update Tangent Space
 
Node 17 NiBinaryExtraData Tangent space (binormal & tangent vectors) has been added! But we are not finished yet. Because this was a new mesh created from Blender it is important that we ensure the normals are correctly faced and smoothed. Otherwise we could encounter problems with the way the texture map appears in the game environment. Lets do that now.
 
* Right-Click: 16 NiTriShape BattleAxe:0
* Select: Mesh -> Face Normals
* Right-Click: 16 NiTriShape BattleAxe:0
* Select: Mesh -> Smooth Normals -> Click, Smooth
 
You have now successfully imported a new mesh into this NIF file! If you haven't done so already, now is a good time to save your modded iron battleaxe. We will be using this modded iron battleaxe for the next few sections. You can go ahead and close the newmesh.nif window.
 
* Toolbar -> Save
* Save In: -> Desktop
* Name: mybattleaxe.nif
 
== '''Importing An Existing Texture''' ==
Oblivion come stocked with countless pre-made textures from walls to human faces. All base textures will work on all meshes but the results might not appear as expected. We will try to add and existing texture to better explain why this is.
 
* Expand: 0 NiNode BattleAxe
* Expand: 10 NiTriStrips BattleAxe:1
* Expand: 12 NiTexturingProperty
 
Notice the file path present in the value cell of 13 NiSourceTexture. It isn't necessary to use the Block Details window to change the base texture file path. You can edit the file path directly in the Block List window by double-clicking on it.
 
* Double-Click: 13 NiSourceTexture -> Value Cell
* Enter: textures\weapons\ironclaymore.dds
 
Now notice the handle in the render window and how it looks all scattered and broken up. The blade portion of the texture map is all split up across the handle and the grip is on the blade section of the battleaxe. The texture map didn't start with the claymore's handle on the bottom of the battleaxe and end with the claymore's blade tip at the top of the battleaxe. There's an important reason for this. It's called the UV Map. See The UV Map section for more detail.
 
So let's import the texture that is meant to be applied to this mesh.
 
* Double-Click: 13 NiSourceTexture -> Value Cell
* Enter: textures\weapons\DaedricBattleAxe.dds
 
Use this method to apply the correct texture map to an imported existing NiTriShape or NiTriStrips Block.
 
== '''Importing A New Texture''' ==
You now know how to import existing textures from other NIF files. This section is an example of how to import an entirely new texture like those created using [http://www.gimp.org/ GIMP GNU Image Manipulation Program].
 
If you already have GIMP and have created a new texture, you are welcome to use it in place of the one provided.
 
* Click here and download the new texture DDS file I've created for you.
* Save the DDS file to: Oblivion\Data\textures\weapons
 
If you don't have the modded battleaxe.nif file from the previous section open go ahead and open it now.
 
<blockquote>'''NOTE:''' There isn't an associated normal map for the provided DDS file since this section is meant to provide only the steps on how to import a new texture into NifSkope. For more information on creating [http://en.wikipedia.org/wiki/Normal_mapping Normal Maps] go here: [[Quality_Normal_Maps]]. Or any of the other normal mapping articles available on this Wiki.</blockquote>
 
The steps to importing a new texture are the same as importing an existing one except we will be applying it to our new mesh.
 
* Double-Click: 20 NiSourceTexture -> Value Cell
* Enter: textures\weapons\newtexture.dds
 
Now notice the battleaxe's blades in the render window. The new texture has been applied. Go ahead and save your file as mybattleaxe.nif.
 
 
=== '''The UV Map''' ===
The [http://en.wikipedia.org/wiki/UV_mapping UV Map] tells the rendering software coordinates for each of the mesh's vertices in a flattened state. Each vertex is assigned a coordinate either in the U or V axis which corresponds to a particular location on the texture map image.
 
The texture map doesn't properly conform to the model's geometry because the iron battleaxe's UV coordinates don't place the vertices in the correct location on the iron claymore's texture map. And so you end up with what you see. To correct this issue you would need to create a new UV Map for the battleaxe's handle that provides the proper UV coordinates for its vertices on ironclaymore.dds. Blender and GIMP are freeware programs that can help perform this function but are outside the scope of this guide.
 
 
= '''Scabbards''' =
This section will explain what the [http://en.wikipedia.org/wiki/Scabbard scabbard] (Scb) NiNode is and the basic concept of creating one.
 
* Click: Load on the toolbar.
* Open: Data\meshes\weapons\iron\dagger.nif
* Expand: 0 NiNode Dagger
* Expand: 9 NiNode Scb
* Expand: 11 NiTriStrips Scb:0
 
Here you will notice that the main difference between the battleaxe.nif and dagger.nif is the addition of a second NiNode called Scb. This NiNode contains the scabbard data including a UPB Block and its own complete NiTriStrips Block. Now look at the render window and notice the textured mesh covering the blade. Click on this mesh to select it. Notice how 11 NiTriStrips becomes highlighted. You've selected the dagger's scabbard.
 
The reason the scabbard has its own NiNode is because it's actually a completely separate object from the dagger. This is necessary because the scabbard must remain fixed to the characters hip when the player activates the ready weapon animation (pull dagger from scabbard). And as such, the scabbard contains its own scene root.
 
Now you might be wondering, "Well, then how does it know where to place the scabbard on the character's model?" That's answered simply by looking at the placement of the Scb NiNode in the tree. It's placed under the parent block 0 NiNode Dagger which contains the necessary BSX Flags and Prn data to tell the game engine to place it at the character's sideweapon location (explained earlier in the guide).
 
Because the scabbard is a separate object you can make it anything you want. Make it a human head or maybe a tree. Doesn't seem very realistic but it's all possible. So the steps to create a scabbard are:
 
* Import a NiTriStrips block with the mesh you want to use.
* Parent it to its own NiNode
* Add the necessary UPB data block. TIP: It's best to copy and paste it from the location you got the NiTriStrips block.
* Then parent the NiNode Scb you created to the weapon's 0 NiNode
 
== '''Scabbards Are Only the Beginning''' ==
You now know what a scabbard is and understand how to create one. But what many people might not understand is that you now know how to add fixed objects to a character model.
 
Notice how the Prn block specified the sideweapon location? You can change the Prn block to specify any armature bone on the character model. Now, if you don't specify the sideweapon location for a scabbard the character won't pull the weapon during its ready weapon animation. But, you can use this concept to add additional meshes to the character's model without needing to equip them via the construction set.
 
For example: say we wanted to force a bound samurai flag on the character's back when they equip our new samurai sword. All we would need to do is add the necessary Prn block and correctly position the flag model's scene root at the armature bone we specify (i.e. Bip01 Spine). Now when the weapon is equipped by the player the game engine will render the samurai flag and fix it to the character's Bip01 Spine bone while still allowing the player to choose any type of cuirass they want.
 
= '''Glossary''' =
* Weapon [''Needs further information'']
 
== '''Apply Modes''' ==
* APPLY_REPLACE
* APPLY_DECAL
* APPY_MODULATE
 
== '''Alpha Format''' ==
* ALPHA_NONE
* ALPHA_BINARY
* ALPHA_SMOOTH
* ALPHA_DEFULT
 
== '''Use Mipmaps''' ==
* MIP_FMT_NO [Texture source does not use mipmaps]
* MIP_FMT_YES [Texture source uses mipmaps]
 
'''WORK IN PROGRESS. SEE DISCUSSION PAGE.'''
Anonymous user