Difference between revisions of "Working With Nifs 201 : Practical Use"

From the Oblivion ConstructionSet Wiki
Jump to navigation Jump to search
imported>Qazaaq
(nifskope tutorial)
imported>ShadowDancer
m (→‎TEXTURES: formatting)
Line 67: Line 67:




==TEXTURES==
==Textures==




Line 92: Line 92:


There is also an excellent troubleshooting guide aimed at texturing on the cs wiki, please refer to that for other "my mesh is invisible/pink/black" issues.
There is also an excellent troubleshooting guide aimed at texturing on the cs wiki, please refer to that for other "my mesh is invisible/pink/black" issues.


==let's do this!==
==let's do this!==

Revision as of 07:33, 24 August 2007

Niffing 201, Practical use

So let's get to working with data! woo data party!

Some tips:

Elsewhere on the wiki, you'll find guides to extract meshes and textures from the .bsa archives. I suggest unpacking a bunch of these to something other than the oblivion\data folder, for reference. Personally, I have a meshes\ and textures\ sitting in my nifskope folder. It always helps to have ready-made and working files to pull reference from, or to yank havok from, or just plain "how did they do THAT?" type of stuff.


When testing new effects, I find it easier to have a series of test files ready to go. Just stupid little junk meshes and textures already set for use in the CS. Whenever I need to try something out, I just edit the settings on one of these, and load up the game. Just saves time is all.


Don't know the difference between a face normal vs. a vertex normal? Maybe you don't even know what they are? Need tips on how to UV map? Look it up :) I've had to do a ton of research since I've first started, and can't possibly spill all of it in one guide, just too much. I really can't stress enough how much a little research can take you.


