NifSkope Alchemy

Revision as of 04:55, 24 April 2006 by imported>Maian

I'd like to start by saying this is more of a resource guide than a tutorial. And it is probably not much of a newbie guide. This is a guide showcasing the various tidbits using NifSkope we've discovered at the TES4 forums. All information given is learned and therefore subject to be quite wrong and/or incomplete.

I will cover the basics of importing and exporting meshes, but not problems and guildelines for this. That is a whole subject by itself.

At the time of this writing, NifSkope is at v0.8.1 and there is no official Exporter for nif files available from Bethesda yet. What we can do, is change textures, swap out models and materials, add new effects to our nif files, and a few other tricks.

The NifTools team has kindly produced said NifSkope and is available at their webpage: Here.

The BSA unpacker by Ghostwheel is available here: Here.

If you don't have it already, nVidia's .DDS plugin for photoshop (and apparently PaintShop) is available here: Link.

Discussion for this guide can be found Here.

So, you've unpacked your .bsa files. You know the basics of retexturing, and you have a fairly good grasp of how normal maps work. You've taken a gander as to how nifskope works, and know that you can replace or modify the data given in a .nif file, but aren't sure where to start? Or, none of the above, in which case you might be reading the wrong guide :)

Let's rock.

I'll be using a pretend example of Meshes\mine\Sword.nif.

Base Textures

Nearly every nif has two texture files associated, stored in the dds format. The color map, and the Normal Map. Say, Sword.dds and Sword_n.dds. When you assign the Sword.dds, the Oblivion engine automatically seeks out Sword_n.dds.

If your filename has extra underscores in it, there will be problems, so: No Underscores.

In the color map, the Alpha channel should be white, unless you are using transparency, then Black is transparent, and white is opaque. I will touch on how to enable Transparency later. For the normal map, the alpha channel controls the amount of specularity on the mesh, again, black=not shiny, White=Shiny.

Textures get changed like this:

+NiNode
-+NiTriShape
--+NiTexturingProperty
---+NiSourceTexture @ textures\weapons\mine\sword.dds

There's a little flower icon place of the @. Click on it to navigate to a new texture, and click open to assign a new texture. There's a few hitches here we've discovered: Sometimes nifksope does funny things with the path, \'s and /'s here. If your mesh doesn't show up in-game, or is black or pink, try this:

Under the NiSourceTexture node, check +Texture Source in the Block Details view. It reads out thusly:

File Name | filepath | @ weapons/mine/sword.dds

This happens now and again, and it's incorrect. Double-click on the texture path to enter an edit mode, click on the text again to enter text edit mode. It should read: textures\weapons\mine\sword.dds.

Exporting a .TGA template of the UV mapping for the mesh can be done by:

  1. Right clicking on NITriStrips, Texture>Export Template.
  2. The default options should be good in most cases, you may want to bump up the texture size.
  3. Click the File button to Save to a location, and hit Save.

Glow Maps

Some nifs use Glow maps, and look like: Sword_g.dds. Much like the normal map setup, the engine automatically seeks out the _g.dds. They control how the material is affected by darkness. By default, Oblivion's engine will fade a texture to gray as it moves into darkness. The glow map can override that. Take a look at glass armor for an example. Looking at Sword_g.dds in photoshop, we see a graysale image. Black means not affected, and white is fully lit when in complete darkness. There is an alpha channel, but I haven't noticed it doing anything in my tests.

Another neat trick here, is to make a colored glow map. for example, black fading into an intense red. Now, you will see that as displayed in the light there is no red. When in the darkness, You will see the red, and how it fades out.

Say you retextured a chainmail cuirass, but want to use a glow map?

Right click on the NiTriShape node, and select Texture>Add Glow map. Nifskope will now complain about the lack of a texture, and will continue to do so. Don't enter anything, as the engine will look for a texture with _g at the end. Just so long as it follows the other names: Sword.dds, Sword_n.dds and Sword_g.dds

Now, go back to the NiMaterialProperty, and click on the palette icon. Move the Emissive slider to White, and save.

Hair

Hair is a special case. Looking at Style01.nif, we see it references grey.dds. This is accompanied by grey_hh, grey_hl and grey_n. The color and normal maps work as usual. I haven't done real serious testing, but grey_hl seems to work for low-lights and extra color when changing hair color in the race menu. And I can't get grey_hh to do anything at all. But again, I haven't played much with them. I hope to get this section corrected.

Material Node

I don't have much to say for this one. You hit the palette button to change the lighting for your mesh, adjust the alpha and glossiness. :D

Adding Property Nodes

Right clicking on a NiTriStrips node lets you attach new property nodes used for effects.

