In this paper I would like to share my experience and tools we developed while working on animation for our recent game project. Let’s say, you are about to make a game with 2D art and animation and you have a 3D engine for mobile games. Unity for example. Many of us are faced with this task. Atlases and sequences are not allowed. It should be a lot of animation.
We chose Maya for 2D animation and self-writen scripts for setting up a character. Besides such advantages as speed and robust IK system, Maya provides us the most important thing – capability to export .fbx file with joints and animation directly to 3D engine.
The first task you have to worry about is texture import from Photoshop to Maya. To set up a character without a script you have to create separate plane for each texture and assign materials. Every character consists of 30-40 pieces. To optimize it we have a Photoshop-script, which crops and exports layers from .psd file and a MEL-script, which assembles this layers in Maya. It works both for setting up characters and locations.
To install MEL-scripts:
Copy enBuild.mel, enControls.mel, enToolbar.mel to the Maya scripts folder (default path: C:\Program Files\Autodesk\Maya2012\scripts).
To install Photoshop script:
Copy SmartExportLayers.jsx to the Photohop scripts folder (usually here: C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Presets\Scripts).
Setting up a character involves three steps:
Texture export from Photoshop;
Making a planes in Maya and texture import;
Making joints and controllers.
Photoshop-script exports layers from .psd file with character and creates a text file, which is used by MEL-script. To run script, find the command File → Script → SmartExportLayers
To run the menu with MEL-script type “source enToolbar.mel;” in command line.
First of all, you have to assign a character name and push Enter. At the command response line you should see a message:
Push the “Build a character” button and choose a folder with the textures exported from Photoshop and _Out.txt file. The script will automatically create the necessary planes and assign materials. Planes are created with interspace of 10 units on the Y axis in order they were in Photoshop.
Second script in the menu creates a minimal set of joints, needed to animate a 2D character:
Do not close the “Encore tools” window and press “Create controllers”.
It is recommended to use only curves controllers to set up a character: torso, hip, IK_ankle, FK_shoulder, IK_hand. It is better to start with “torso”
Connect a character with joints and controllers using parent:
Main layer with body connect to torso;
Hands and feet connect to IK controllers: IK_hand, IK_ankle;
Legs, shoulders and forearms connect to correct joints.
By default arms and legs consist of two joints. But, if just one bone is enough, you can set to zero Upperarm_Scale attribute for the hands and Hip_Scale for the legs. This attributes are located in IK_hand and IK_ankle controllers.
Head of the character should be connected to neck (curve controller). Helmets, belts and other props are connected to the corresponding planes. For example, hat is connected to the plane with a head texture, which is already connected to the neck controller.
If you are setting up all the characters by the same pattern, you can transfer your animations to other characters through Trax Editor. It is good for base animations such as idles and walk cycles.
To toggle emotions I create additional attribute as a list of painted facial expressions and bind it through the Driven Key with visibility of corresponding planes:
Now I create a new orthographic camera and work on character animation in two dimensions.