Basic Animation Tutorial

From the Oblivion ConstructionSet Wiki
Revision as of 16:34, 17 April 2007 by imported>CtiKfa
Jump to navigation Jump to search
File:AnimGuide Samples.gif
Examples of objects utilizing simple animations. Click to enlarge.

Introduction

File:AnimGuide Fig 1 Branch Overview.gif
Fig. 1: Typical view on a simple animation's block tree.

This guide aims at enabling modders to create very simple animated objects by applying pre-assembled basic animation files. Furthermore these animation files may be customized to allow for a multitude of more complex animations.
This might especially be geared towards modders who don't have access to or knowledge about using 3D applications (such as 3D Studio Max) to create and export animations.
Basic knowledge about animations and about using NifSkope is required though.

Feel free to add to this article and/or correct any mistakes you might come across as this guide does neither claim to be complete nor to be 100% accurate.


Anatomy of Animations

An animation sequence that's embedded into a .nif file is composed of characteristic block structures (see Fig. 1).
The following is a list of brief descriptions about the most common elements.

Controller Managers

File:AnimGuide Fig 2 No Blank Links Allowed.gif
Fig. 2: Example of a harmful Controller Sequences setup.

Basically stores links to the Controller Sequences. Will be created automatically when using NifSkope's Attach .KF spell.

Note: There mustn't be any blank links inside the Controller Sequences array or the game will crash when attempting to load the .nif file.

Controller Sequences

Controller Sequences make up the actual animation and are the sole content of .kf files. They contain Blocks of information consisting of Interpolator and Controller links as well as several string variables specifying targets, types and sometimes certain parameters of animation controllers. The name of the Controller Sequence is also important as it serves as a parameter for certain animation script commands (e.g. PlayGroup). In the case of PlayGroup you can only use a specific set of names to be recognized as correct by the script compiler (see AnimGroups).

Note: Naming a Controller Sequence Idle will make the object use that animation automatically and possibly override other animation sequences that are triggered via script if the Cycle Type value of the NiControllerSequence block is set to CYCLE_LOOP.

Animation Controllers

Contain certain interpolator blocks as well as as data blocks in turn containing the actual keyframe data.

  • NiTransformControllers
Transform Controllers are used to apply translation, rotation and/or scaling to NiTriShapes, NiTriStrips or NiNodes. This means you can make your object or parts of it dynamically move around, swivel, shrink/grow, etc.
  • NiTextureTransformControllers
Similar to Transform Controllers, but must target a NiTexturingProperty. You can use it to affect the UV coordinates of the targeted mesh. In other words, you can make a texture scroll, spin or zoom in/out.

Note: The texture you're trying to affect mustn't have a normal map for this to work correctly.

  • NiAlphaControllers
Alpha Controllers are used to affect an object's opacity. They must target NiMaterialProperty blocks and in most cases the mesh node (NiTriStrips/NiTriShape) needs to have a NiAlphaProperty attached to it. Using Alpha Controllers you can make objects smoothly fade in or out; partial transparency is also possible, but unfortunately behaves a little glitchy since the alpha values can and will get overridden by the game's built-in distant Object/Item Fade feature.

Note: The texture you're using on the fading mesh node needs to have a normal map for this to work correctly.

  • NiVisControllers
Vis Controllers toggle visibility of Nodes meaning you can dynamically switch objects or parts of them on/off visually. Can also be used in conjunction with NiAlphaControllers to circumvent Object/Item Fade issues.

Animation Interpolators

Certain types of controllers need certain types of interpolators. Interpolators can either store a single keyframe value or point to a Data block.

  • Animation Data blocks
Contain keyframe information for a specific animation controller. In other words, they specify the values of certain variables (e.g. translation, rotation, scale, opacity, visibility, etc.) at specific points in time of the animation and how to interpolate in-between.


Step-by-step guides

The following is a list of instructions about how to set up a certain simple animation in a .nif and about how to tweak it afterwards if needed.

File:AnimGuide Fig 3 Basic Nif Setup.gif
Fig. 3: The basic .nif branch setup that is required before attaching one of the provided animation sample files.
  1. Download sample package here
  2. Open your .nif file in NifSkope and set it up similar to how it was done in Fig. 3.

Note: For the sample .kf files to be attachable it is crucial to have a Base NiNode like in the example. For some of the samples it is necessary to have either another NiNode named Branch and/or to rename your mesh node to Target.
Also adding a BSX Flags Extra Data block to the Base NiNode and setting its Flags value to a certain number ('11' is confirmed to work in all provided examples) is a requirement for animations to function properly.

  1. Decide on what sample animation file to attach. Possible choices so far:

Note: Attaching is done via selecting Spells -> Animation -> Attach .KF in NifSkope - you'll need at least version [http://sourceforge.net/project/showfiles.php?group_id=149157