Check other guides for information on Havok! I only know the most basics, and generally try to avoid this area at all costs. (see also: I don't know enough to really write about it)


Node use and connections

A Node is a basic building block. It signifies a new branch in the structure, and can be thought of as a "container" for further nodes and data. A .nif always starts with Zero: the root Node. It also defines where the Center point that any other objects in that nif are based off. With Render>draw Nodes on, nodes are highlighted as you select them from the Block List, as well as a line drawn back towards the root node.


Each node has a number. In most cases, the actual numbering of blocks as you move down a hierarchy isn't important, just the manner in which they're linked together. More complex .nifs appear to jump back and forth with multiple connections.


Let's first examine the connections in a NiNode in Block Details:


Name: It can be named anything, but if you're copy/pasting between two files, the root node needs to have the same name.

Num Extra Data, Properties, and Children: This number defines how many of each type appears in each list. Whenever you need to connect something manually, adjust this number, and rClick on the appropriate list and Array>Update to refresh the list.


Extra Data, Properties and Children lists: These arrays, in order list the connections of each type. Double click an entry to edit it, or use -1 to clear an entry.

Collision Object: If your object needs collision, it attaches here.


A short Excercise:

For example, if You've copied the branch for a triShape from one file, and just pasted it to yours:

  1. Click the root NiNode, and look down to Block Details.
  2. Edit Num Children to one number higher.
  3. rClick Children and Array>Update.
  4. Expand Children list, enter the number of the trishape you just pasted, and hit enter.


Now the trishape you just pasted is included in the NiNodes hierarchy.


Also, we'd like to make the trishape we just pasted transparent, so let's add a property to it:

  1. rClick the triShape, and do Node>Attach Property>niAlphaProperty.
  2. The Property is added to the trishape's hierarchy now
  3. Click the trishape, and expand Properties in its Block Details view, you can see the alphaProperty attached there.


We can also just as easily remove the alphaProperty, by rClicking on it, and do Block>Remove.


For another basic example, let's click on the triShape's texturingProperty, and Change the Apply mode. Double clicking on the value here brings up a list of available modes, change it to APPLY_HIGHLIGHT (the glass effect)


Textures

Since we're on the topic of textures, here goes: From a triShape or triStrip, a TexturingProperty is attached, which has a SourceTexture attached. I cover specifics of these properties in the breakdown guides.


To change a texture, you can either type the path in manually, or click the Flower icon next to SourceTexture. If you set nifskope's texture paths properly, you won't need to worry about proper pathing. By this, i mean the way Oblivion will look for the texture you've specified. Wherever on a person's hard drive they installed the game, Oblivion will declare a "base" folder from which it will work. For example, I have installed to:

c:\games\Oblivion\

Under the main Oblivion folder, is the data folder, where all the data files are. Oblivion declares c:\games\oblivion\data\ for a base. Any time it references a texture, it can just look in \textures\blahblah\texture.dds. Instead of

c:\games\oblivion\data\textures\blahblah\texture.dds.

Someone else may have

c:\program files\bethesda softworks\oblivion\data\textures\blahblah\texture.dds.


Why make this distinction? If you don't have nifskope configured properly, it will try to use "c:\games\oblivion\data\textures\blahblah\texture.dds" when you assign a new texture to a mesh, which will cause problems for the person in my second example. Render>Settings menu to assign your texture folders, if you haven't already. Always be in the habit of checking your texture paths if you are going to be distributing your mods.

There is also an excellent troubleshooting guide aimed at texturing on the cs wiki, please refer to that for other "my mesh is invisible/pink/black" issues.

let's do this!

Here are some basics for manipulating data in nifskope to get nifty effects. I'll now roughly cover some of the basic tricks that I see get asked often. In many cases, coming up with an effect is up to you: I can detail on the various nodes and ways things can be attached, but actual implementation or configuration is yours to make. Again, there's hundreds of meshes shipped with Oblivion to take a look at for inspiration! Spend a little time looking around at how other files are constructed to give you an idea on how something works, or some small detail you may have missed when making your own.


Adding flames to a weapon

A simple cut/paste job! Nifskope won't render the particles, but will work with them just fine.

  1. Open some fire! I'd go with meshes\fire\firetorchlarge.nif, and expand the root node.
  2. rClick the billboardNode, and paste it into your weapons' .nif.
  3. Click the root NiNode, increment Num Children by 1.
  4. rClick Children, Array>Update.
  5. Enter the number for the newly-pasted billboard node into the empty spot on the children list.
  6. The billboard's mode is set to ROTATE_ABOUT_UP, which is perfect. The flame will always face the camera on the X axis, but follow the weapon around on Y axis.
  7. Expand the Billboard node, there's a node named EditorMarker- delete it by rClicking on it, and Block>Remove Branch. Also remove the DamageSphere node.
  8. The fire might not be the right size or in the right place. Be sure to do Render>display Nodes, so we can see where the base of the fire sits.
  9. rClick the billboard node, and do Transform>Edit. Using the XYZ transforms, move it to where you need it, and hit accept when done.
  10. Now rClick the billboard again, and do Transform Apply, so the settings stick when we save the file.
  11. Done.


Glass Effect

Many objects in Oblivion have a glassy appearance, enabling a model to use this is as simple as:

  1. Edit texturingProperty's Apply Mode to apply_highlight.
  2. Edit the Material's Name to EnvMap2. (optional, I believe there are two methods.)
  3. Done.


Animating a texture

There is a more comprehensive guide to animations in general<link> here </link> But here is a "from scratch" approach. Animated textures cannot be used on skinned armor, clothes, and bows. And I would imagine hair and the body won't accept it either.

There are two texture animation types: Transform or Flip. Transform animations move the texture around the UV mapping in various ways you can specify. Flips are a series of files (like that fire animation) that get played in a sequence.

Setup for either method:

  1. Can't use a normal map, having one present will prevent the animation. (you might be able to get away with using a normal map, and vertex colors, it can be quirky) And remember, if you're not using a normal map, don't use a tangent space block.
  2. go to your triShape or triStrip data, and edit "Has vertex colors" to Yes, then update the Vertex Color Array.
    1. Alternatively, just paint vertex colors in your 3d editor before exporting. We can use black/gray/white colors to control specularity via a specularProperty if desired.
  3. rClick your tristrip/shape, and add a VertexColorProperty. Set it's Flag to 40, Vert_mode_src_amb_dif, and light_mode_src_amb_dif.


Transform method:

  1. rClick your meshes' texturingProperty, and do Block>Insert>T>TextureTransformController.
  2. Also, do Block>Insert>F>FloatInterpolator, and Block>Insert>F>FloatData.
  3. In texturingProperty, edit "Controller" and enter the number for the new transform controller we just added.
  4. Expand Base Texture, change Has Texture Transform to Yes, then change Tiling X and Y to 1 and Transform Type to 1.
  5. Moving down to the Transform controller now, Edit the flags: Check Active, and Mode=Cycle.
    1. Frequency=1
    2. Stop Time=Whatever best suits the animation you'll be doing. Measured in seconds.
    3. Target - Edit this to link back to the texturingProperty that we attached this controller to.
    4. Interpolator=Enter the number of the niFloatInterpolator we added earlier.
    5. Operation: What kind of animation we're doing:
      1. ..0: scroll along U
      2. ..1: Scroll along V
      3. ..2: Rotate (you may need to tinker with Offset settings back in texturingProperty>Base Texture)
      4. ..3: Wierd zoom along U
      5. ..4: Similar wierd zoom along V


Currently, Nifskope kinda wierds out with rendering texture animations, but you can generally reset it by editing Tiling again.


  1. Moving on to FloatInterpolator now, all we need to do is edit "Data" to the number of the niFloatData we added earlier.
  2. In FloatData, let's change Num Keys to 2 for now, and set them to Linear.
  3. rClick Keys, and Array>Update, and then expand out both keys.
    1. Set the second key to the Stop time you specified bck in the transform controller, and give its "Value" a 1, and hit play.


You can add more keys, and play around with different values to your hearts content. You can also move from linear keys to quadratic, but I'm not too experienced in that field.


Flip Method:

No need to edit "Has Texture Transform", but you can if you want fine tuning. Again, we can't use normal maps in animation.

  1. rClick and do Block>Insert>F>NiFlipController. Also add
  2. Edit your texturingProperties' Controller to include the number of this flipController we just added.
    1. Flags=Active and Cycle
    2. Frequency=1
    3. Stop Time=Your choice!
    4. Target=The texturingProperty that this flipcontroller is attached to.
    5. Interpolator=The niFloatInterpolator we added earlier.
    6. Sources=As many as you have animated frames. If you have 10 frames, then enter 10 here. Also, the first Source should be the same soure Texture that the base TexturingProperty uses. Array>Update on the Sources list
  3. Jump over to the FloatInterpolator, and edit Data to reflect the number of the FloatData we added earlier.
  1. To save a bit of clicking, rClick your SourceTexture, and copy it. Now paste it as many times as many frames you have.
  1. Add each one numerically to the source list in your flipcontroller. Then have a bit of fun renaming each one to use each of your animation frames. This is my favorite part. Whee.
  1. Now in FloatData, change the number of keys to the same number of Source images you're using. Also change Interpolation to Unkown_key, and update the key array.
  2. Expand out all the keys, Time is in seconds, where that key is used, and "Value" corresponds to each frame. Ex: Time along the keys= 0, .5, 1, 1.5. Value along the keys= 0,1,2,3. I set my stop time to 2, so the last frame has a .5 second time before the animation loops again.
  3. Hit play, adjust any timings you see fit, and enjoy!



I'll try to get some more minor-specific guides like this stuck here at a later point.


see also

This guide is part of a series that I have written:

Working With Nifs 101 : An Introduction

Working With Nifs 101 : Basic Use

Working With Nifs 101 : Copy and Paste

Working With Nifs 201 : Meshes, Data, and you

Working With Nifs 201 : Practical Use

Working With Nifs 301 : A Checklist

Working With Nifs 301 : Nodes Breakdown

Working With Nifs 301 : Properties Breakdown

Working With Nifs 401 : Particles!


NifSkope Alchemy - This is my first guide, it's a little shorter and is a little quicker and easier to digest than the others.