Jump to content

Cleaning Nifs


Symon

Recommended Posts

Cleaning Nifs in NifSkope

 

Introduction

What do I mean by cleaning? Well, if you examine meshes (clothes and armour usually) it's not uncommon to see the odd mistake or two. I don't want to get too much into why it's very common to see issues, but there are several reasons, usually no reflection on the modder.

1. The 3DStudioMax exporters seem to have a wretched habit of producing really inefficient nifs.

2. The modders workflow might create redundant nodes.

3. The modders enthusiasm or modeling skills outstrip their attention to detail.

4. Very occasionally, carelessness.

 

The better question is why do this cleaning? Well, for one thing you'll make the Nifs smaller. Usually only by a few kilobytes, but sometimes by hundreds of kilobytes or even megabytes! That's good for your disk space, memory and it means your processor doesn't have to look at and and then ignore these nodes. One particular cleanup is to 'share properties'. Instead of having 20 properties all the same, taking up space and with your processor treating them as different (it doesn't know they are identical), you substitute one property. Now cleaning up one mesh isn't going to transform your machines performance. But cleaning one you always put a companion in or all the guards wear will help. Cleaning all your meshes, while slow and tedious to do, will be a big help to your rig.

 

All these cleanups are simple NifSkope 'spells'.

 

There are no screenshots in this tutorial. Firstly because I despise them, and secondly because if you need screenshots, you aren't comfortable enough in NifSkope to attempt this (yet). Be aware that if you delete the wrong things, you can break the Nif, so have a backup in case of disaster. Remember that NifSkope doesn't say, 'are you sure'? It assumes you KNOW WHAT YOU ARE DOING!!!

 

Step one: Open the nif you intend to clean. Don't bother looking at the image. You are interested in the block list, usually on the left.

 

Step Two: Inspect the Block list. You should see one node, 'scene root'. Sometimes you'll see two or three nodes, experience will show these are ok. In either case, move on to step three. What you don't want to see, is a huge list of nodes, with names like 'NiTriShapeData' or 'NiSkinInstance'. These should have an NiTrishape or TriStrip as parent, themselves children of the scene root, and so should not be visible at all until you open the scene root. These are corrupt nodes taking up space but doing nothing, that usually result when someone did block>remove rather than block>remove branch!

You need to delete them ALL! It's tedious if there are 12 Mb of them, which I have seen. The best way is to click on each node in turn and press CNTRL DEL. Be warned it can take NifSkope quite a while to delete a node and refresh the list if you are fixing a 20 MB Nif. (Take heart, with luck it will be less then 5Mb when you are finished).

 

Step Three: Select Spells>Optimize>Combine Properties. There is no point to having the same property defined 20 times in a Nif. This replaces identical properties with one node. Decent optimization. Note that a property called Skin is NOT the same as a property called skin. (The capitals). You can fix this by changing the names to be consistent and then repeating the step. Do watch out for skins by the way. Differences in the ambient and diffuse colours or glossiness on the NiMaterialProperty nodes are common, especially when the maker wanted tinted skin colours or sweaty bodies.

 

Step Four: Select Spells>Optimize>Remove Bogus Nodes. This step removes valid nodes that are redundant. An example would be a lower body mesh with finger bones! It's not uncommon for this step to discard 20-60 bones that are doing nothing.

 

Step Five: You've done all the basics, so save the mesh. Check how much space you saved. It might only be 1-10k, or it could be masses, depending on how much work you had to do.

 

Step Six: There are more advanced techniques you can try, but you need to experiment on an individual mesh to see if they are worth it.

 

1. Spells>optimize>stripify all trishapes. Turns NiTriShapes into NiTriStrips. Depending on the mesh and if it is TriShapes, this can save a lot of space.

2. Spells>Batch>Update all tangent spaces. This often gets rid of 'jagged lines' on skin textures.

3. Clicking on a NiTriShape/NiTriStrip and selecting Mesh gives two useful options. Remove Duplicate Vertices and Remove Unused Vertices. Normally, it shouldn't do anything, but with some meshes, I've seen the former massively reduce the mesh size. One of the 3DSMax exporters seemed to like to double every vertex!!!!

 

As you gain confidence and experience, you start to know 'what looks wrong' when you inspect a Nif and what you can do about it.

