Jump to content

Photo

Tutorial: Working with the NiControllerManager.


  • Please log in to reply
34 replies to this topic

#1
TrickyVein

TrickyVein

    Eulalia!

  • Members
  • PipPipPipPipPip
  • 3,101 posts
It is more than possible to set up your own custom, quality animations for objects inside of Nifskope.
  • The good news is that you don't need to know how to export animations from some fancy 3D modeling application to animate most of the things you want (stuff which isn't rigged to a skeleton). So doors, rotating fans, drifting buoys, etc.
  • The bad news is that the NiControllerManager which manages animation is an intimidating beast. It is opaque, its hierarchy is sprawling, and the block-names can be foreign to even the most experienced Nifskope user.
This tutorial (with lots of pictures!) will direct you how to set up the essential architecture of some basic, working animation for a door. You can use this knowledge to go off and build your own animations for a variety of different things, as it is very easy to customize once the core-framework has been put into place.

It will help if you have something you wish to animate. I have attached a .nif which is set up the same way as the door used in the tutorial. (Note that the nodes are named differently.)

Example .NIF



Part I.

  • To begin, grab Nifskope if you don't already have it (available here) and load something you want to animate.
Spoiler
  • Here is my door. I have my root node, 'Scene Root' and three NiNodes attached to it as children; the door frame, 'unstndoor01frame;' left door and right door, 'unstndoor01right' and 'unstndoor01left' respectively.
Spoiler
  • I want to collect my NiNodes into a new NiNode and name it '<whatever your root node is named> NonAccum.' In this example, my root node is called 'scene root' so I'm calling my new NiNode 'SceneRoot NonAccum.'
  • Attach your new NiNode to your root node as the only child.
Spoiler
  • Now we will insert a new NiControllerManager, proper.
  • Don't worry about attaching it to anything just yet. There's a lot to pay attention to, and it's easiest to understand this tutorial if you follow through all of the steps before jumping ahead. You will find that things can become quite cluttered and hard to follow as there are many branches to keep track of.
Spoiler
  • Now we will enter some numbers into these different fields shown for the NiControllerManager:

Quote
Flags: 76
Frequency: 1.0000
Start Time: <Float_Max>*
Stop Time: <Float_Min>

  • Reference your root node (should be index = 0) in the 'Target' field. You can also define the number of sequences you wish to manage (for this example, two), though it's not essential at this point.
  • You may think that you want to define the real start and stop times for your animation, but it's not necessary. 'Float_Max' and " min mean that t-values that we define later on will be carried on through to the manager and we don't have to worry about actually defining them at this point. It's useful. *Select these values by right-clicking in the data field.
  • Now, on to the next step. Every NiControllerManager must be supplied with an Object Palette.
Spoiler
  • Insert a new NiDefaultAVObjectPalette. Now we have to make it functional.


Continued in part II.


Edited by TrickyVein, 06 May 2013 - 01:33 PM.


#2
TrickyVein

TrickyVein

    Eulalia!

  • Members
  • PipPipPipPipPip
  • 3,101 posts

Part II.

 

  • The Object Palette serves to 'collect' or list all of your NiTriStrips and NiNodes and other blocks contained in your root node. All of them. Even your root node and objects which your aren't going to animate. Actually, you may just need to list only the blocks that are controlled/referenced by the different interpolators collected in each ControllerSequence. It doesn't seem to do anything if you just go ahead and list everything anyway. 
  • Except for collision objects. Notice that these are excluded.
  • Figure out how many objects you need to add to the list, then update your array and reference each of your blocks like shown (highlighted in red).
  • *IMPORTANT* It is essential that you provide the string-name in the 'name' field if you want your animations to play in-game. 

 

Spoiler

 

  • After you're confident you've grabbed everything in your palette - you can always go back and add more - attach it to your NiControllerManager.
  •  

 

Spoiler

 

  • Now, we're going to insert another controller, the NiMultiTargetTransformController.
  •  

 

Spoiler

 

  • In your NiControllerManager, link to your new NiMultiTargetControllerManager as the next controller. Update the start and stop times, set the flags and enter a frequency value as before for the NiControllerManager.

 

Spoiler

 

  • In your new NiMultiTargetTransformController, link to the NiNodes that you wish to animate.
  • For this example, I have two doors that I want to swing open, so I have two extra references which I link to my NiNodes for my two doors, left and right.

 