NiAlphaProperty - Allows for transparency, which is controlled by the Alpha channel of the color map. Hit the flag icon in Block details to see your options. NifSkope 0.8.1 has a problem here with Oblivion nifs, however. If you hit the flag/options, and the mesh shows up black in-game where it should be transparent, here's the fix for now:

  1. Double-click on the binary number next to the flag, and click again to enter text edit.
  2. Erase what is there, and type in 237, and hit enter. These are the same flags set, but without the extra digits in front. Now transparency works fine!
  • 237= Enable Blending On, Src Alpha, Inv Src Alpha.
  • 4845= Enable Blending On, Src Alpha, Inv Src Alpha, Enable Testing, Greater, 0,
  • Sort Triangles. This seemed to help in some instances, but I'm not sure why.
  • 4333= Enable Blending On, Src Alpha, Inv Src Alpha, Sort Triangles. This was found on the blood decals, and Stalagtites for cave pieces. *shrug*
  • 4109= Enable Blending On, Src Alpha, One, Sort Triangles. Found on effects like cave fog or lightbeams.

NiStencilProperty is a z-buffer effect. Best used along with transparency and red wine. This is most useful for hair that only has one side. Bethesda meshes use two sets of polygons against each other for the flat parts of hair. I don't know much about the it's functions, but I've found it's usually set up like this:

Set Stencil Function to 4, Pass Action to 3, and Draw mode to 3.

There are other Property Nodes, but none of them really warrant enough attention for this guide. Feel free to play with them at your lesiure!

Material Switching

For most clothes and some armors, the body parts are modelled in. If you wanted to switch part of the clothes to have the skin material on them, for example, try this:

Select NiTriShape, and expand Properties>Indices in block details. One is for texture, the other is for material. Change the index number reference to the index number of the other material used in the mesh.

If your mesh doesn't have skin on it, all you need to do is point the texture to the base skin textures in the textures\characters\imperial\ folder. In-game, the engine will adjust the skin tone and race to it's actor, just like normal.

There are 5(?) different shaders used in Oblivion, and it's easy to change which one your mesh uses:

Select NiTexturingProperty, and look down to the block details. Apply Mode is where it's at! Double click the Apply mode number, click again to enter text edit, change the number, and hit enter.

Here's my findings: 0: Probably not used. In my tests, it freaks out half the time on the alpha channel. 1: Doesn't seem to be used? It seems to work the same as #2. 2: The material most everything uses. 3: Is the glossy effect seen on glass. It also adds a reflection map, found in Textures\Effects\Reflection.dds. 4: Is the Parallax effect, whos effect is controlled by the color map's Alpha. It's only found on cave pieces and the CharGen Prison. Pretty processor intensive.

Mesh Switching

It is possible in most instances to copy and paste various bits from nif to nif. Meshes, for example.

Open the nif you want to copy a part from. I used \meshes\clothes\upperclass\01\f\shirt.nif.

Right click on the torso piece's NiTriShape, and select Block>Copy Branch. Now open another file, I used meshes\armor\ebony\f\cuirass.nif. Right click on the root- 0 NiNode and select Block>Paste Branch. The shirt's mesh shows up, and is a root node, not good. Make a note of the Node Number for this paste-job we just did.

Highlight 0 NiNode, expand Children>Indices. Double click index 1 (UpperBody), and click again to enter text edit mode, and chante it to reflect the number of the index we just pasted in, and hit enter.

The shirt mesh is now in place of the previous ebony mesh on the heirarchy, and the ebony torso mesh got tossed out. All that's left is to delete that ebony torso node, and it's children (you psycho.)

Using this method is useful for switching many node types. Property Nodes go under Properties, meshes and NiNodes go under Children, and Extra Data for those special Extra Datas you know and love.

Importing and Exporting Meshes

You can Right click on a NiTriShape, select Mesh>Export .obj. Then you go play with it in your favorite 3d editor. You can either create a new mesh, or edit what you exported, and then re-import it in a similar way, but opting to import instead.

This is the area currently causing problems here and there, and I won't be going into this guide. Partly because it isn't all nailed down yet, and partly because I don't know all of what does what.

At current, we cannot do much with Skinned/Vertex Weighted armors. The same goes for Havok Data, and collison meshes. Actual results may vary.

The current method for weapons and world objects, is to find an item with a comparable size to insert your weapon mesh into. This is so your weapon has a similar-ish collision mesh when interacting in the world.

So that's about it for now. There are plenty of other properties to be explored, If in doubt about something, the easiest way is to check how it's done on a bethesda mesh, and try to replicate it.

Big thanks to: Darknel, xdarkstarx, RedFeather1975, EdgeofForever, phoenixamon, ClayFI, ModelMan, Hayly, lowell, JOG, and anyone else I may have forgotten.

Good luck and have fun!

...With a crazy sort of love, throttlekitty.

See Also

Reskinning Rudiments 1

Retex Troubleshooting

Normal Maps Basics