Start small and build up your confidence.

Link to comment

No, the order doesn't matter.

One thing I did forget, if Remove Duplicate Vertices does anything, you'll have to remake the skin partitions. This is another spell, batch>Make All Skin Partitions. This brings up a subscreen with many options, but it correctly sets defaults for Oblivion, so just click OK.

Link to comment

Thanks for the useful guide. I have been doing this to almost everything I download, but I'm sure it will be of help to others.

 

Here are some more tips:

To remove corrupt/leftover nodes outside the Scene root, the quickest way by far is to select the sceneroot and use the Crop to branch option.

 

Easiest way to combine properties is to first fix one. Let's say your mesh has metal parts. Select the material on one of them, make sure it has a reasonable amount of gloss and specular colour and give it a suitable name. Metal, or if you want it to have fake mirror-shine, EnvMap2. Now right-click the material and select copy (not copy branch in this case). Go to the other metal parts, right-click the material and "paste over". Now do the same for Cloth, Leather, Emissive parts like glowing gems, etc.

 

For skin parts, be sure to leave the material name as skin or Skin, but pick one materialnode and paste it over the others so there will be no seams caused by different materials. Some people forget that not all races have human skin and will use pink colours. Silly, because the texture itself is already pink, or in some cases, not at all. Just use white materials for ambient and diffuse, black or white for specular depending on whether you want glossy or not.

 

Also make sure that the NiTriStrip/shape nodes that have skin property are named appropriately. For most things this means the name should start with "Foot", for example "Foot:Upperbody". This depends on what bodypart is used to find the skin texture. For HGEC, feet, lowerbody and upperbody are on the "Foot" texture, so that's why you have to name these nodes Foot. The hands are on the Hand texture, so they have to be called Hand. Skin parts named TriFoot something are sometimes found in nifs. They will appear to work fine until you put them on someone with a non-imperial skin.

 

After combining properties, go to View->block list->Show blocks as list. If it worked correctly, there should only be one of each materialtype you assigned left in the list. A tiny difference between two colours can prevent materials from being merged even though in game you won't be able to spot the difference, so that's why you used the copy/paste over trick.

 

One more thing that's not covered here is the textures. Some people include uncompressed textures, sometimes using up to 25MB for a single texture (imagine how many of those will fit before your Video memory runs out) or textures without MipMaps. When opening a mesh, Oblivion will have to generate MipMaps if there are none, causing a hefty delay before you actually see the armor equipped. DXT compression can cause some quality loss, but usually, the result is good enough for normal gameplay, and will reduce memory usage by a lot. For textures with grayscale alpha/transparency layers, use DXT5, for those without alpha (black or white) use DXT1. Some people really make me cry and use 1024 or 2048 pitch black or other unicolored textures, wasting tons of memory on what could basically be done with a 1x1 pixel texture. Size them down to reasonable size, like 64x64 which will use almost no memory.

 

I already had some screenies I made for a friend a while back, you can see them here:

Photobucket album, nifskope help

No further explanation, if you are comfortable enough with Nifskope, you'll be able to figure it out.

Link to comment

Now you know why I loathe omods and bsa packaged files. It makes this all a little more tedious. You have to break out the omods or bsa archive so you can check the nifs. Don't assume they are ok. They often aren't and can be full of less than optimal nifs, thumbs.db files and random junk!

(Uses duplicate post for something useful!)

 

 

Link to comment

Some great additions for people to consider there.

 

Some people really make me cry and use 1024 or 2048 pitch black or other unicolored textures' date=' wasting tons of memory on what could basically be done with a 1x1 pixel texture. Size them down to reasonable size, like 64x64 which will use almost no memory. [/quote']

 

Oh that habit makes me seethe (but technically, not Nifs). I put it down to people thinking a larger texture must always be superior! (No, the smallest resolution texture with the best possible detail is better all round).

 

 

Link to comment
  • 10 months later...

NiTriStrips / NiTriShape, what's better?

Does NiTriStrip have nothing more than occupied disk space advantage?

 

I thougt strip is better because many tutorials recommend stripifying when sanitize the nifs, but I find PyFFI process (with 2.1.11) does convert all of them to trishapes, rather than stripifying them. :huh:

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use