Home > Devices > Fire Phone

Using Maya to Create Custom Visual Assets


Note: Certain development tools referenced in this document are provided by third parties, not by Amazon. Any links to these tools in this document take you to third-party sites to download and install them. Autodesk screen shots reprinted with the permission of Autodesk, Inc. This software uses the FreeImage open source image library. FreeImage is used under the FIPL license. See http://freeimage.sourceforge.net/freeimage-license.txt for details. Source code for this library is available at http://downloads.sourceforge.net/freeimage/FreeImage3154Win32.zip. 

This section provides a walkthrough of building content in Euclid.

Start Maya

You should have Autodesk Maya installed on your computer. If necessary, see Setting Up Autodesk Maya for instructions on setting up your Maya environment. To complete this tutorial, you need a three-button mouse.

The following image shows the basic Maya interface; the controls that you will be working with are highlighted.

Enabling the EuclidBuilder Plug-In

Before you start, make sure the EuclidBuilder plug-in is enabled.

From the Window menu, select Settings/Preferences, then select Plug-in Manager:

Make sure the EuclidBuilder plug-in is enabled; the Loaded option should be checked:

Building a Simple Button

The following sections describe how to build a simple button that contains:

  • A button mesh
  • A state machine with two states:
    • Down
    • Up
  • A single attachment point for attaching an icon or text
  • Animations:
    • up_to_down
    • down_to_up

Building the Button Mesh

To build the button mesh, start with a polygon cube.

Select Snap To Grid to make placement easier. The Snap To Grid control is near the middle of the toolbar items.

From the Create menu, select Polygon Primitives, then select Cube.

Drag the edges of the cube to set the cube width and then drag a second time to set the height. You should get a cube similar to the one shown below:

You should see the Attribute Editor display attribute values for your newly created cube. If you do not see it, in the Window menu, select Attribute Editor. You use the Attribute Editor to find all the settings and related items for your scene objects in Maya.

You can use the buttons highlighted on the left in the below screenshot to switch between wireframe and solid rendering modes. The button with the sphere icon on the right enables High Quality rendering:

Adding a Material

In this step you add a material other than the default to this object.

To assign a Phong material to the object, right-click and hold down the mouse button on the object. While still holding down the right mouse button, select Assign Favorite Material and then select Phong. You will see the menu shown in the following image:

The Attribute Editor dialog opens and shows the Phong properties:

This properties list enables you to specify the look of the button. Additionally, the name specified above ("phong1") is how the material is referenced in code. For instance, the material could be a settable texture such as a book cover or other dynamic content.

Adding Animations

Maya also supports skeletal animation, which involves skinning the mesh to a skeleton. Once you have followed those steps, replace the animation of the object with the animation of the joint the object is bound to.

To add animations to the new cube, use the keying properties on your cube.

In Maya, any property on an object can be keyed and associated with the timeline. However, the API supports only the following properties on scene objects:

  • Translation
  • Rotation
  • Scale

Start with a simple translation animation. First select the translate tool, highlighted below, and then select the cube.

Now that the cube is selected, add some keyframes.

Define both of your animations on the default timeline over a series of frames:

  • up_to_down - Frame 1 to 10
  • down_to_up - Frame 11 to 20

The animations could also be specified by using animation layers, but for the sake of simplicity the example uses a single timeline.

Start the first animation by scrubbing to frame 1 in the timeline and keying translation:

In the Attribute Editor, open the Transform Attributes section. Right click in the Transform Attributes section and select Set Key. 

After doing this, you should see a red keyframe at frame 1:

Then scrub the timeline to frame 10:

Grab the yellow axis of the translation and drag the button down:

Then key translation again and you should see a red keyframe at 10:

Now that you have two keyframes, you should be able to scrub the timeline and see the button move down.

Scrub the timeline to frame 20, set the translation of the cube to 0, 0, 0, and key this frame:

Now that you have the animation defined, you must mark up the Maya file so that you know which parts of the timeline are associated with which animations.

To do this, edit the scene information by clicking Euclid and then click Edit Scene:

