Using ModelEdit to Create Characters and Weapons for

The LithTech(tm) Development System is copyright 1998-2000 by LithTech, Inc., Kirkland, Washington, U.S.A. All rights reserved.
No One Lives Forever is copyright (c)2000 by Twentieth Century Fox Film Corporation. All rights reserved.

ModelEdit is the tool used by the No One Lives Forever 3D team to integrate models into the game. This guide covers the most frequently used and important features of ModelEdit. The ModelEdit UI is made up of several panels. The largest panel is the Model View panel, which previews the model mesh and its animations. Below this are the CD player-style buttons for controlling the animation. The Nodes panel lists the model's skeletal nodes. The Pieces panel displays all of the individual meshes that make up the current model. The Animations panel lists all animations that are loaded into the current model. The Child Models panel lists the sub-animations files that are loaded. An animation that comes from a child model cannot be edited and will have an empty box next to its name in the list. An animation that is part of the file you are looking at will have a check mark beside its name. The Sockets panel lists the model's sockets. All these panels are discussed in this document.

Use the Level of Detail (LOD) slider to select the level of detail you want to view. Use the Animation Edit control to manipulate animation data. Use the Transform Edit control to manipulate socket positions.

At the bottom of the display is the animation Time Bar. The Time Bar has a red mark for every key frame. Frame Strings are a way to tie an event or message to a keyframe so that it will be available to the game programmer. For example, if your character has a martial arts attack, you could hook a message onto his punch animation so that each time he throws a punch, a "whipping cloth" sound plays.

## Level of Detail (LOD)

One of the best ways to optimize the rendering of models is to draw fewer of the model's polygons where appropriate. ModelEdit has a tool to create multiple levels of detail dependent upon a distance value. At lower levels of detail, ModelEdit creates a version of the model that uses fewer polygons to draw the same object. The game engine will take the distance from the rendering camera-whether that is the player's point of view or a cut scene camera-to the object seen and use the triangulation set for that distance.

To open the LOD creation dialog, in the Model menu, choose the Build LODs option. The Level of Detail Generation dialog, similar to the following, appears.

To create a new LOD point for the model, click the Add LOD button and then enter information in the LOD Edit dialog:

In this dialog, specify the LOD by distance and the percentage of model triangles to keep. The distance is the threshold for the LOD being created. In the game when the view camera is that distance from the object, the new detail level (the lower-polygon mesh) is used to render the model. The LOD operation affects the whole model, but the user can change how LOD affects different pieces of the model. Artists can make some important pieces stay detailed while other parts of the model become lower resolution.

To differentiate the pieces for the LOD operation, pick a piece from the Piece Weights list and a enter a value greater than one into the Piece Weights value box. The value represents the LOD priority for that piece. The larger the number, the later the piece will have LOD operations done on it. For example, if the value of one piece is three, it will take three vertex collapses before that piece's triangles start to collapse. This is useful for objects like heads or shields, where a small loss in detail can be very noticeable.

LOD 0 Reduced Triangle LOD

The images above are the result of an LOD operation. The image on the left (LOD 0) is the base model; the image on the right is the reduced triangle model. In the game, the renderer will automatically switch to the next LOD level when the distance associated with the LOD level has been reached.

## Animations

Animations are part of the model's database. There are two methods for bringing new animation into a model. The first method adds it directly to the model's own data, and the second adds it by reference. A referenced animation's data is not included in the model file. Instead, the model file refers to another file that contains the actual animation data. This is useful when several models are going to share the same set of animations. All animations that are added must have the same hierarchy as the model being worked on. ModelEdit will signal an error when there is a hierarchy mismatch.

To add an animation directly, go to the File menu and select Import. A file dialog appears with check boxes at the bottom listing the import options. Select Animations and select the file you wish to load. The animation names appear in the animation list box when loading is done. You may want to do this if you know that no other models will need the animation. For example, an octopus's animation is only ever needed by the octopus model.