Spoiler

 

  • The next step is setting up the actual animation sequence(s) for your objects. 
  • This is done through the NiControllerManager. Under 'sequences' input the number you wish to have. 
  • For this example, I want two sequences: one for opening the door, and one for closing it. I am going to call them 'open' and 'close.' Let's work on them one at a time.
  • Note that the names of some sequences may represent AnimGroups and be recognized as the engine as such. This is important for setting up activators, for instance which by default will play their 'forward' animation OnActivate.

 

Spoiler

 

  • Your new NiControllerSequence has to be configured correctly before we proceed.

 

Spoiler

 

  • Input these data, as shown (highlighted in red in the picture):

 

Cylce Type: CYCLE_CLAMP

Frequency: 1.0000

Start Time: 0.0000

Stop Time: 1.0000

Manager: <Your own NiControllerManager>

Target: <Your own root node>

 

  • You'll notice that we define the actual start and stop times for the animation here. These, of course, can be anything you want.
  • The manager has to reference back to your original NiControllerManager
  • The target has to reference your original root node.

I have two objects which I need to animate for my first sequence (I want both of my doors to swing open when I click on my door) - therefore, for this example, I am going to have two controlled blocks in my first NiController Sequence.

  • Let's set that up.

 

Spoiler

Controller: <name of your NiMultiTargetTransformController>

Node Name: name of the node you wish to control. For this example, the right door.

Controller Type: NiTransformController *This is user-defined. Input this text yourself.

 

  • You'll notice that I haven't defined anything under 

 

Interpolator:

 

  • All we need to do now is keyframe our actual animation. Let's talk about setting up the interpolator next.

 

 

Continued in Part III.


Edited by TrickyVein, 30 October 2013 - 12:06 PM.


#3
TrickyVein

TrickyVein

    Eulalia!

  • Members
  • PipPipPipPipPip
  • 3,101 posts

Part III.

 

  • Insert a new NiTransformInterpolator into your block list.

 

Spoiler

 

  • Every kind of interpolator needs its own kind of data. The type depends on what you want to do with it.
  • For the NiTransformInterpolator, add some NiTransformData.

 

Spoiler

 

  • This is where we actually key-frame our animation. 
  • You're going to need at least two keys, corresponding to your start and stop times - defined in the parent controller sequence.
  • For this kind of animation, I've chosen

 

LINEAR_KEY

 

  • But there are other kinds of transformations you can use. It depends on what kind of animation you want to achieve.
  • This is a simple, swinging door so I only care about one rotation axis. I'm going to actually input these data later.
  • For now, we're going to plug everything into the sequence, then the controller manager.

Spoiler

 

  • Go back to your first controlled block in your first NiControllerSequence and link to the NiTransformInterpolater that we just set up.

 

Spoiler

 

  • Also plug-in your Controller Sequence into your Controller Manager if you have not already.

 

 

Continued in Part IV.



#4
TrickyVein

TrickyVein

    Eulalia!

  • Members
  • PipPipPipPipPip
  • 3,101 posts

Part IV. Finally.

  • Finally, plug your NiControllerManager into your root node.

Spoiler

  • Do you see why I've set up the tuorial like I have? It would have been very easy to get lost in what was referencing what as a target or a parent, etc. It can be verry messy and confusing to keep track of.
  • This way, you should have everything set up correctly before attaching it to a parent.
  • But who knows, you can still get lost.

Spoiler

  • If you've set up everything correctly, Nifskope should recognize the sequence you just created.
  • If you can select your sequence from the drop-down box in the upper right (as shown) and if it 'plays' then you have been successful.
  • Now I can actually worry about key-framing my animation, knowing that the basic structure of my animation is correct.

Spoiler

  • Here I am defining how far out I want my door to rotate.
  • To finish key-framing the rest of your nif, simply cut and past the branches you need. This is incredibly time-saving and useful. Thanks, Nifskope!

Spoiler

  • I can duplicate an extra NiTransformInterpolator to control my other door for my first sequence;

Spoiler

  • You can even duplicate entire controller sequences! Make sure to reference the correct NiTransformInterpolator and NiTransformData for each of the separate NiNodes you wish to animate.

Spoiler

  • Just adjust and change whatever data you need for both doors, for both sequences (for this example),

Spoiler

  • ...and if everything is set-up, your other sequence should also be viewable. Play the animation and have fun!

Spoiler




 

Some notes about setting up different kinds of animation:

  • There are lots of things that you can control through the NiControllerManager.
  • Not just the movement of entire objects; material properties; moving textures; the scale of an object. Each of these has its own kind of controller and data.
  • For a looping, or idle animation, simply select

Quote
CYCLE_LOOP

instead of

