NOD Engine SDK 1.0

NOD File Specifications

Introduction

The NOD file format should not be confused with the Nod Engine itself. The engine is named for the Vampiric Tome describe in the White Wolf game system, whereas the NOD file format stands for Nihilistic Object Description.

NOD files are used to describe the shape of 3D objects used in the game. All 3D objects other than the actual level geometry (see NIL file) are stored in NOD files.

The original NOD files for the game were created by exporting data from Alias|Wavefront’s MAYA animation package, version 2.5. However, the actual contents of the NOD files are not specific to this package and could be created by any art package with a suitable exporter.

Coordinate systems

Each vertex is represented spatially by three floating point values, (x,y,z). The positive Z axis is UP vertically in the model space, the positive Y axis points forward in the direction the character is facing, and the positive X axis is in the direction of the character’s right hand.

Coordinates are stored in the NOD file according to the models at-rest pose. The bone data is likewise stored with information about its at-rest pose, and all deformation of the model in the engine is relative to this pose. If you were to view the vertex data in the NOD file alone without any bone information, you would see the model standing rigidly in its at-rest pose.

Skeletal Structure

The skeletal structure in a NOD model consists of a number of bones arranged in a hierarchy. Each bone other than the root bone has one and only one parent bone. Each parent bone can have any number of child bones. Animation in a bone is automatically transferred to its children in a standard animation hierarchy. The bones in the NOD file do not contain any information about IK chains, this information is stored only in the animation package and is stripped from the NOD file.

There is a maximum of 64 bones in a NOD model. The bones are defined near the top of the NOD file, and the vertex information later in the file references these bones by index in the definition array, (0..63).

Vertex Weighting

Because the NOD models can be "soft-skinned", each vertex is bound directly to one or more bones, rather than the more traditional method of binding to a bone at the mesh level. A vertex can be bound to at most two vertices. If a vertex is bound to two vertices, there is a weighting factor that determines the percentage of influence for the FIRST weighting specified. If the vertex is weighted against a single bone, this weighting value is ignored (but still present in the file format).

Format

Field

Size

Comments

Version

Unsigned integer (UINT, 4 bytes)

Version integer indication the version of the file format. Vampire 1.1 uses version 7.

NumMaterials

UINT

Specifies the number of materials used by this model.

MaterialName[]

32 characters * NumMaterials

Name of each material used. Each material has a 32-character name.

NumBones

Word (2 bytes)

The number of bones defined in the file

NumMeshs

WORD

The number of meshes defined in the file

NumVertices

UINT

The number of vertices in the file (all meshes)

NumFaces

UINT

The number of faces in the file (all mehes)

NumGroups

WORD

The number of "mesh groups" in the file

ModelFlags

UINT

Bitvector of flags for model behavior

Bounds

6 floats, min(XYZ), max(XYZ)

Specifies the axis-alignged bounding box in model coordinates that bounds the model’s at-rest pose

 

ModelFlags Bitvector Definition

Flag Name

Value

Meaning

HASLOD

0x1

Model has LOD information

INLINE

0x2

Model was generated from Inline level editor data

STATIC

0x4

Model does not use skeletal animations and is just a static rigid object (faster rendering path)

RESERVED

0x8

Do not use

RESERVED

0x10

Do not use

 

Bone Definitions

The contents of the bone definition are repeated next, and there are "NumBones" definitions in the file.

Field

Size

Comments

RestTranslate

Vector3 (three floats, 9 bytes, [XYZ])

The centerpoint of the bone in the at-rest pose of the model

RestMatrixInverse

Matrix34

The inverse orientation of the bone in the at-rest pose

SiblingID

Signed short (2 bytes)

The index of the next "sibling" bone, or –1 if this is the last

ChildID

Signed short

The index of the first child of this bone or –1 if there is no child.

ParentID

Signed short

The index of the parent of this bone. The root bone is always defined first, so –1 is only valid for that bone.

 

Mesh Definitions