To add an animation by reference, in the Child Model menu select Add Child Model. Type the file name of the child model you want to load. ModelEdit checks the .abc file to see if the two models' hierarchies are the same, and then the animations will be available within ModelEdit. When the model is saved, a reference to that file is stored in the model data.

## Editing Animations

Below the Model View panel, there are CD player-style buttons that control animation playback. Below that is the animation bar. The red vertical lines are key frames. The four buttons in the Animation Edit area manipulate the ordering of the animations in the Animations list box. The red X button deletes the animation from the model. The # button renumbers the currently selected animation, and the arrows move the animation up and down in the list box. The other two choices, User Dimensions and Translation, work in conjunction with the six thumbwheel buttons below to adjust either the size of the bounding box of the animation or the base position of the animation.

Note: To see the User Dimensions, in the Options menu select Show User Dimensions. Currently you cannot change the User Dimensions for child model animations.

In the Frame String text box, you can associate an arbitrary text string with each key frame in an animation. Use this association to indicate to the game code that a certain event has happened. This is most often used to associate a sound with an event. For example, you could associate footsteps with a "foot down" frame, gunshots with a model's "fire" frame, or a body hitting the floor with the last frames of a death animation. To add a Frame String, select a key frame by clicking on it and then type a word in the Frame String text field. When the animation runs, the frame string is sent to the game code as the tagged key frame passes.

## Animation Blending and Weighting

The LithTech animation system supports two kinds of animation blending operations, consecutive and concurrent. The engine automatically blends between all consecutive animations. Additionally, you can create a custom blend between two concurrent animations using Animation Blending Weights.

Consecutive Animation Blending LithTech blends consecutive animations together by default. At the end of one animation the engine interpolates to the next animation in 200 milliseconds. This value can be changed per animation in ModelEdit.

Concurrent Weighted Animation Blending Use ModelEdit to blend from two to four animations concurrently by specifying Weighted Animation Blending values for nodes in the animations. When the game programmer sets up concurrent animations for the models in the game code, the Weighted Animation Blending can be swapped dynamically to produce new custom animations from existing animations.

### Using Weighted Animation Blending

To specify Weighted Animation Blending, open the ModelEdit Model menu and select Edit Weighted Animation Blending. The Weighted Animation Blending dialog box displays the available weight sets, a list of the model's nodes, and buttons to add or remove weight sets. Under the Nodes list is a Current Node Weight text box showing the value of the currently selected nodes. All nodes belong to the weight sets, and for each weight set the nodes can be weighted differently. For example, an upperbody weight set might have all the nodes belonging to the hips and above set to have a weight of one, while the nodes in a lowerbody weight set would have all the node's weights below the hips set to one and all the nodes above the hip node set to zero.

Creating a Weight Set

1. In the Model menu, select the Edit Weighted Animation Blending option.

2. In the Weighted Animation Blending dialog box, click Add Set.

3. In the New Weight Set dialog box, type a name for the new weight set you are creating and then click OK.

4. In the Weighted Animation Blending dialog box, select the new weight set you created.

5. In the Nodes list, select one or more nodes and then enter a new value in the Current Node Weight text box.

6. When you finish assigning weights to the nodes for the weight set, click Close.

Creating a Weighted Animation Blending

1. In the Animations list, click to select the first animation. Notice that the selected animation appears in the Animation Keyframes area.

2. Press and hold CTRL while you select a second animation. The second animation appears in the Animation Keyframes area, below the first animation.

3. In the Animation Keyframes area, click the button that displays the name of the first animation.

4. In the Select Animation Blending Weight Set dialog box, click the name of the weight set you created and then click OK.

5. Repeat steps 3 and 4 for each animation.

6. Click the Play button to see the results of your Weighted Animation Blending.

The order in which the animations are selected makes a difference. The animations linearly interpolate (LERP) per frame from the first to the next using the node's weight value. The formula is the resulting animation equals the first animation plus the difference between the first and the second animation times the second animation's weight value.

