UDN
Search public documentation
CreatingAnimations
Creating Animations for the Unreal Engine
Document Summary: A description of the content pipeline for getting animations into the Unreal Engine. Document Changelog: Created by Scott Dossett and Jay Hosfelt; maintained by Richard Nalezynski.Overview
This document will serve as a starting point for identifying the different types of art assets that are used in animation creation for the Unreal Engine content pipeline.Development Tools
ActorX
All skeletal characters and animations must be exported from your 3D package and imported into the Unreal Editor through ActorX. See the ActorX page for download information.Characters
Character Setup and Rigging
Character models should be created in a fairly neutral pose, usually in a “T-Pose”, but it is okay to pose the joints in a relaxed, natural position. The bone structure should be a single hierarchy of bones, mimicking the human skeleton, posed to fit within the character mesh, and parented under a main “root” bone placed at the origin. Although the Editor can import skeletal meshes created with the Y-Up axis orientation, we prefer to work with Z-Up in all 3D Packages. This makes things consistent across the board and allows us to transfer meshes and animations between Max and Maya with no axis issues. With Z-Up being the standard, the characters should be modeled and rigged facing down the +Y axis in Max, or the –Y axis in Maya. (This axis is flipped between the two packages). In the Editor we apply a rotation offset to the characters to make them face the +X axis in the Editor.- The maximum number of mesh-influencing bones in a skeleton is 75.
- The maximum number of total bones in a skeleton is 256.
- For the mesh, the maximum number of bone influences per vertex is 4. (Upon import, any vertex that is influenced by more than 4 bones will have its lowest influences removed and normalized among the remaining 4 influences for that vertex.) Note that there is a cost based on the max you use for a particular LOD. So if you can get away with using no more than 3, it will be faster. We generally try and use just 1 for LOD 1 and below.
Bones Hierarchy
Having a root bone separate of the pelvis is important. It doesn't matter that much where it is, although it may make things a bit more complicated for certain things. We find it easier to make sure animations will work together when the root is at the feet and origin. If it's somewhere up in the air, it's harder to detect when animations won't chain/blend properly and create a visible pop. For example, when doing root motion animations where Marcus climbs up something, it is easier to visualize where the root bone should be put because it should be where his feet are going to be touching the ground. For IK, we use IK Bones for the feet and hands, direct children of the root bone. This eliminates position/rotation errors when blending animations with a long bone hierarchy. Depending on the animations involved, the location of weapon bones in the hierarchy always has pros and cons. Most of the time our characters are holding guns so it makes sense for them to be children of the hand since no matter how heavily we compress the animations or how low of a framerate we animate at, the gun will maintain a solid position in the hands. The disadvantage is when weapons have to leave the hand. During certain reload animations like the sniper rifle, or when holstering the gun, you might get a lot of fighting between the bones and need to have a higher framerate so it isn't noticeable. Since those types of animations are rare in our case, we decided that having them as children of the hands would give us the best memory savings. If we were animating a bunch of melee weapons where they are constantly spinning them around or something, we would have have chosen to put the weapon bones higher in the hierarchy, maybe even as children of the root. The weapon end bones were a put in as a way to change the pivot points of the guns to the center, but still have all of the animations look correct without having to change the weapon bone position in all the animations and then re-export them. There are some minor rig advantages with animating, but it would be better not to have them at all. It was a change that had to happen when we finished how mirroring animations worked without much time to get it implemented. It can be useful to reduce foot sliding. When you blend 2+ animations with a long hierarchy of bones you may get some errors; IK on the feet was a way to ensure the feet would remain at the right place. This was quite noticeable in directional blends. We did keep it on for much larger creatures, like the Brumak boss fight in Gears of War (PC). The armroll bones - direct children of the upper arm bones - are there just to twist half the amount of the upperarm bone to help the verts deform better. This works better in-game than having roll bones going straight down the arm in the hierarchy, so that way we can still have a two jointed arm for working with IK.Character Export
Once the character mesh is bound to the skeleton and properly weighted in your 3D package, it can be exported as a PSK file using ActorX. If there are extra bones or weighted meshes in the scene that you do not wish to export, you must either remove them from the scene, or (in Maya only) you can rename individual bones with the postfix _noexport, or rename the topmost hierarchy bone with the postfix _ignore.Character Import and Setup
With the Unreal Editor open, in the Asset Browser, open the package you wish to import your character into. Right-click on the… (to be continued).Weapons
First Person Weapon Setup and Rigging
1st Person weapons are the weapons you see yourself holding in-game. Since they are placed very close to the player's view, and are usually in the view a majority of the time, the models are usually much higher poly, and have much higher resolution textures on them. Tip: Since the 1st person weapon is usually only seen from one side, the model can be optimized by removing any polygons or objects that are never seen by the viewer (usually on the front/right side of the model.). Only optimize the model after the final animations are complete, so you know which parts are never seen. In your 3D package, place a camera at the origin and align it down the +X axis. This will represent the in-game view of the player. Position the 1st person weapon mesh in front of this camera view as it would be seen in-game. Adjust the camera FOV and mesh position to get the desired look. Technical note: The 1st person models are displayed with a different rendering pass, so view offsets and FOV changes can be made that only affect the 1st person objects without affecting the entire scene view. Work with a programmer to adjust the FOV, view offset, and clipping planes for 1st person items. The first major decision when setting up 1st person weapons is whether you will be able to see your own arms. The decision to have 1st person arms in view can add levels of complexity to the setup. On top of that, the decision to have multiple types of arms (male, female, robotic, creature, etc) with each weapon, adds yet another level of complexity.Tweaking in the Engine
It’s best to work with a programmer to get the 1st person weapons and arms working in game with the correct camera FOV, loading the correct arm mesh variant, and get the weapon and arm animations synchronized. Since the animations were based on the origin of the scene, no offset should be needed to get them in view. You can either apply offsets to the mesh, or a programmer can hard-code offsets if they need some slight tweaking.Third Person Weapon Setup and Rigging
3rd person weapons are the weapons you see other characters holding. To setup a 3rd person weapon model, it should first be bound to its own small hierarchy of bones and exported as a skeletal mesh. The weapon’s “root” bone should be positioned so that when it is constrained to the character’s “weapon” bone, the weapon lines up properly in the character’s hands. In your 3D package, animate the character and weapon together in the same scene with the weapon’s “root” bone constrained to the character’s “weapon” bone. You will eventually export out two separate but synchronized animations. One for the weapon and one for the character.Weapon Export
Open your "Export Ready" file containing the baked animations for the weapon and the character. Delete the character skeleton and mesh from the scene, and export the weapon animation as a PSA file. Reopen the “ExportReady” file with both skeletons, and this time delete the weapon skeleton and mesh. Export the character animation with the same animation name and frame-range, but into a different PSA file.Weapon Import
In the Unreal Editor, import the character’s PSA into the character’s AnimSet, and import the weapon’s PSA into the weapon AnimSet.Tweaking in the Engine
Work with a programmer to constrain the weapon skeletal mesh to the character’s “weapon” bone during gameplay. This may require the creation of a Socket onto the character’s “weapon” bone. When the animation is then played on both the character and weapon, they should be synchronized.Morph Targets
Morph Target Setup
Morph Targets (also known as Blend Shapes) are used to change the shape of a mesh, or part of a mesh by offsetting a group of vertices. This vertex deformation can be a good alternative when bone deformation will not suffice. Morph Targets can have many applications, including facial animation, muscle simulation, or even vehicle damage.Morph Target Export
For use in the editor, Morph Targets are exported as individual PSK files (The same files used to export skeletal meshes) and imported in the Unreal Editor onto a previously imported skeletal mesh. If you have 20 morphs for a particular mesh, you will need to export 20 PSK files. In your 3D package, target all morphs onto the same mesh. With this target mesh selected, turn on the first morph and export the target mesh as a .PSK file using the ActorX exporter. Turn off the first morph and then turn on the next one, and export out that same target mesh as another .PSK. Repeat this until each morph is exported into individual .PSK files. Morph Note: All morphs should be exported from, and imported into, the same mesh to ensure that the vertex order remains the same. Importing a morph onto a mesh with a different vertex order will most likely cause problems. Be sure not to move the mesh, or change the skeletal bind pose when exporting each morph. Re-importing the source skeletal mesh can also cause vertex order problems and may require re-importing the morph targets.Morph Target Import and Setup in the Editor
To import and setup morph targets in the Unreal Editor, you must create a MorphTargetSet Asset. Then import your PSKs into that MorphTargetSet to create a list of morphs. Then attach the morph list to your skeletal mesh in the Animtree. At that point, a programmer can access and apply the morphs, or they can be applied and modified in Matinee. To create a MorphSet asset, double click on the skeletal mesh you wish to apply the morphs to. This will open the Animset Editor. In the Animset Editor, select the menu item File -> NewMorphTargetSet. Enter the Package, Group, and Name of the new MorphTargetSet asset you would like to create. Click on the "Morph" tab at the top of the Browser section of the Animset Editor. Your new MorphTargetSet should be selected. If not, click on the drop-down menu and find your new MorphTargetSet. To import your PSK files into the morph list, select the menu item File -> Import MorphTarget. Select your list of PSKs (you can shift select multiple PSK files), and click on "OK". Each morph will bring up a dialog box allowing you to either double-check or change the name of the morph. Morphs for high polygon meshes can take a while to import. After import, click on each morph in the MorphTargets list. This will preview the selected morph onto the source mesh in the 3D window, so you can verify that they imported correctly. Technical Note: When importing new morphs, the editor compares vertices, in vertex order, between the imported PSK and the source skeletal mesh, and finds the ones where the positions have changed, and only saves data for the vertices that have moved. To connect the morph targets to your skeletal mesh, open the Animtree for your mesh. This will open the Animtree Editor window. In the Animtree Editor select the Animtree node.Faces
Vehicles
For information on setting up and rigging vehicles, please see the Setting up Vehicles page.Cameras
For information on setting up and rigging cameras, please see the Setting up Cameras page.Creatures
Editor Tools
Understanding PSKs and PSAs
When importing skeletal meshes and animations into the editor, you will be working with two file types: PSK's and PSA's A PSK file contains all the information about the skeletal mesh, including the mesh itself, material numbers, edge smoothing, bone hierarchy, bone position and orientation at the bind pose, as well as the vertex weighting information. It contains no animation info. When imported into the editor, this will create a mesh weighted to a hierarchy of bones. The mesh will be exported in the pose that it was in at the beginning of the timeline of your 3D package, and in the Editor, this will be its Bind Pose. A PSA file contains a list of animations. These animations contain bone position and orientation data over a range of time. This data is relative to its parent bone, so if the hierarchy changes, animations may have to be re-exported. When imported into the editor, this will add the list of animations into an Animset, containing its own list of bone tracks, and position and rotation data for those tracks. PSA Note: Keep in mind that this list of bone tracks is completely independent of the bones in the skeletal mesh it is linked to, and will only apply animation to the skeletal mesh bones that match the animset's track list. Bones can be added to the track list by importing an animation containing the extra bones. Bones can be removed from the track list by selecting the "Delete tracks" menu item in the animation browser. Deleting tracks from an animset will not add or remove bones from any skeletal mesh. Linking an animset to a different skeletal mesh will not change the animset's track list of bones.Content Import and Setup in the Editor
To import your PSK file into the Unreal Editor, you must first open the Asset Browser, and load the package you wish to import your character into. Right click on the package in the list, and choose "Import..." Select your PSK file, and click "Open" In the import dialog box that opens, verify the package name is the correct one. Typing a new, unused name in this field will create a new package upon import. You can also add a name to the "Group" field, if you wish to add a new sub group, or import into an existing sub group. In the "Name" field, verify that the name is correct. By default, it will use the name of the PSK file. Type the name of an existing skeletal mesh to overwrite it. If you are using Y-Up in Maya, you can check on the "bAssumeMayaCoordinates" box, and this will apply offsets to reorient the mesh to look correct in the Editor. Click "OK", and this will create a new skeletal mesh in the package. High polygon meshes may take a while to import. To view and edit this mesh, double click on it. This will open the Animset Editor window. This window is used to modify animsets, skeletal meshes and morph targets.Animation Set Editor
The Animset Editor Window is used to view and modify animsets, skeletal meshes and morph targets.Browser: for listing and selecting meshes, animations, or morphs.
Skeleton Tree: for viewing the hierarchy and hiding bones in the 3D view
Properties: for modifying settings for meshes, animations, or morphs.
3D View: for viewing meshes, animations, and morphs
Time Slider: for playing and pausing animations, and viewing animnotifies In the 3D view, use the left mouse button to orbit the view around your mesh. The right button moves your view closer and farther away, and the middle mouse button pans your view to the left, right, up or down. Holding the "L" key while dragging in the 3D window, will allow you to move the light. General buttons:
- Show Skeleton
- This displays the bones structure in the 3D window, overlaid over the mesh. With this turned on, you can show and hide certain bones by right clicking on them in the Skeleton Tree section.
- Show Bone Names
- This displays the names of each bone in the 3D window.
- Show Wireframe
- This toggles between wireframe view and shaded view
- Show Reference Pose
- This will force the skeletal mesh into its bind pose (the pose it was imported in).
- Show Mirror
- This will mirror the animation along the XZ plane. It is for preview only. It does not actually modify the animation.
- Socket Manager
- This opens the Socket Manager window allowing you to add Sockets to bones. Sockets are use to attach items such as weapons or particles. Sockets can be offset from the bone if needed.
- New Notify
- This adds an AnimNotify to the timeline of the selected animation. Animnotifies are points in the timeline that can trigger an event, such as a sound, a particle, attachment swap, or any number of things that a programmer can hook up.
- Toggle Cloth
- This allows you to view vertex cloth simulation.
- Generate Soft-Body Tetrahedron Mesh
- (?)
- Toggle Soft-Body Preview Simulation
- (?)
- Show Uncompressed Animation
- When animation compression is applied, and Show Skeleton is toggled on, this will overlay another skeleton playing uncompressed version of the selected animation. So you can visually compare the difference between the two skeletons.
- Animation Compression...
- This opens the Animation Compression window
- LOD
- This set of buttons will change the Level of Detail viewed in the 3D window. AUTO will show the LOD's as they would be displayed in game, and will change the LOD mesh depending on the viewers distance from the mesh. The current LOD level number can be seen in the top left corner of the 3D window. The B, 1, 2, 3 Buttons will force the 3D window to display that LOD level. "B" refers to Base, or LOD-0.
- Playback Speed
- This set of buttons will change the playback speed of an animation in the 3D window. But will only change the preview rate, and will not affect its play rate in game. The "RateScale" setting, which will affect the speed of the animation in-game, can be modified in the AnimSequence tab in the Properties section.
Animation Tree Editor
See the AnimTree Editor User Guide for more information.PhAT
See the Physics Editor User Guide for more information.Motion Capture
This section will discuss Epic’s particular motion capture equipment and pipeline. But keep in mind there are many types of motion capture systems on the market. Each type has its advantages and disadvantages. Use the system that will work best for you. Whatever motion capture system or pipeline you use, the final animation must be exported from a 3D Package such as Max, Maya or Softimage, using the ActorX exporter, in order to be imported into the Unreal Editor. We use a Vicon MX system (http://www.vicon.com/). This is a “Passive Optical” system which tracks reflective markers attached by Velcro to the actor. Our system has 36 cameras arranged fairly evenly throughout the room. We also record synchronized reference video at the same time. Our motion capture pipeline is as follows:- Calibrate System
- Capture the movement.
- Clean marker data with Vicon IQ or Blade.
- Target on to characters in Motionbuilder.
- Polish animation in Max or Maya.
- Import into the Unreal Editor using ActorX.