Quote
CYCLE_CLAMP

  • For your controller sequence. You probably only want to use one sequence if it's going to be looping. Setting a 'forward' and 'backward' animation also is useful for integrating scripts with custom animation sequences for objects or activators inside of the GECK. That could be the topic for another tutorial.
  • To add text-key data to your sequences, add

    NiTextKeyExtraData


    under your controller sequence\text keys. This is useful for naming your sequences as well as playing sounds. You can see how this is done by looking at one of Bethesda's assets. In Nifskope. 

Note that your collision object, if attached to an animated node itself must be configured to move with its parent body. Configure your BhkRigidBody or BhkRigidBodyT with the following properties (from dropdown fields):

 

Layer: OL_ANIM_STATIC

Layer Copy: OL_ANIM_STATIC

Motion System: MO_SYS_KEYFRAMED

Deactivator: DEACTIVATOR_NEVER

Solver Deactivation: SOLVER_DEACTIVATION_OFF

Quality Type: MO_QUAL_FIXED

 

 

Your collision object should now be highlighted in pink instead of red, by default. 


Edited by TrickyVein, 30 October 2013 - 12:14 PM.


#5
Pelgar

Pelgar

    Enthusiast

  • Supporter
  • PipPip
  • 127 posts

Just wanted to say thanks, looks like a lot of very useful information. I'm just getting into animation for FNV, this should be very helpful.



#6
TrickyVein

TrickyVein

    Eulalia!

  • Members
  • PipPipPipPipPip
  • 3,101 posts

We can only hope.

 

Thanks for reading - it's a lot to digest - would be great to have your feedback :)



#7
Pelgar

Pelgar

    Enthusiast

  • Supporter
  • PipPip
  • 127 posts

It'll probably be a day or two but I plan to work all the way through your tutor. I'll be glad to give you all the feedback I can.

 

I haven't even read all of your tutor yet but since I've been having a bit of a problem with some looping anims. I skipped down to the Cycle_Clamp to Cycle_Loop section, the keyword being skipped so I could have missed something. Have you ever got an existing non-looping anim. to loop by simply changing Cycle_clamp to Cycle_Loop? I've tried this several times in NifSkope but the Geck still does not see it as a looping anim. i.e. the Loop Forever check box is greyed out. The only way I've found to fix this is to load the anim. into Blender and add the StartLoop and EndLoop Text keys. The trouble with that method is most of the anims. I can find won't even load into Blender. The Nif Script errors out with non-oblivion .kf not supported or something. Umpa's dance anims. are a good example of that problem.

If there is any way to add the StartLoop and EndLoop Text Keys via NifSkope I'd love to see that added to your tutor.

 

Thanks again for all the hard work you put into the tutor.



#8
Pelgar

Pelgar

    Enthusiast

  • Supporter
  • PipPip
  • 127 posts

I have read your entire tutor now. I think it would be a lot more helpful to me if I had the unstndoor01 parts you use as an example. I've extracted quite a few meshes from FNV's meshes.bsa but the only ones I can find that even have NiNode properties are already animated. All of the non-animated meshes I've looked at are using niTriStips. I'm simply not strong enough with NifSkope to work out what I need to do with them.

I assume the .nif your tutor is using is something you put together, I can't find any unstndoor files in any of the FNV bsa's that contain meshes.

 

Thanks



#9
TrickyVein

TrickyVein

    Eulalia!

  • Members
  • PipPipPipPipPip
  • 3,101 posts

There is a way to add text-key data to your sequences. 

 

I'll add this step in. It's as simple as adding some 'textkeydata' and linking to it in your controller sequence.

 

I was thinking about attaching the resource used in the tutorial (it's my own - and the dimensions don't match Bethesda's chosen standard for a small door) - perhaps this is a good idea.    The whole point, of course, is that the NiControllerManager hierarchy is completely transferable.    Nothing in this tutorial is dependent on the names or total number of nodes you want to animate - at least I hope it doesn't seem that way.  OK - I modified one of Bethesda's resources and attached it to the OP. It's set up the exact same way. You've got a frame, a left door and a right door.


Edited by TrickyVein, 06 May 2013 - 01:36 PM.


#10
Pelgar

Pelgar

    Enthusiast

  • Supporter
  • PipPip
  • 127 posts

Thanks TrickyVein,  I think the nif will be helpful to some of us that are still trying to get a handle on NifSkope. I'll work through the tutor with it and let you know how it goes.

 

Thanks for the info on adding textkeydata as well. I've been doing a lot of experimenting with animation, being able to add that data will be very helpful.






Page loaded in: 0.787 seconds