• Welcome to Freedom Reborn Archive.
 

Tutorial: Basic Animation with Nifskope

Started by Conduit, December 18, 2007, 02:49:20 PM

Previous topic - Next topic

Conduit

This tutorial will teach you the basics of using NifSkope to create animated nifs suitable for use as animated objects or fx.

In this tutorial, we will create the 'agent spawn' effect seen in the Matrix Mod Reloaded.  It consists of the shape of an agent with matrix code running down it fading in and shrinking on the character about to be possessed.

First, download the starting nif and textures here.  Put the textures in your fx/_textures folder and the start.nif in a folder of your choose.  Now open up the start.nif in NifSkope.



It's just the male_suit mesh with a few minor changes.  Now, all animation is done using things called controllers.  They change the values of certain attributes over time.  For this, you're going to need to add three controllers: one to make the agent start out big and shrink to normal size, one to make the agent fade in, and one to make the code texture move.

Let's start with having the agent start out big and shrink.  Right click somewhere, then click Block->Insert.  Under the Nik... section, you'll see NiKeyframeController.  Click on that.



A keyframe controller is added to the nif.  Now, if you haven't enabled viewing block details already, do it now and click on the new keyframe controller.



The block details of almost all controllers look like this.  Start by setting Frequencey to 1 and Flags to 12.  Now, before we'll go any further, we'll assign the controller to a block.  Click on the Bip01 node.



Controller is a block reference.  Right now, it's set to -1, which means it refers to nothing.  Every block has a number, which is to the left of each block in the block list.  Set Controller to the number of the new keyframe controller.  The keyframe controller moves under the Bip01 node.  Click on the controller again.



For all controllers, the Target reference must be set to the block that is using the controller.  Set Target to the number of the Bip01 node.  Now, you need to set a Stop Time for the controller.  This will determine how long the effect will take.  2 seconds seems about right.

Now, we're going to start setting the animation data.  Most controllers use a certain type of data block.  Go to the Block Insert menu and click on NiKeyFrameData.  A new keyframe data block is added.  Click on the keyframe controller.



Set Data to the number of the new keyframe data block.  Now click on the data block.



All data blocks work the same basic way.  They have an array of keys.  Each key has a time value, and a value for whatever it controls.  The controller interpolates the animation between these keys.  Keyframe data blocks have 3 key arrays: Rotation, Translation, and Scale.  For this effect, we're just concerned with scaling, so expand the Scale keygroup.



Num Keys determine how long the array is.  Set it to 3.



Interpolation has a drop down menu.  Quadratic Key can apparently be used to create acceleration, but I've never been able to figure it out, so just pick Linear Key.  Now, onto the keys themselves.  Right click on the keys array and click Array->Update.  With some experimentation, I find that 2.5 is the best scale to start at.  Set the Value of the first key to 2.5.  Now set the value of the second and third keys to 1.  I'd like it to stay at normal size for a little bit after it finishes shrinking, so set the Time of the second key to 1.5 and the Time of the third to 2.  Press the play button to see the Keyframe Controller in action.



Now, on to making it fade in.  This is done with a type of controller called an Alpha Controller.  Insert one of these from the Block->Insert menu.



Set it up the same way as you did the keyframe controller.  Make sure that it has the same Stop Time.  All controllers in an nif have to have the same Start and Stop Times,    with the possible exception of some particle controllers.



Alpha Controllers are used by the Material Property of objects.  Set the controller reference of the agent's NiMaterialProperty to the newly created alpha controller.  Set the target of the Alpha Controller to the Material Property.
Note: In order for an Alpha Controller to work, the object must be alpha-enabled.  As described in another tutorial, this is done by adding an Alpha Property to the trishape of the object.   Also, note that while all alpha-enabled character meshes have the Destination Blend Mode flag of their alpha properties set to InvSrcAlpha, almost all "energy" type effects (including this one) have it set to One.  The latter incorporates color data into the alpha map, which makes it seem less solid and, with particles, allows better blending.   



Alpha Controllers use Float Data blocks.  Insert one of these and point the Data reference of the Alpha Controller to it.  Set up the interpolation as before.  I don't want it to do anything more complex than fade in over the course of the effect, so just add 2 keys.  Give the first one a Time and Value of 0, and the second one a Time of 2 and a Value of 1.



Now it's starting to look like an fx.  The only thing left is to make the code texture more closely resemble the "green rain" of the movies.  There are two ways of handling this.  One way would be to add an animated texture by adding a flip controller (detailed in one of Symon's tutorials) and creating new textures as frames.  The other, simpler and better looking way, would be to add a texture transform controller.  For the purposes of this tutorial, we'll choose the latter.  Insert an NiTextureTransformController from the Insert Blocks menu.



Texture transform controllers animate the texture of an object by taking the texture and moving it around.  They're used in beams, in several of the FF Base screen effects, and in my animated Water object.  Note that texture transformations are not rendered by NifSkope, so if you want to check how it looks, you're going to have to use Irrational's Nif Viewer.  They're used by the NiTexturingProperty block.  Point the controller reference of the Agent's texturing property to the new texture transform controller.



Most of the block details look like the other controllers.  Set them up the same.  Set Texture Slot to BASE_MAP if it isn't already.  Operation has a drop down menu with 5 operations, in order: horizontal movement, vertical movement, rotation, horizontal scaling, and vertical scaling.  Note that if you want to have two of these at once, say making a texture move diagonally, you have to have more than one controller.  For this effect, just set it to vertical movement, or TT_TRANSLATE_V.



Texture transform controllers use float data blocks, just like alpha controllers.  Add one of those to the texture transform controller.



Set the interpolation as before.  For the keys, we just want the code to continuously run down the agent shape, so just add two keys.  Set the time of the second to 2.  For the Value slot, 1 equals the width or height of the texture.  Keep the value of the first key the same, and set the value of the second to -1.

And you're done.  Save the nif, then check it out in Nif Viewer.  You can use this in a mod, or I suppose you could use it as the end.nif of a direct attack.

GogglesPizanno


stumpy

Sweet! Thanks, Conduit.  :thumbup:

Very good level of detail. I wish I could try this out right this minute! :cool:

Symon

Excellent work Conduit!
I'll add that anyone who can master these sorts of controllers is well set up for the tedious business of editing keyframes.

GGiant

Quote from: Symon on December 19, 2007, 10:47:48 AM
Excellent work Conduit!
I'll add that anyone who can master these sorts of controllers is well set up for the tedious business of editing keyframes.
Actually, I think Conduit already mastered it, no? :huh:
BTW, nice tutorial, can anyone sticky this?

Symon

Quote from: GGiant on December 27, 2007, 07:44:09 PM
Quote from: Symon on December 19, 2007, 10:47:48 AM
Excellent work Conduit!
I'll add that anyone who can master these sorts of controllers is well set up for the tedious business of editing keyframes.
Actually, I think Conduit already mastered it, no? :huh:
That's why I said 'anyone', meaning anyone reading who wants to know more about the tedious but rewarding business of hacking keyframes.

GGiant

Quote from: Symon on December 30, 2007, 05:01:24 AM
Quote from: GGiant on December 27, 2007, 07:44:09 PM
Quote from: Symon on December 19, 2007, 10:47:48 AM
Excellent work Conduit!
I'll add that anyone who can master these sorts of controllers is well set up for the tedious business of editing keyframes.
Actually, I think Conduit already mastered it, no? :huh:
That's why I said 'anyone', meaning anyone reading who wants to know more about the tedious but rewarding business of hacking keyframes.
OH! :doh: