Animation format

From The Ghar Station Wiki
Revision as of 00:03, 13 June 2017 by Imathrowback (Talk | contribs)

Jump to: navigation, search

Animation data

Animation within a Gamebryo NIF is achieved using a combination of different techniques.

Texture animation/scrolling

Part of a NIF file. Uses a NiFloatsExtraData flag to specify UV texture co-ords to scroll. See NIFLoader.cs source.

Character models

NIF

Most models in use a bone system to link the mesh (skin) with the bones, then the bones can be transformed. Model references are stored in telara.db in dataset 7305.

An example model might be

 imp.nif

Character models (eg, the player) are slightly different. They have a base "empty" model, eg:

 human_female_refbare.nif

That then has to have other NIF files "grafted" onto it using reference points within the NIF. For example, a shoulder piece:

 dwarf_male_vanity_shoulder_405B.nif

Contains two nodes:

 pauldron_l_JNT
 pauldron_r_JNT

These reference points also exist within ```human_female_refbare.nif``` and so can be grafted onto the correct bone

KFM

The animations for the model utilize a KFM (Keyframe) file. A KFM file contains a list of animations sequence ids and names. The names are not used in RIFT, instead the 'ID' is used to link to a KFB file.

A KFM file uses the same naming convention as the NIF and is usually specified within the NIF entry in telara.db:

 imp.kfm

KFB

A KFB file is a NIF file containing the actual animation data. These files contain a series of data, each made up of 4 NIF blocks. A KFB file uses a slightly different naming convention than the KFM. In general if the NPC can wield different weapons, then the KFB file name changes depending on the type of weapon equipped. The actual strings can be gathered from dataset 230 such as:

 2h_staff
 1h_ranged
 dual
 etc.


These are then formatted with the name to give a valid KFB file:

 human_female_dual.kfb
 human_female_2h_staff.kfb



Each sequence in the KFB is made up of:

NIF Type Purpose
NiIntegerExtraData Contains the ID to link to the sequence within the KFM
NiIntegerExtraData Size of the uncompressed binary data of the next block
NiBinaryExtraData Compressed(ZLIB) NIF file stored as binary data.
NiBinaryExtraData Unknown additional data. Appears to contain references to animation triggers like sounds.

Applying to the model

The stored NIF data file within the KFB contains a list of NiSequenceData and NiBSplineCompTransformEvaluator that define how the bones should be transformed for each frame by evaluating a spline function.

See AnimatedNif.cs.