After completing this tutorial, users will understand the various types of animation data available in CRYENGINE, and will be able to create their own animations.
- Animation File Types
- Creating a CGA Object
- Exporting an ANM File
- Exporting an I_CAF File
- Creating an FSQ
Animation File Types
An overview of the types of files and their functions can be found in the Art Asset File Types document. There are some specific things about the file types to keep in mind for exporting animations.
- CGA files can be used with two types of animations: .ANM and .I_CAF/.CAF.
- ANM animations must be created using only TCB controllers for both rotation and position tracks. They do not get compressed by RC, so it is undesirable to store baked animations with this format.
- I_CAF files are compressed into CAF files by the RC, but they add additional import step in the workflow.
- Source file needs to be located where the object will be exported.
- ANM files need to be contained in the same folder as the CGA object they were exported from and require a specific naming convention to work with them. Each additional ANM file added needs to contain the parent CGA's name as a prefix. For example:
- Vehicle_b.cga – Vehicle object(s) and default animation.
- Vehicle_b_door1_exit.anm – Animation keys stored for the door open animation when a character exits the vehicle.
- Vehicle_b_door1_enter.anm – Animation keys stored for the door open animation when a character enters the vehicle.
- Vehicle_b_door2_exit.anm etc.
- Make animation in the Digital Content Creation tool (3ds Max, Maya, Softimage).
- Export the animation using the respective exporter.
- Exported .i_caf should be imported, then they can be be processed into .caf (compressed) animation with ResourceCompiler before they get loaded in the engine.
Motivation for the Resource Compiler
- Animation data should be optimized for the in-game use.
- To support the vast amount of quality animations today's games require, an effective compression is a must.
- Each platform (PC, Xbox360, PS3) requires a different format or strategy for the optimization.
As a compiler compiles source codes into a machine-optimized format, the RC compiles raw animation data into an optimized format.
Creating a CGA Object
Tutorial for Maya
Preparing an Example Scene
You can find the example asset which is used for this tutorial here: Windmill Example File.
1. Firstly you should create some geometry optionally with physics proxies.
2. Animate your groups by creating key frames on the timeline bar where required.
3. Click the export button on the 'Crytek' toolbar to open the 'Crytek Export' dialog.
4. Click the 'Add Attributes' button.
5. From the export type drop down box select 'Animated Geometry (.CGA)' filetype.
There is currently a bug where you are forced to add a root joint when adding an animation so for as a temporary fix; create a random joint to assign as the root joint.
6. Create a new animation by clicking the 'New' button in the animation section
7. Click the 'Use Current' button to file out the name and frame information.
8. Don't specify an output file as CGA files can also contain the animation data and geometry.
9. Click the 'Add' button.
10. Ensure that the 'Do Not Merge Nodes' option is checked.
11. Click the 'Export' button on the 'Crytek Export' dialog.
Exporting the Asset
To export an ANM file do the following:
1. Animate your groups by creating key frames on the timeline bar where required.
2. Click the export button on the 'Crytek' toolbar to open the 'Crytek Export' dialog.
3. Click the 'Add Attributes' button.
4. From the export type drop down box select 'Animations for CGA (.ANM)' file type.
5. Create a new animation by clicking the 'New' button in the animation section.
6. Click the 'Use Current' button to file out the name and frame information.
7. Don't specify an output file as CGA files can also contain the animation data and geometry.
8. Click the 'Add' button.
9. Ensure that the 'Do Not Merge Nodes' option is checked.
10. Click the 'Export' button on the 'Crytek Export' dialog.
Character Animation Export
An example Maya scene with an advanced character and locomotive animation setup can be downloaded here: Chr_Animation.ma
- Animate your bones by creating key frames on the timeline bar where required.
- Click the export button on the 'Crytek' toolbar to open the 'Crytek Export' dialog.
- Click the 'Add Attributes' button.
- Create a new animation by clicking the 'New' button in the animation section
- Click the 'Use Current' button to file out the name and frame information.
- Click the 'Browse' button and select an export path for your animation file.
- Click the 'Add' button.
- Click the 'Export Anim' button on the 'Crytek Export' dialog.
Tutorial for 3DS Max
Preparing an Example Scene
In your 3D application, create a few primitives in the scene.
Change the controller types for position and rotation to TCB.
Create an animation for the objects in the scene.
Exporting the Asset
Next, select all the objects and add them to the Object Export list by clicking add selected.
The "Export File per Node" option, located just below the Export Nodes button in the group "Geometry Export Options" allows you to either bundle these three objects together in one CGA file or, when the option is checked, export three files separately.
For now uncheck this option in order to only export one file.
Next make sure that the CGA file type is selected in the Export To drop down box.
Press the Export Nodes button. This will export the objects to the same folder that the source file is located in (which should be located somewhere in your game directory).
The file will assume the source file's name unless you uncheck "Export File per Node" and check "Custom Filename". This will allow you to select a unique name for the file by pressing the 3 dots (...) and typing in the name.
This is not, however, available for exporting multiple objects at once using the export file per node option.
Previewing the Asset
To view the asset you need to open your the CRYENGINE Sandbox Editor. At the top right of the screen you will see an icon of a human, this opens the Character Editor. Alternatively it can be found in View -> Character Editor.
At the top left of the floating window is the file drop down menu. Click File -> Open and navigate to the folder you exported your .cga file to. After opening the file you should see the object(s) in the 3D view.
Each CGA file contains a default animation that is available from the animation list. Click the name Default to play the animation.
Exporting an ANM File
If you have an existing CGA file that you wish to add animations to, or have just completed the example above, this section will explain how to add those additional animations.
Start by creating a second animation for your object within your 3D program.
Navigate to the object export section of the exporter and click Custom Filename.
Click the button below with three dots (...) and type in a filename, using the name of the .cga object you are adding it to as a prefix in the name.
As an example, the test.cga file contains the object you are animating, plus the default animation. In this case you need to name your .anm file test_[?].anm, where the question mark is what you want to call the additional animation.
Press the export nodes button. If the ANM file is located in the same folder as the CGA object, the animation will now be visible in the Character Editor animation list.
Preview the object using the guidelines in the CGA export tutorial above.
Exporting an I_CAF File
An .i_caf file is a skeletal based intermediate animation file. It is usually used with a skinned mesh. A .caf file is the compressed counterpart created by the RC (it is invoked automatically within Sandbox).
Preparing a character to add new animations
In order to use animation with a character you will need to add it to the animation set of the character. The definition of the animation set is stored within the .chrparams file. Below is a basic example:
The #filepath command points to the root folder that is used to lookup animations. All animations within the subfolder will be added to the animation set.
That is also a location where we will export our .i_caf-s (intermediate character animation files).
The .chrparams file must be located in the same folder as your character and have the same name as this .chr file, except with the .chrparams file extension.
path="*\*.caf" specifies all the animations within all the subfolders (relative to animations\human\male in this example.) Alternatively animation names could be listed one by one, e.g:
When starting the editor using the above example the animation list will display one animation called run or if you replaced the names should show the name you gave the animation. Click to play it.
Setup for 3DS Max
Preparing a Scene
First create a mesh, a skeleton to deform that mesh and apply weights to it with a modifier such as Skin or Physique.
Image shows basic mesh and underlying skeleton:
Now create an animation for the skeleton. Make sure you store your default pose either as a keyed pose at frame 0 or using functions like Set Skin Pose in 3ds Max for example. Clicking the Export Bones button will create the .i_caf file.
Exporting a Fullbody Animation
Once this is done you are ready to export an animation. You can either export the entire skeleton or a part of the skeleton by selecting different bones as the root(s) to export from. Start by exporting a full body animation.
Make sure Add related bones and Add whole skeleton boxes are checked on. These functions check for the root of the character and automatically add it to the Bones export list. Select the mesh of your object and click Add Selected in the Object Export section of the exporter.
After doing this you will see the root of your hierarchy automatically added to the Export Bones list. This list only needs to store the root(s) of the chain of bones you wish to export.
Scroll down to the Bone Export area of the exporter. Notice the root bone is listed in the bone export list. Press the Export Bones button and choose a location for the animation. This should be within a path in your game folder so that the animation will successfully pass through the resource compiler. This will make sure that any compression settings you define in the CBA file (Crytek Batch Animation) are used for batch processing files.
Setup for Maya
Preparing a Scene
First create a mesh, a skeleton to deform that mesh then bind them together with a Smooth Bind. Be sure that there are no more than 4 influences used.
Now create an animation for the skeleton. Make sure you store your default pose either as a keyed pose at frame 0.
Click the export button on the 'Crytek' toolbar to open the 'Crytek Export' dialog. Then click the 'Add Attributes' button (this adds CRYENGINE related information to the assets as needed).
Exporting a Fullbody Animation
Next you will want to create a new animation by clicking the 'New' button in the animation section.
Click the 'Use Current' button to file out the name and frame information. From there you can use the 'Browse' button and select an export path for your animation file.
Click the 'Add' button.
Finish the process by clicking the 'Export Anim' button on the 'Crytek Export' dialog.
Exporting an Upperbody Animation
Exporting an upperbody animation is much the same as exporting a fullbody animation. You need to select a root of a hierarchy in the skeleton and add that to the Export Bones list manually.
Select the Bip01 Spine bone; click Clear List in the Bone Export options and then Add Selected. This will add the bone "Bip01 Spine" to the node list. You are now ready to export the animation from the Bip01 Spine bone and all of its children in the hierarchy.
Once exported, the animation will only contain the tracks for the Spine and its descendants.
Importing Animations in Sandbox
Before animation can be compressed by RC we need to specify certain settings: the skeleton that is used for animation compression and if the animation should be additive.
This can be done within the Animation Import pane in Sandbox. You can find it within the menu: Open menu View -> Open View Pane -> Animation Import.
You can select the newly exported animation in the top-left list (1). Use "Only New" option to limit the list only to newly created files.
Make sure that you have your skeleton/character in the list of the skeletons on the right and assign it by double clicking on it (2).
You you can see selected skeleton for selected animation in top-down list (3).
Press "Save" button to save selected animation settings. Press "Save All" to save all changed settings.
These settings are saved in a sidecar file with extension .animsettings next to each .i_caf file.
After saving Sandbox will be invoke RC to compress intermediate file .i_caf into compressed .caf.
Previewing an Upperbody Animation
Make sure that upperbody animation is located within path that was specified in .chrparams in the earlier section. Once this is added to the list, start the Editor and open the Character Editor.
Start by first clicking on the fullbody animation in the animation list. You will see the animation looping in the 3d view. Below the Choose Base Character button you will see a dropdown box defining which layer is currently playing.
It should say "Primary". If not, press the "Stop All" button, select the primary layer and start the animation again.
Next, select the Secondary.1 layer and click on the upperbody animation you exported earlier in the animation list. This will begin to play the animation using the tracks that were exported from the Spine down through its hierarchy.
You should still see the legs moving in the same way as the fullbody animation, with the upperbody completely overwritten by the second animation.
Creating an FSQ
This section is detailed in the Facial Editor Reference.