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 a 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 must use a TCB controller for both rotation and position tracks.
- To create a loop in 3ds MAX an Out of Range "Loop" type needs to be assigned.
- 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.
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 a CAF File
Setup for 3DS Max
Preparing a Scene
A CAF file is a skeletal based animation file that requires a mesh with bones and a weighting modifier applied.
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 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
A CAF file is a skeletal based animation file that requires a mesh with bones skinned to it.
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.
Previewing the Animation
In order to preview the animation you will need to add it to a CAL file (Crytek Animation List). This simple text file defines the animations that your character will use and their location. Below is a basic example:
The #filepath command points this particular file to a folder used only for male animations.
The $Include allows your character to read from multiple cal files. In this example the cinematic animations were separated in a list that is only loaded on demand (so these animations are loaded and unloaded from memory.
// simply defines a comment.
The last line is defining the name of the animation and its location in a subfolder of
animations\human\male called combat. The name given on the left is what will be seen in the editor and does not have to match the actual animation's file name.
For the SDK character this example cal file has been added.
Create an example that is similar to the above and replace the name with the name of the animation you created. The cal file must be located in the same folder as your character and have the same name as this CHR file, except with the cal file extension.
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.
Previewing an Upperbody Animation
Repeat the steps above by adding the upperbody animation to the CAL file. 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.