This opens the Euclid Scene Editor dialog:

Create a new animation called "up_to_down":

Next, set an up_to_down frame range of 1 to 10:

Set a  down_to_up frame range of 11 to 20:

If your animation is not a node animation, exit the Euclid Scene Editor.

Defining a Bind Pose for Node Animations

If your animation is a node animation, you will need to define a bind pose for your animation. The bind pose defines a default position for a scene. All other concurrent animations run relative to this bind pose.

For example, consider two animations named "moveUp" and "moveRight". The first animation, "moveRight", moves an object from (5,0,0) to (10, 0, 0), and the second animation, "moveUp", moves the object from (5, 0, 0) to (5, 5, 0). If you played these animations concurrently, you would might assume that the animation moves from (5, 0, 0) to (10, 5, 0). However, that assumption only holds when common starting point (5, 0, 0) is the same as the reference point. If the reference point was different, say, (0, 0, 0), you would end up with a combined animation that moves from (10, 0,0) to (20, 5, 0). Creating a bind pose resolves this issue by creating a baseline position from which all other animations are defined.

To define a bind pose, place the scene in the desired pose, and then create a single framed animation named "bind", as shown in the following image:

Note that if you do not intend to play multiple animations at the same time, you can set your bind pose anywhere.

After you define your bind pose, exit the Euclid Scene Editor.

Adding an Attachment Point

You will be working with more than one scene object. The Outliner tool is a good way to efficiently view your multiple scene objects. To open the Outliner, click Window and then click Outliner:

The Outliner shows all of the scene objects in the file as shown below. If you want to get a deeper view of the overall interaction of objects, you can view all directed acyclic graph (DAG) objects by using the hypergraph (click Window -> Hypergraph: Connections).

Attachment points are created using the Attach Point command. From the Euclid menu, select Create, then Attach Point.

An attachment point is created at the origin:

Rename the attachment point to ap_icon:

Next, move the attachment point along Y-axis so that it is in front of the button:

Next we need to size the attach point. The visual indicator shows the bounds of the attachment point, which you can modify by using the scale tool:

Creating a State Machine

State machines are built by using the Euclid State Machine Editor in Maya. Open the Euclid menu and select Edit State Machines:

The Euclid State Machine Editor window opens:

Create a new state machine by clicking Edit and then clicking New State Machine:

Rename the state machine to button:

Add a new state to the state:

Rename the state to down:

Repeat the process to create a second state called up:

Next, add transitions from the two states and associate them with animations. Start by clicking the middle button on the down state and dragging to the up state.

To associate this transition with the down_to_up animation, double click on the arrow located between the down state and up states.

Note that you now have a list of sequences that are associated with this transition. At this time, the state machine supports only a single sequence.

Create a new sequence by clicking on the new sequence button (highlighted in red).

This shows the sequence above. A sequence is a collection of actions that are played in order to complete the transition. Currently, only PlayAnimation is supported. Click the new action icon (highlighted in red).

After creating the new PlayAnimation action, enter the animation name to play (down_to_up).

Repeat the previous process for the up-to-down transition using the animation up_to_down.

Now that you have a completed state machine, click File and then click Export and save the state machine. Make sure you can locate it again; a good location would be in the same directory as the Maya file.

The exported state machine is stored in a .smx file with contents similar to those shown below:


The last step is to associate the state machine with your Maya scene. To do this, click Euclid and then click Edit Scene:

Under State Machines, navigate to the location where you saved the file. Select the appropriate .smx file and click the "Add a state machine reference" button highlighted as follows:

The resulting dialog will look similar to the following, with the selected state machine shown in the State Machines section of the dialog:


Exporting the Scene

Now that you have a fully built scene, export it so that you can process it with EBB and turn it into a VBL.

To export the scene, click File and then click Export All:

In the Files of Type dropdown list, select EuclidExport:

In File name, type "button" and then click Export All.

The export creates the following files:

  • button.ebx - Euclid scene markup
  • button.fbx - Interchange format for meshes and animation
  • button.smx - State machine file