RES = FIRST + ((SECOND - FIRST) * SECOND's WEIGHT)

Be aware that when you blend more than two animations, this algorithm is recursive: the result from the previous evaluation becomes the FIRST value, and the SECOND parameter is the next animation in the list that has yet to be evaluated. For example, LERP (LERP (first, second, second-weight), third, third-weight) and so on.

The value of weight can be any numerical value. Typically, you will use values between 0 and 1 since 0 means no change and 1 gives full value to the second node.

If the weight set value is 2, the algorithm will simply add the two animations together. This can also be used to great effect. Generally the added animation should just modify the first, a walk and a run added together would result in a very strange animation.

To add concurrent animations to a model in game code use ILTModel::AddTracker. Be sure there is an Anim Blending Weight set associated with the second animation added in this fashion.

Because of the nature of the algorithm, getting things to look the way you want could be tricky, so as you experiment with various animations, try to make concurrent animations as similar to each other as possible. For example if you want to accentuate a walk, make sure the foot plants occur on the same key frame. If you are doing upper-lower body animations, have the weights at the fusion points ramp from one animation weight set to the other. With enough experimentation, you will develop good intuition as to what works.

## Sockets

Sockets are places in models where you can add attachments. Attachments are sub-models that do not deform with the main model. Also, attachments can be changed dynamically in the game. Usually attachments are guns, hats, and sometimes even armor pieces. The socket or attachment sites are normal transformations that are manipulated in the Transform Edit control or from the Sockets list.

To add a socket, from the nodes list pick a node where you want to create a socket. In the Sockets menu, select Add Socket. A socket will appear in the Sockets list. Double-click its name to open the Socket Properties dialog.

You can either browse for or type the name of the .abc file to add as an attachment. You can also change the socket's name, or explicitly change its position and orientation. The attachment .abc file will be kept in the model's data as a reference that can be changed during the game. This allows you to switch models on a socket while the game is going. For example, if a player picks up new power-ups, armor, or even clothing, you can add to it and modify it during the game.

### Child Model

Child Model is a term we use to describe animations that are shared across multiple models. A child model is a reference to another data file that contains animations to be used. The only constraint to this construct is that the child model's skeleton has to be organized exactly like the skeleton of the currently loaded model. ModelEdit will signify that an error has occurred if the child model skeleton is not the same as the base model.

# Creating Models

This is broad overview of modeling for LithTech. This chapter will cover model creation as it pertains to LithTech in a very abstract terms.

Creating models for LithTech is conceptually pretty straightforward: First, use a modeling package to create a polygonal mesh model and "skin" it over a bone hierarchy. Skinning involves weighting each vertex of the mesh to one or more bones. Afterwards, select a texture for the model, apply UV texture coordinates to it, and animate its bones. The resulting model is ready to export.

The geometric center of the model should be at the origin. For human character models, for example, this would be the pelvis. The model can be made up of one or more meshes. Generally, splitting up models helps make UV mapping easier and can create reusable parts such as hands, feet and so on. The UV mapping of a model has to be done in the modeling package.

All textures in LithTech are 32-bit by default and their size must be a power of 2.

Textures and material values are not explicitly assigned in the modeler, except for UVW Mapping. LithTech uses a special mesh naming convention to associate a texture index to a mesh in the engine. This index will later be used in either game code or DEdit to assign a texture name to the models. The mesh name should take the form meshname_zTex#. The "#" represents the texture index and "_zTex" is the key that must be in the name. For example, a piece named "lower_body_zTex0" will be assigned texture map index 0, while "head_zTex1" will have index 1. Texture indexes correspond to the indexes on your model's different meshes. This way, the game programmer or the level designer controls explicit texture assignment for each mesh in a model. For the current release, there can be only two texture maps per model.

All surface material properties defined in the modeling package are ignored in the exporter. Vertex colors, lighting etc are lost in the conversion, except for UVW Mapping.

Use DEdit to convert images into the DTX format required for the game. DEdit can understand and import .PCX or .TGA files. The advantage to using a .TGA file is that since Targa files have a built-in alpha channel, DEdit can automatically generate an alpha mask for the texture without the need to import a second file as your alpha mask. .PCX files require a second file for their alpha mask, adding a second step and a second file to keep track of.

If you want models to share animations, then all models sharing a set of animations should have the exact same hierarchy. This is very important. Differently organized hierarchies cannot share animations. The skeleton offsets should be similar, but do not have to be exact. There are problems using animation from a short character on a tall character, but most things like walks, runs, and general hand movement work fine. The biggest problem is two characters with different shoulder/arm proportions sharing an animation that requires using two hands together, like holding a rifle, or even something like clapping hands. This will almost never work right, but LithTech supports overriding a shared animation on a per-character basis, so it can be worked around. Remember that you cannot scale bones.

An important concept to remember about the .abc file format is that it is a database that contains the model's geometry, bone hierarchy, level of detail information, and mode. The model database can refer to other files, especially if many models share the same set of animations.

All of the models in NOLF were created to be exported from Softimage 3.7 using our Softimage exporter.

# ModelEdit UI Reference

### File Menu

Open: Opens a model (.ABC)

Import: Reads data from a model (.abc) into the current open model, such as new animations.

Save: Saves the model

Save As: Saves the model under a different filename

Exit: Quits ModelEdit

### Model Menu

Model Info: Shows information about the model such as the amount of memory it uses and the number of triangles it contains.

Command String: Allows control over attributes of the model; See below for details.

Build LOD: Generates LOD information

Rename Node: Renames a node

Generate Vertex Normals: Recalculates the vertex normals based on neighboring polygons

Remove Node: Deletes the selected node

Set Texture: Changes the texture to be displayed on the model in the display window

Set Internal Radius: Sets the radius of the visibility-culling sphere.

Calc Internal Radius: Automatically sets internal radius based on all the animations used by the model. (Use this instead of 'Set Internal Radius for greater accuracy.)

Edit Weights: Dialog creating weight sets of nodes for animation blending.

### Animation Menu

Rename: Renames the selected animation

Duplicate: Makes a copy of the selected animation

Dimensions: Changes the dimensions of the selected animation

Reverse: Reverses the time direction of the selected animation

Make Continuous: Causes the selected animation to loop. This adds a length of time at the end of an animation so that it can interpolate back to the first keyframe.

Set Animation Rate: Changes the overall frame rate of the selected animation (or all animations) This does not directly set the animation's frame rate, but instead sets the number of stored keyframes per second. The engine then linearly interpolates to fill in the gaps.

Set Animation Length: Scales the length of the entire animation, making it faster or slower.

Set Animation Interpolation: Creates a dialog to set the interpolation time (in micro seconds) between two animations.

Create Single Frame: Creates a single-frame animation containing the current frame

Translation: Adds a translation to the selected animation

Rotate: Rotates the selected animation

### Child Model Menu

Add Child Model: Adds a new child model. Any .abc file with an identical hierarchy to the current model can be used as its child model.

Remove Child Model: Removes the selected child model

### Sockets Menu

Sockets are transforms for attachments.

Add Socket: Adds a new socket

Remove Socket: Removes the selected socket

Rename Socket: Renames the selected socket

### Piece Menu

Piece Info: Changes material attributes of the piece. The texture index can be changed and the specular attributes of the piece. The specular power represents the size of the reflected light on the surface of the model. The larger the power the larger the light source. The scale attributes represent how matte the surface is. With a value close 0.5 the surface will not reflect very well, but with a value of 1.0 the surface will look very smooth and shiny. ModelEdit will not show the specular highlight, only the engine will.

Merge Pieces: Select a group of pieces in the piece window and use this to combine them into one piece, based on texture map. If you select all the pieces, the result will be 1 piece for each texture map the model uses. Due to some bugs, don't use this on models with LODs. This is mostly very useful for prop objects which contain lots of pieces.

### Options Menu

Lights Follow Camera: When toggled, the red/blue lights move along with the camera

Wireframe: Toggles wireframe rendering mode

Show User Dimensions: Draws a box that shows the size of the selected animation's dimensions graphically. User dimensions define the bounding shape around models for physics.

Show Internal Dimensions: Draws a box the size of the model's dimensions. The internal dimensions are used to determine the clipping state of a model. *The internal dimensions should always contain all of the model geometry as efficiently as possible.

Show Skeleton: Draws the location of the nodes in the model

Show Sockets: Draws the position and orientation of the sockets

Show Attachments: Draws the attached models in relation to their socket (See Command String/SocketModel)

Solid Attachments: Toggles Solid/wireframe mode for any attached models

Show Normals: Draws the vertex normals

Show NormalRef: If supported by the model, displays the vertex normal frame of reference

Profile: Shows performance information in the draw window

New Background Color: Change the color of the model view window.

Change Field of View: Change the camera angle in the model view window.

### Model View Window

Mouse motion changes the camera position.

Left mouse rotates the camera around the model.

Right mouse dollies the camera in and out.

Right and left mouse combined pans the camera.

Shift left mouse restores the view.

### The Animation Bar

Click to move to the nearest key frame, represented by red lines. Double-click to tag a key frame. Right-click on a frame to see a context menu for the frame.

Frame Time: Allows skipping to a given time in the animation

Frame String: Assigns a control string to the specified time in the animation

LOD slider: Changes the displayed LOD of the model

### Animation Edit

User Dimensions radio button:When selected, the +/- buttons control the size of the animation's dimensions

Translation radio button:When selected, the +/- buttons control the translation of the animation

X Deletes the animation

#Moves the animation to an index in the list

Up arrow:Moves the animation up in the list

Down arrow:Moves the animation down in the list

### Transform Edit

Global: Toggles whether adjustments are node-relative or global

Socket: Specifies that sockets will be adjusted by the adjustment color boxes

Relation: Specifies that nodes will be adjusted

Rotation: Click on the color (Red = X, Green = Y, Blue = Z) and drag left/right to rotate around that axis

Translation: Click on the color and drag left/right to move along that axis

### Nodes

If a node name has a check in its check box, the node will be placed relative to its parent, only the rotation will be used from the animation data. Not checking these where needed will cause bone lengths to be transferred from a child model to the parent, causing potentially strange looking scaling of a character

### Animations

A checkbox here indicates that an animation is from this model and may therefore be changed/moved/etc.

### Command String

The command string is a semicolon-delimited string defining the extra control settings for a model in ModelEdit, the engine, and in the final game. Most commands are game specific.

These are commands not ignored by ModelEdit:

Note: A model containing SocketModel directives will cause the attachment model filenames to be stored in the Windows registry, to avoid requiring every model to redefine common attachments.

ModelEditTexture: Specifies a texture filename to use for a texture channel. The command is specified in the form ModelEditTexture Channel Filename. (e.g. ModelEditTexture 0 C:\models\textures\player.dtx)

# Setting up a Character

The steps below will walk through the character creation process for No One Lives Forever. All the characters in NOLF were created in Softimage. This is the only package for which we have a reliable NOLF exporter.

1. All the characters in NOLF have the same skeletal hierarchy. This allows animations to be universally shared. Another guideline for sharing animations is to keep their height within a range of about 15%. Having extra tall or short characters will cause strange floating when using a shared animation.
2. If exporters become available for other animation/modeling packages, the exported skeleton will still need to match the existing NOLF skeleton in order to share animations. This will require some trial and error experimentation.
3. If you'd rather use a different skeleton (like for a ponytail...) then you will need to redo all of the animations used by that character. The file 'basemodel.abc' contains all of the animations used in single player NOLF (not including cutscenes). There are roughly 300 of them.
4. All characters used in NOLF were modeled using 1000-1500 triangles.
5. All texture mapping for NOLF was done in Softimage. Each character uses two texture maps: a 256x256 map for the body and a 128x128 one for the head. These should be saved as 32 bit .tga files. They are converted in DEdit to .dtx files by going to the textures tab and importing the .tga files to nolf/chars/skins/.
6. Any piece of model geometry that uses the head texture should be named with the extension '_zTex1', for example head_zTex1. If you don't do this, the head will default to the body texture.
7. When the skeleton is set up, use a node called 'Eyelid' to control vertices that allow blinking. It is important to name this bone correctly since the game code uses this node to tell what a character is looking at.
8. Any model that is going to use the NOLF AI needs to be named in the same form as the characters that shipped with NOLF, such ashero_casual.abc. There is no comprehensive list of appropriate character names, but looking at the file /nolf/ attributes/modelbutes.txt should point you in the right direction.
9. Textures should be named in the same form as the models. Head textures need the extension '_head', for example hero_casual.dtx, hero_casual_head.dtx.
10. In addition, DEdit contains a 'body skin extension' and 'head skin extension' that allows any extension to be added to the body name or replace '_head' in the head name.
11. Characters should be exported to the folder nolf/chars/models.
12. After exporting a character, ModelEdit must be used to add several attributes including sockets, weight sets, LODs, user dims, and internal dims. Most of these can be imported from within. Just select File, then Import and select a similar character file, and then check the items you want to import.
13. There are specific sockets which NOLF looks for that appear on all the NOLF characters. The best way to figure these out is to look at an existing character. The way they are named is self explanatory. To create an individual socket, select the desired node and go to sockets>Add Socket. Name it so you know what it is.
14. Sockets are used to place attachments (such as guns, hats...) on characters. Select Options>Show Attachments and >Show Attachments. A multi colored axis will appear at each socket location. Double click on a socket name in the sockets window (like "right hand"). Browse to the location of attachment abc file and open it. Adjust its position and rotation using the colored buttons in the Transform Edit box, making sure 'socket' is selected first. Any model can be used as an attachment.
15. NOLF characters use a lot of weight sets (109) to allow morphing animations for up and down aims with guns and also for blending upper and lower body animations. These can be created individually, but it's a lot easier to just import them from an existing character. If you change skeletons, these will not import properly and will need to be created from scratch.
16. All NOLF characters have 4 levels of detail (LODs). These can often be imported from existing characters, but only from a character that has the same number of pieces. If your new character has more or less pieces than any of the existing NOLF characters, you can still look at the LOD values of the existing characters and manually copy the values onto the new character.
17. User dims for all characters in NOLF are the same: X: 24, Y: 53, Z: 24. The actual dims are double these values that you enter. Not setting dims results in a very long bounding box that will remind you that you didn't set them. All animations that come from a child model will use the dims from the child model.
18. In Model>Command String, enter the following: ShadowEnable;ShadowSizeX 32;ShadowSizeY 24;ModelShadowAlpha 2;NormalRef Right_armu_shoulder_node 3StGd This is the command string on all the NOLF characters. It defines a source from which the model will be lit by model lights.
19. Another thing that must usually be done is to turn off the translation information from child models on most of the bones. This is done by checking the box next to each node name in the nodes window, except the first three. The top three should be left blank, since this is where all the translation takes place. Not doing this may result in strangely stretched or squished characters.
20. All of the above steps are valid for both single and multi player characters. However, multiplayer characters use different animations than the single player ones and thus must be duplicated at this point. Place the copy in /nolf/chars/models/multi and add the extension '_multi' to the filename, like the existing files in that folder.
21. To finish setting up the multiplayer character, each one needs two of the child models in that folder. First is deathbase.abc, which contains all the death animations as well as a few other universal animations. The second is multibase.abc, fembase.abc, or fatbase.abc. These are three versions of the same thing and are used depending on the size of the frame of each character. These two child models must be added in this order to maintain consistency across a server.
22. After adding these animations, the internal radius must be set, and is most easily done by going to Model>Calc Internal Radius. This is a rendering optimization that must be done.
23. Single player characters all use 'basemodel.abc' as a child model. The player models must also use playerbase.abc, which is equivalent to the multiplayer fembase.abc. Additionally, female characters have a different fembase.abc as a child model that contains override animations for a feminine walk, run, etc.
24. Any animation that is used by game code can be overridden by adding a '+' sign to the beginning of the animation name. Any animation that is named with some obscure code probably falls into this category. Some animations are scripted (called by the level designer rather than the program) and cannot be overridden, but must be either renamed or replaced on the desired character. An example of lots of override animations is on WinterGuard_action.abc, where there is an override for all the pistol animations so that his (or her) hands meet when they shoot.
25. Any model can be used as an attachment, but they cannot be animated themselves without specifically being called by the game code. To use an attachment in the game, update the file nolf/attributes/attachments.txt. Copy and paste any attachment section to the end of the attachment list. Change the number and name to be appropriate for your new attachment. Also change the file paths to point to your attachment file and texture. These can be named however you want, and it's best to keep them in the nolf/attachments/models/ and skins/ folder. The attachment must now be added to the character in DEdit.
26. All NOLF guns go in the right hand. All hats go on the head socket. All glasses go on the eyes socket.
27. Frame strings are added to provide animation based cues to the game code. For characters, the ones used are 'NOISE' for death sounds, 'FOOTSTEP_KEY 1' for the right footstep, and 'FOOTSTEP_KEY 2' for the left footstep. These are entered by going to the frame of animation where the incident occurs and typing the appropriate string in the Frame String box. These should usually be placed on the child models when possible so many characters can use them.
28. The simple animation editing features of ModelEdit can only be used on animations which are native to a model (not from a child model) and are pretty effectively described in the documentation below, with a couple of clarifications.
29. Use Animation>Set Animation Length to speed up or slow down an animation.
30. Use Animation>Set Animation Rate to get rid of frames in a really dense animation. This is mostly useful when dealing with motion capture which is at 30 frames/sec. Most animations look fine at 8-10 frames/sec using the linear interpolation of the engine.
31. Animation>Make Continuous is an easy way to get good cycling animations in some cases. Select an animation and delete the last couple of frames making a note of how much time is being cut by doing this. Then go to Make Continuous and enter the time that was noted above. This may need to be tweaked a little, but on animations that don't have a lot of action, usually this will give a good cycle.

# Setting up a Player View (PV) Weapon

The player view (PV) hand guns, gadgets and vehicles for No One Lives Forever were modeled, UV textured and animated in Softimage. Each weapon PV model was exported from Softimage to an .abc file and could then be opened in ModelEdit for final additions needed for the game code as well as tweaks to the animations. The final thing needed to get player view weapons to work properly in the game are the attributes for the weapons that are outlined in the weapons.txt and the effects defined in the fx.txt.

## Modeling

The PV weapon/gadget/vehicle models in NOLF are somewhere between 1400 - 1800 triangles including the hand models (the hands are about 450 triangles each.)

## Texturing

Each PV weapon/gadget/vehicle has two textures associated with it:

1. The hand texture which is used is based on the model style; actionhands_pv.dtx is used with the player_action.abc.

2. The weapon/gadget/vehicle texture. The weapons.txt directs the game to the appropriate texture for this. An example would be: PVSkin = "Guns\Skins_PV\Contender_pv.dtx"

Each texture is 256x256. These should be saved as 32 bit .tga files and converted in DEdit to .dtx files by going to the textures tab and importing the tga files to nolf/guns/skins_pv/.

Chrome/environment mapping can be used on the texture using the alpha channel. In Dedit, in Textures/guns/skins_pv, double click on the texture and a new window will appear. Under Texture Format, check off Use 4444 in 16 bit mode. Darker values will use more chrome.

## Animating

The exporters will keep the translation and rotation information but not the scaling. It is a good idea to keyframe at least one piece or null object for every frame of the entire animation because fcurve information is not something retained when exporting (the engine will interpolate between keyframes linearly) and the exporter will only export a key for every keyframe in the scene.

· Note: Some parts of the animations, such as the vehicle turning and the motorcycle tachometer and speedometer, are implemented in the game code.

## Exporting

In order for all of the geometry to be exported properly, all the pieces of the model and skeleton need to be part of the same hierarchy. Models should be exported to the folder nolf/guns/models_pv.

## Animation Naming

The animations for the weapons need to be very specific for the weapons to function properly in the game. Here is a list of the animation names and when this animation plays in the game:

· Idle_0: Idle animation played when the object is not being selected, deselected or interacted with in any way. (all NOLF weapons/gadgets had Idle_1 and Idle_2 animations as well which would play sporadically when idling.)

· Select: the animation played when an pv object is selected

· Fire: the firing animation. Fire1 and Fire2 are alternate animations that will play at random if they are part of the .abc file (these were used for the unarmed karate chops.)

· Deselect: the deselecting animation when putting away a gun/weapon/vehicle or switching to another

· Reload: the animation played when a weapon or gadget has run out of ammo or when the reload key is hit

Those are the most basic animations that would be required. For more complicated items that have two states, such as the lighter gadget in NOLF, these additional animations are required:

· AltSelect: switches the gadget from one state to another

· AltIdle_0: idle animation for the gadget in it's second state

· AltFire: the fire animation used in the alternate state of the gadget

· AltDeselect: this animation serves as the reload for the alternate gadget function

· AltSelect2: switches the gadget state back to the default state

## Using ModelEdit with PV Items

After you export a PV weapon/gadget/vehicle, use ModelEdit to add attributes, such as user dims, internal dims, sockets, command strings, and frame strings.

#### User Dims

User dims for all weapons in NOLF are the same: X: 1.5, Y: 2, Z: 1.5. Because the models are so small, these dimensions do not need to be exact but not setting dims results in a very long bounding box that will remind you that you didn't set them.

#### Internal Dims

The internal radius must be set, and is most easily done using the Model menu Calc Internal Radius command. This is a rendering optimization that must be done.

#### Sockets

Sockets are used to place attachments on guns for mods like the silencer and scope. To see how sockets are used, open a NOLF gun and go to the Select Options menu. Click Show Attachments and Show Attachments again. A multi colored axis will appear at each socket location. Double click on a socket name in the sockets window. Browse to the location of attachment .abc file and open it. Select Socket and then adjust its position and rotation using the colored buttons in the Transform Edit box. Any model can be used as an attachment.

#### Command Strings

The PV models all use to command strings to set the model FOV and to set how the model will be lit by model lights placed in DEdit. An example would be one of the lipstick gadgets which has this command string: FovXOffset 20;FovYOffset 50;NormalRef lsmiddle Select. The NormalRef command string has the name of a piece of the model that handles the model lighting well.

#### Frame Strings

Frame strings are added to provide animation based cues to the game code. For weapons, the ones used are FIRE_KEY for the firing sound and creation of projectiles or sending out a fire vector depending on the weapon, SOUND_KEY # for any sounds played with other animations (selecting, deselecting, reloading, etc.) and FX_KEY for any effects that are turned on or off during animations (the light on the lipstick bomb gadgets for example.) These are entered by going to the frame of animation where the incident occurs and typing the appropriate string in the Frame String box.

### WEAPONS.TXT Defines All Weapon Properties

The weapons.txt file found in the attributes file defines all weapon and ammo properties: interface artwork, model, skin, position, and much more. For a better explanation, look at the weapons.txt for examples (the weapons.txt also has a brief description for what everything does.)

### FX.TXT Defines All Special Effects

The fx.txt file found in the attributes file defines all weapon effect properties: impact effects, muzzle flashes, and other effects like the flame on the lighter. For a better explanation, look at the fx.txt for examples (the weapons.txt also has a brief description for what everything does.)

## Positioning PV Models

The PV models are positioned in the engine by using the mppos command when you hit the key that has been mapped for 'talk.' From there you can manipulate the model position by using the move keys. When the model is in the desired position use the 'mppos' command again and the position for that specific model will be saved to the weapons.txt file.