The mesh definition structure is repeated "NumMeshes" times in the file. In earlier file formats, the mesh contained much of the information about the geometry, but in newer version, it was largely replaced by the MeshGroup definition. However, the meshes are still each given a name because certain game functions search for meshes with specific tagged names.

Each mesh definition consists of simple a 32-character MeshName field.

Vertex Definitions

All the vertices for the model are defined in a single block, even though they are later rendered in specific groups. What the engine does it allocate and load the vertices as a large block, and later gives each group a pointer into this larger array to act as its local grouping of vertices. The contents of the vertex array is basically just a concatenation of the vertices from each mesh group.

This definition is repeated "NumVerts" times.

Field

Size

Comment

Pos

Vector3 (XYZ)

This is the location of the vertex in 3D space in its at-rest pose.

Norm

Vector3 (XYZ)

This is the normal vector at this vertex in the mesh, used for real-time lighting.

UV

Vector2 (UV)

This is the texture vertex controlling how the texture in anchored to the mesh at this point.

Weight

Float

This is the weighting factor. If the weighting factor is < 1.0, the vertex is using weighted skinning

BoneNum

Byte

Which bone (by index) is this vertex bound to. If the weight is < 1.0, the remaining weight as assumed to be on "BoneNum"’s parent.

 

Level of Detail Information

This section of the file is optional, and is present only if model flag HASLOD is set. This section contains information required by the progressive mesh system to reduce the model complexity dynamically at run-time.

The contents are simple a single WORD sized index for each of NumVertices. Each entry indicates to which other existing vertex THAT vertex collapses as LOD decreases. The vertices are already ordered in order of these collapses.

Note that the indices contains in these fields are relative not to the concatenated array of vertices, but rather to each sub-array of the vertices in each group. This is why although the vertex array can support more than 216 entries, these collapses indicates are only 16-bits wide. Some entries in this table are ignored if the vertex they correspond to is part of the minimum-LOD set and doesn’t collapse at all. All other values must index a vertex within the mesh group with a lower index than itself.

Face Definitions

Like the vertex definitions, the faces are grouped together into a single block in the file, to reduce the number of allocations and speed processing. However, when used at run-time, each mesh rendering group references a subset of this larger array.

Each face is defined simply by an array of three WORD indices. These values index into each mesh groups LOCAL array of vertices, not into the concatenated array read previously. All NOD model faces are triangles, so the contents of this section is basically 3*NumFaces WORDs.

Mesh Group Definitions

The mesh group is where most of the important rendering data is stored for the model, the previous sections basically provide the "Raw material" needed to define the mesh groups properly. The mesh groups are the last element in the NOD file for this reason.

Each rendering group consists of a group of vertices and faces which are rendered with a similar texture and generally represent a single piece of continuous geometry. These definitions were previously called Meshes, but often meshes need to be broken up into multiple groups if there are different textures applied and so on.

Field

Size

Comment

Material ID

Signed Integer (SINT)

This is the index into the material array in the preamble which is used to texture this group. –1 = not texture.

RESERVED

12 bytes

This field should be ignored

NumFaces

WORD

Defines how many faces are in this group

NumVertices

WORD

How many vertices are in this group

MinVertices

WORD

How many vertices are in the minimum-LOD set for this group (invalid but present if LOD not indicated)

GroupFlags

WORD

A bitvector to control per-group rendering behavior

BoneNum

BYTE

Defines binding of the entire group to a single bone only if NOSKINNING bit is set, always present in the file

MeshNum

BYTE

Defines which mesh (array of names) this group is a member of. Used simple to map older mesh structures to newer MeshGroup structures.

 

GroupFlags Bitvector definition

Name

Value

Meaning

HASLOD

0x1

The mesh group contains level-of-detail information.

NOWEIGHTS

0x2

The mesh group contains no weighted vertices

NOSKINNING

0x4

The mesh group contains no skinning. All vertex bindings are ignored and replaced by the BoneNum value in the mesh group definition.

MULTITEXTURE

0x8

The mesh group should use multitexture vertices for rendering (NOT USED in 1.1)