Chapter 2
Jumping into Basic Animation Headfirst

In this chapter, you’ll start using the Autodesk® Maya® software and get your groove on. This will be a quick primer on the Maya interface so you experience tasks right away. The next chapter will show you more details and provide additional explanations and a reference of how the entire Maya interface functions as you work on another project.

In this chapter, you will follow an exercise for creating a solar system and learn the mechanics of animating orbits. With this exercise, you’ll create simple objects, set keyframes, and stack your animation to get planets and moons to orbit each other and the Sun. These tasks will expose you to object creation, simple modeling, object components, pivot-point placement, grouping and hierarchies, basic keyframing, and timing.

  1. Learning Outcomes: In this chapter, you will be able to
  • Gain a working understanding of the user interface and how to navigate in 3D space
  • Learn project structure in Maya and how to create projects in Maya
  • Create, name, and manipulate simple objects with the Move, Rotate, and Scale tools
  • Make and apply simple shaders to scene geometry through the Hypershade
  • Add keyframes to objects to create animation
  • Adjust pivot points
  • Create and edit hierarchies by using groups
  • Output your animation through playblasting

You Put the U in User Interface

Fire up your computer, and let’s get going. This section will introduce you to getting around the Maya user interface (UI).

The overall goal of this chapter is to expose you to Maya UI basics as well as important scene creation and editing tools. You’ll find more details on the interface in Chapter 3, “The Autodesk Maya 2016 Interface.”

A Quick Screen Roadmap

Let’s get to the basics of how Maya is laid out (see Figure 2-1). Running across the top of the screen, right under the application title bar, are the UI elements: the main menu bar, the Status line, and the Shelf. On Mac OS X, note that the main menu bar runs across the top of the screen, above the application title bar.

Figure 2-1 shows the major parts of the UI. In the middle of the interface is the workspace, which is host to your panels (or Scene windows) and their menu options (known as views or viewports in some other 3D packages). This is where most of your focus will be.

Click inside the large Perspective view panel (named persp) with the mouse to activate the panel, highlighting its border slightly. Press the spacebar to display a four-panel layout, which gives you top, front, and side views, as well as the perspective view. Press the spacebar in any of the panels to display a large view of that panel.

c02f001.eps

Figure 2-1: The initial Maya screen

To the right of the panels is the Attribute Editor/Channel Box/Modeling Toolkit. This is where most of the information (attributes) about a selected object is displayed and edited. Also, this is where you access the Modeling Toolkit suite of polygon tools. Simply click any of the tabs to access these functions. Furthermore, pressing Ctrl+A toggles between the Attribute Editor and the Channel Box.

In short, the Attribute Editor gives you access to all of an object’s attributes, whereas the Channel Box is a quicker display of the most commonly animated attributes of the selected object.

Letter Keys and Syntax in Maya

Maya is case sensitive (meaning it distinguishes between lowercase and uppercase letters). The conventions of this book are to always print an uppercase letter to denote which key you must press. So, when I ask you to press the E key, for example, you should simply press the E key on your keyboard (thereby entering a lowercase e). When an uppercase letter is called for, the book tells you to press Shift+E, thereby entering the uppercase letter E into Maya. Also, make sure your Caps Lock key is turned off.

Mouse Controls

Maya requires the use of a three-button mouse, even on a Mac. The clickable scroll wheel found on most mice can be used as the third button by pressing down to click with the wheel.

In Maya, you press and hold the Alt key on a PC (or the Option key on a Mac) along with the appropriate mouse button to move in the view panel.

  • The left mouse button (LMB) acts as the primary selection button and allows you to orbit around objects when used with the Alt key.
  • The right mouse button (RMB) activates numerous shortcut menus and lets you zoom when used with the Alt key.
  • The middle mouse button (MMB) used with the Alt key lets you move within the Maya interface panels, and the mouse’s wheel can be used to zoom in and out as well.

Making Selections

Selecting objects in a view panel is as easy as clicking them. As you select an object, its attributes appear in the Attribute Editor or Channel Box on the right. To select multiple objects, simply hold the Shift key as you click objects to add to your current selection. If you press Ctrl+LMB (press the Ctrl key and click) on an active object, you’ll deselect it. To clear all of your current selections, click anywhere in the empty areas of the view panel.

Manipulating Objects

When you select an object and enable one of the transformation tools (tools that allow you to move, rotate, or scale an object), you’ll see a manipulator appear at or around the selected object. Figure 2-2 shows the three distinct and most common manipulators for all objects in Maya (Move, Rotate, and Scale) as well as the Universal Manipulator. You use these manipulators to adjust attributes of the objects visually and in real time.

c02f002.tif

Figure 2-2: The Maya manipulators

To activate a transform tool, select an object and then click one of the transform tool icons in the Tool Box, shown in Figure 2-3.

c02f003.eps

Figure 2-3: The transform tools in the Tool Box

  1. Try This Let’s put some of this into action.
  1. Press 4 for wireframe mode. Choose Create ⇒ Polygon Primitives ⇒ Sphere. Drag in a view panel anywhere on its grid to create a wireframe sphere and then size it to your liking. If this does not happen and instead a sphere appears in your window, a default setting has previously been changed, which is okay. In this case, turn on Interactive Creation if it was previously turned off. Click Create ⇒ Polygon Primitives and make sure the check box next to Interactive Creation at the bottom is checked.

    In one of the view panels, press the 5 key on your keyboard, and the display of the sphere will become solid gray. This is called Shaded mode. Press the 4 key to return to Wireframe mode. You should also see an in-view message at the top of your view stating “shaded display is now on. Press 4 to display objects in wireframe mode.”

  1. With the sphere selected, select the Move tool (c02i001.tif) from the Tool Box. The first manipulator shown earlier in Figure 2-2 should appear in the middle of the sphere. The three arrows represent the three axes of possible movement for the object. Red is for the X-axis, green is for the Y-axis, and blue is for the Z-axis. Cyan is for free movement in both axes of the active panel view. Clicking any one of the three arrows lets you move the object only on that particular axis. The square in the middle of the manipulator lets you move the object freely around the plane of the view panel, regardless of the axis. The three squares represent planar movement in two of the three axes at a time, for example moving on the XY plane or the YZ plane.
  2. Next, select the Rotate tool (c02i002.tif) from the Tool Box, and you’ll see the second manipulator from Figure 2-2. The three colored circles represent the three axes of rotation for the object—red for X, green for Y, and blue for Z. Select a circle to rotate the object on that axis. The yellow circle surrounding the three axis circles lets you freely rotate the object on all three axes.
  3. Try selecting the Scale tool (c02i003.tif) to see the third manipulator from Figure 2-2. By selecting one of the axis handles and dragging the mouse, you can scale the object in a nonuniform manner in that axis. The middle cyan box scales the object uniformly on all three axes.
  4. Try selecting the Universal Manipulator, which is not shown in the Tool Box but is found by choosing Modify ⇒ Transformation Tools ⇒ Universal Manipulator. Its icon (c02i004.tif) appears under the Tool Box after you select it from the menu. This tool acts in place of all three manipulators you just tried. Grabbing the familiar arrows translates the sphere. Selecting any of the curved arrows in the middle of the edges of the manipulator box lets you rotate the sphere in that axis. Finally, selecting and dragging the cyan boxes in the corners of the manipulator box lets you scale the sphere. If you hold down the Ctrl key as you drag, you can scale the sphere in just one axis.

Go ahead and click around the interface some more. Create more primitive objects and tool around a bit. Move around the view panels and see how it feels. Give the tires a good kick.

Enough chatting—let’s jump into the solar system exercise.

Project: The Solar System

This project will familiarize you with the fundamentals of navigating Maya, object creation, hierarchy, and pivots, all of which are important concepts for scene manipulation and animation within Maya. In this exercise, you’ll gain experience with UI elements while setting up a Maya project in which you create and manipulate objects. You will animate a simple simulation of your working solar system, making and adjusting hierarchies for animation and setting keyframes.

Starting with the Sun in the center, the planets in order are Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, and Pluto. (Yes, yes, I know Pluto isn’t classified as a planet anymore.) All these planets orbit the Sun in ellipses, but you’ll give them circular orbits for this exercise. Most planets have a number of moons that orbit them, and a few, including Saturn, have large rings that circle them. For this exercise, you will create only two moons for any planet that has more than two moons, like Jupiter.

The more you run this exercise, the clearer the scene manipulation and hierarchy structure will become to you. Art is a marriage of inspiration, hard work, and practice.

Creating a Project

Projects are the way Maya manages a scene’s assets. A file and folder structure keeps your files organized according to projects. You will want to create a new project for this new exercise.

The top level of this organization is the project folder. Within the project folder are numerous file folders that hold your files. When you set your workspace to a project folder (or when you create a new project), Maya will know where to look for elements and folders for that project. The two most important types are the Scenes and Images folders. The Scenes folder stores your scene files, which contain all the information for your scene. The Images folder stores images you’ve rendered from your scene.

To create a new project for this assignment, follow these steps:

c02f004.tif

Figure 2-4: The completed Project Window

  1. Choose File ⇒ Project Window to open the Project Window and then click the New button.
  2. In the Current Project field in the Project Window, enter Solar_System as the name for your project. In the Location box, type the location where you want to store your projects.

    The default location for Windows XP, Vista, and Windows 7 is the current user’s My Documents folder: My Documentsmayaprojects; for Macs, the default location is Home (/Users/<yourname>) in the Documents/maya/projects/default folder; and for Windows 8 users it is found under the Documents location under the Start menu. If you prefer, you can put projects in a folder on a secondary or external hard drive to keep them separate from your operating system; this allows for easier backup and is generally a safer environment.

  3. If you’re using a Windows system, create a folder on your hard drive called Projects using Windows Explorer. If you’re using a Mac, select a drive in the Finder and create a folder on the drive called Projects. In the Project Window, click the folder icon next to the Location field and select D:Projects (Windows) or <Hard Drive Name>/Projects (Mac) for the location. Maya will fill in all the other fields for you with defaults. Click Accept to create the necessary folders in your specified location. Figure 2-4 shows the completed Project Window in Mac OS X; except for the drive name, the values are the same on Windows.

After you create projects, you can switch between them by choosing File ⇒ Set Project and selecting the new project. Maya will then use that project’s folders until you switch to or create another project. You may also select a recent project by choosing File ⇒ Recent Projects.

The Production Process: Creating and Animating the Objects

In this project, you’ll first create the Sun, the planets, and their moons; then, you’ll animate their respective orbits and rotations.

Creating the Sun and the Planets

c02f005.tif

Figure 2-5: Turning off Interactive Creation

The first thing you’ll do is create the Sun and the planets. Follow these steps:

  1. Choose File ⇒ New Scene (or press Ctrl+N). Maya asks if you want to save your current scene. Save the file if you need to or click Don’t Save to discard the scene.
  2. By default, the screen should begin in an expanded perspective view. Press the spacebar to enable the four-panel view. When you’re in the four-panel view, press the spacebar with the cursor inside the top view panel to select and maximize it.
  3. To create the Sun, you need to create a primitive sphere. A primitive is a basic 3D shape. First let’s turn off a default feature called Interactive Creation. Uncheck Create ⇒ Polygon Primitives ⇒ Interactive Creation to toggle it off, as shown in Figure 2-5.
  1. With Interactive Creation now turned off, choose Create ⇒ Polygon Primitives ⇒ Sphere. Doing so places a polygon sphere exactly at the origin—that is, at a position of 0,0,0 for X,Y,Z. This is good, because the origin of the workspace will be the center of the solar system, too. The sphere will be selected, and some of its attributes will show on the right of the UI in the Attribute Editor.
  2. Press Ctrl+A to toggle off the Attribute Editor and toggle on the Channel Box in its place.
  3. Select the word pSphere1 in the Channel Box (shown in Figure 2-6) and enter Sun to rename it. If you don’t see the Channel Box in your Maya window, press Ctrl+A to toggle the view from the Attribute Editor to the Channel Box.
c02f006.tif

Figure 2-6: Renaming the sphere in the Channel Box

Naming your objects right after creation is a good habit to develop and is particularly important if anyone needs to alter your scene file; proper naming will keep them from getting frustrated when they work on your scene.

  1. Choose the Scale tool in the Tool Box to activate the Scale manipulator, and uniformly scale the Sun sphere up to about four times its creation scale of 1. (Make it a scale of about 4 in all three axes.) For more precision, you can select the sphere and enter a value of 4 in all three entry fields (the white window next to the attribute) for the Scale X, Scale Y, and Scale Z channels in the Channel Box shown in Figure 2-7.
c02f007.tif

Figure 2-7: The Sun sphere’s Scale values in the Channel Box

  1. After you enter the final value, press Enter, and the sphere will grow to be four times its original size. Entering exact values in the Channel Box is a way to scale the sphere precisely; using the manipulator isn’t as precise.

Creating the Planets

Next, you’ll create the primitive spheres for the planets. Leave Interactive Creation off, and follow these steps:

  1. Create a polygon sphere for Mercury just as you did before, by choosing Create ⇒ Polygon Primitives ⇒ Sphere. A new sphere appears at the origin. Click its name in the Channel Box and change it to Mercury.
  2. Choose the Move tool from the Tool Box to activate the Move manipulator and move Mercury a few grid units away from the Sun sphere in the positive X direction. (Click the red arrow and drag it to the right.) Leave about 2 grid units between the Mercury sphere and the Sun sphere.
  3. Because Mercury is the second-smallest planet and is tiny compared to the Sun, scale it down to 1/20th the size of the Sun sphere, or type 0.2 in all three axes of Scale in the Channel Box.
  4. Repeat steps 1 through 3 to create the rest of the planets and line them up, placing each one farther out along the X-axis with about two grid units of space between them. If you run out of grid, simply select Display ⇒ Grid ❏, set the Length and Width value in the Grid Options window to 36 or more, and click Apply and Close.
  5. Scale each planet sphere proportionally as shown in the chart on the right. Make sure to name each planet in the Channel Box (as in step 1 for Mercury) for each new planet sphere you create, using the chart on the right as reference.
    Planet Sphere Sizes
    Venus0.5
    Earth0.5
    Mars0.4
    Jupiter1.0
    Saturn0.9
    Uranus0.7
    Neptune0.7
    Pluto0.15

These proportions aren’t exactly real, but they will do nicely here. Figure 2-8 shows how your solar system should look now.

c02f008.tif

Figure 2-8: All the spheres are lined up in place.

Using Snaps

Now is the perfect time to start using snaps. Table 2-1 shows some common snap icons. These icons run across the top of the UI just below the main menu bar, as shown here.

c02uf002.tif

Table 2-1: Snap icons

Snap iconNameDescription
c02i005.tifSnap To GridsSnaps objects to intersections of the view’s grid
c02i006.tifSnap To CurvesSnaps objects along a curve
c02i007.tifSnap To PointsSnaps objects to object points such as CVs or vertices
c02i008.tifSnap To Projected CenterSnaps an object to the center of another object
c02i009.tifSnap To View PlanesSnaps objects to view planes

You use snaps to snap objects into place with precision, by placing them by their pivot points directly onto grid points, onto other object pivots, onto curve points, and so on. Here you’ll reposition all the planets slightly to center them on the nearest grid line intersection:

  1. Select the first planet, Mercury. Choose the Move tool from the Tool Box and toggle on grid snaps by clicking the Snap To Grids icon (c02i005.tif).
  2. The center of the Move manipulator changes from a square to a circle, signaling that some form of snapping is active. Grab the manipulator in the middle by this circle and move it slightly to the left or right to snap it onto the closest grid intersection on the X-axis.
  3. Select the remaining planets and snap them all to the closest grid intersection on the X-axis, making sure to keep about two grid spaces between them. Because the Sun sphere was created at the origin and you haven’t moved it, you don’t need to snap it onto an intersection.

Making Saturn’s Ring

Now, let’s create the ring for Saturn. To do so, follow these steps:

  1. Press the spacebar in the top view to maximize it. Choose Create ⇒ Polygon Primitives ⇒ Torus to place a donut shape at the origin (since Interactive Creation is still off). Use the Move tool to snap the ring to the same grid intersection as Saturn. This ensures that both the planet and its ring are on the same pivot point and share the same center.
  2. Select the torus shape you’ve created and name it Ring in the Channel Box.
  3. While the torus shape is still selected in the top view, press the spacebar to display the four-panel layout. Place the mouse cursor in the persp view and press the spacebar to maximize the Perspective window.
  4. Press the F key to focus the perspective display on the ring and on Saturn. Pressing F centers and zooms in the panel on just the selected objects.
  5. Press 5 to get into Shaded mode.
  6. From the Tool Box, select the Scale tool and scale the torus down to 0 or close to 0 in the Y-axis (the torus’s height, in this case) to flatten it.

    You need to edit the attributes of the ring to increase the inside radius of the donut shape and create a gap between the planet and the ring.

    c02f009.tif

    Figure 2-9: Changing the creation attributes of the polygon torus in the Attribute Editor

  7. Press Ctrl+A (Ctrl or Cmd+A will work on a Mac) to toggle the Attribute Editor if it’s not on and then click the polyTorus1 tab to select its creation node (see Figure 2-9).
  8. Increase the Radius attribute to about 1.5 and decrease the Section Radius attribute to about 0.4 to get the desired effect.

Now all your planets are complete, and you can move on to the moons.

Saving Your Work

Save your work, unless you like to live on the edge. Power failures and other unforeseen circumstances (such as your pet jumping onto your keyboard) may not happen often, but they do happen. Because you created this as a new project, the Save File window will direct you to the Scenes folder of that project. Save your scene as planets in the .ma (Maya ASCII) format.

The file Planets_v1.ma in the Scenes folder of the Solar_System project, available on the book’s web page, shows what the scene should look like at this point.

Creating the Moons

For the planets with moons, create a new polygon sphere for each moon. For simplicity’s sake, create only two moons for any planet. The first moon will be Earth’s. Use the top view to follow these steps:

  1. Create a polygon sphere and scale it to about half the size of Earth using the Scale tool. Visually estimate the size of the moon.
  2. Move the sphere to within half a unit of Earth, using the Move tool by the X-axis. There’s no need to snap it to a grid point, so toggle off the Snap To Grids icon (c02i005.tif). Name the moon earthMoon.
  3. Repeat steps 1 and 2 for the remaining moons, placing them each within half a grid unit from their respective planets. When placing two moons, place them on opposite sides of the planet. Make sure to name your moons.
  4. After you’ve finished with all the moons, their placements, and their sizes, you should have a scene similar to Figure 2-10 in perspective view. If you don’t, it’s clear Maya doesn’t like you.
c02f010.tif

Figure 2-10: The planets and moons in position in perspective view

Applying a Simple Shader

To help distinguish one gray planet from another, let’s attach simple shaders to each of the planets to give them color. Shaders, in short, are materials that give an object its particular look, whether it is color or a tactile texture. Follow these steps:

  1. Choose Windows ⇒ Rendering Editors ⇒ Hypershade to open the Hypershade window. With this window, you create the look of your objects by assigning colors, surface properties, and so on. You’ll notice three default (or initial) shader icons already loaded, as well as a new material you’ll create in the next step (see Figure 2-11).
    c02f011.tif

    Figure 2-11: The Hypershade window

  2. In the Create panel on the lower left of the Hypershade window, click the Lambert icon (Figure 2-11) to create a new Lambert shader node. A new node called lambert2 appears in the top-left panel (called the Browser). This is where the Hypershade lists all the materials in the scene. In the top-right panel, called the Material Viewer, the Hypershade shows a rendered preview of the selected material. A selected material’s more important attributes are listed in the Property Editor directly below the Material Viewer. Click the Lambert icon in the Create panel eight more times to create a total of nine new Lambert shading groups (lambert2 through lambert10).
  3. In the Hypershade’s Browser, click the first of the new Lambert nodes (select lambert2, do not select lambert1) to display its attributes in the Property Editor. (The material’s complete list of attributes are shown in the Attribute Editor in the main Maya UI window.) At the top of the Property Editor, rename lambert2 to Mercury_Color to identify this material as the one you’ll use for Mercury.
  4. Name each of the remaining planets’ materials in the Hypershade’s Property Editor (Venus_Color, Earth_Color, Mars_Color, Jupiter_Color, Saturn_Color, Uranus_Color, Neptune_Color, and Pluto_Color) and save your work.

After you’ve created and named all the materials (a.k.a., shaders), you can assign appropriate colors to each of the shaders according to the planets that they represent.

  1. Click Mercury_Color’s lambert icon in the Hypershade to display its properties (see Figure 2-12).
c02f012.tif

Figure 2-12: Mercury’s material in the Hypershade Property Editor

  1. To change the color of the shader, click the gray box next to the Color attribute. This opens the Color Chooser window, where you can choose a new color by using the color wheel or by adjusting values with the HSV sliders. Go with an orange color, such as in Figure 2-13 (take note of the HSV values, and see that Color Management is checked, otherwise your HSV values will differ from those shown in the figure).
c02f013.tif

Figure 2-13: The Color Chooser window

  1. Change the shaders as follows:
    MercuryOrange-brown
    VenusBeige-yellow
    EarthBlue
    MarsRed-orange
    JupiterYellow-green
    SaturnPale yellow
    UranusCyan
    NeptuneAqua blue
    PlutoBright gray

    Figure 2-14 shows the shading groups.

  2. Next, let’s apply the materials to the planets. Select a planet in the Perspective window, and RMB+click its corresponding material in the Hypershade window to open a marking menu. Marking menus are a fast UI workflow to allow you to select commands and options as you work in your panels without having to access the main menu bar.
    c02f014.tif

    Figure 2-14: The Hypershade window with all the colored planet materials

  3. Still holding the right mouse button, drag up to highlight Assign Material To Selection and release the button to select it. You can also use the middle mouse button to drag the material from the Hypershade window to its planet. Leave the moons set to the default gray color. When you’re finished, you should have a scene similar to Figure 2-15.

Now that you’re finished, you’re ready to animate. Save this file; if you enabled Incremental Save as recommended earlier, your file won’t be replaced with subsequent saves.

c02f015.tif

Figure 2-15: The shaded planets in perspective view

Creating the Animation

To begin this phase of the project, load the file Planets_v2.ma in the Scenes folder of the Solar_System project on the web page to your hard drive, or continue with your own scene file.

The animation you’ll do for the planet’s self-rotation is straightforward. You’ll rotate the planets around their own axes for their self-rotation, and then you’ll animate the moons around the planets for their lunar orbits. Finally, you’ll make the planets and their moons orbit the Sun.

This exercise focuses on hierarchy and pivot points. A pivot point is an object’s center of balance of sorts. Every object or node created in Maya has a pivot point, especially primitives like you’re creating here. That pivot point is usually at the center of the primitive and moves along with the object if it’s moved.

Now, you need to set up the animation settings for your scene file:

  1. Press F4 to open the Animation menu set, or select it from the drop-down menu shown earlier in the chapter. Menu sets are groupings of menu headings in the main menu bar. They’re organized according to the type of task at hand. You’ll see the several menu headings change.
  2. At the bottom of the UI, you’ll notice a slider bar (the Range slider) directly below the strip of numbers counting off the frames (the Time slider) in the scene. Using the Range slider, you’ll set the length of your animation to go from 1 to 240. Enter 1 in the Scene Start Frame and Range Start Frame boxes (Figure 2-16). Enter a value of 240 in the Scene End Frame and Range End Frame boxes, also as shown in Figure 2-16.
c02f016.tif

Figure 2-16: The Time and Range sliders

  1. To the right of the Range slider, click the Animation Preferences icon (c02i010.tif), click Settings (Figure 2-17), and make sure Time is set to Film (24fps).
c02f017.tif

Figure 2-17: Set Time to 24fps on the Settings tab of the Preferences window.

Mercury’s Rotation

Now you’re ready to animate Mercury’s rotation. Follow these steps:

  1. Select Mercury, and press E to activate the Rotate tool. The E key is the hotkey to invoke the Rotate tool in Maya. Press F to focus on Mercury in the perspective view, or zoom in on it manually.
  2. Make sure you’re on frame 1 of your animation range by clicking and dragging the Scrub bar (refer to the earlier Figure 2-17) to place it at the desired frame. You can also manually type the frame value of 1 in the Current Frame box.
  3. For Mercury, you’ll set your initial keyframe for the Y-axis rotation. RMB+click the attribute name for Rotate Y in the Channel Box to select it and bring up a context menu, as shown in Figure 2-18. Select Key Selected from the context menu. This places a keyframe for a rotation of 0 in the Y-axis at frame 1 for the Mercury sphere, and the Value box in the Rotate Y attribute turns to pink to indicate that a keyframe exists for that attribute.
    c02f018.tif

    Figure 2-18: Setting the initial keyframe for Mercury’s Y-axis rotation

    Conversely, instead of RMB+clicking Rotate Y in the Channel Box, you could also set a keyframe through the main menu bar (in the Animation menu set) by selecting Key ⇒ Set Key. However, this method will set a keyframe for all attributes of the Mercury sphere, which is not efficient. You should ideally try to set keyframes only on attributes you need.

  4. Using the Scrub bar in the Time slider, go to frame 240. Grab the Rotation manipulator handle by the Y-axis (the green circle) and turn it clockwise a few times to rotate the sphere clockwise. You’ll notice that you can rotate the object only so far in one direction before it seems to reset to its original rotation. Rotate it as far as it will go and release the mouse button. Then, click the manipulator again and drag to rotate the sphere as many times as necessary until you’re satisfied with its spin.
  5. RMB+click the Rotate Y attribute in the Channel Box and choose Key Selected again. This sets a keyframe for your new Y-axis rotation at frame 240 for the Mercury sphere.
  6. To play back your animation, you can scrub your Time slider. Click in the Time slider on the Scrub bar, hold down the left mouse button, and move your cursor from side to side to scrub in real time. You’ll see Mercury rotating in your active view panel, if you set your two keyframes as described.

You have the self-rotation for Mercury worked out. Mercury has no moon, so let’s get Mercury orbiting the Sun.

Grouping Mercury for a New Pivot Point

You’ve learned that every object in Maya is created with a pivot point around which it rotates and scales and which acts as the placement for its X-, Y-, and Z-coordinates. To orbit Mercury around the Sun sphere, the sphere must revolve around a pivot point that is placed in the middle of the Sun sphere. If the pivot point for Mercury is already at the center of itself, how can you revolve it around the Sun sphere?

One idea is to move its current pivot point from the center of itself to the center of the Sun sphere. That would, however, negate Mercury’s own rotation, and it would no longer spin around its own center, so you can’t do that. You need to create a new pivot point for this object. This way, you have the original pivot point at Mercury’s center so it can self-rotate, and you have a second pivot point at the Sun sphere so that Mercury can revolve around that point around the Sun sphere. You’ll accomplish this by creating a new parent node above Mercury in the hierarchy. What does that mean?

To explain, I’ll take time in the following section to introduce the concept of Maya object structure: nodes and hierarchies. Save your progress so far and open a new blank scene. After this explanation, you’ll resume the solar system exercise.

Hierarchy and Maya Object Structure

On top of everything you see in Maya (its interface) is a layer you don’t see: the code. The layer of code keeps the objects in Maya organized through a network of nodes. How you relate these nodes to each other defines how you’ve built your scene. So, having a solid understanding of how Maya defines objects and how they interact is essential to an efficient and successful animation process.

Understanding Nodes

At its core, Maya relies on packets of information called nodes, and each node carries with it a group of attributes that in combination define an object. These attributes can be spatial coordinates, geometric descriptors, color values, and so on. You can define, animate, and interconnect any or all of these attributes individually or in concert, which gives you amazing control over a scene.

Nodes that define the shape of a surface or a primitive are called creation nodes or shape nodes. These nodes carry the information that defines how that object is created. For example, a sphere’s creation node has an attribute for its radius. Changing that attribute changes the radius of the sphere at its base level, making it a bigger or smaller sphere. This is different from scaling the sphere as you’ve done with the planets so far. Shape nodes are low on the hierarchy chain and are always child nodes of transform nodes. The sphere applies attributes from its creation node first and then moves down the chain to apply attributes from other nodes (such as position, rotation, or scale).

The most visible and used nodes are the transform nodes, also known as directed acyclic graph (DAG) nodes. These nodes contain all the transformation attributes for an object or a group of objects below it. Transformations are the values for translation (position), rotation, and scale. These nodes also hold hierarchy information about any other children or parent nodes to which they’re attached. When you move or scale an object, you adjust attributes in this node.

Parents and Children

A parent node is simply a node that passes its transformations down the hierarchy chain to its children. A child node inherits the transforms of all the parents above it. So, by using hierarchies for the solar system exercise, you’ll create a nested hierarchy of parents and children to animate the orbital rotation of the nine planets and some of their moons.

With the proper hierarchy, the animation of the planet (the parent) orbiting the Sun automatically translates to the moon (the child). In effect, the planet takes the moon with it as it goes around the Sun.

Child nodes have their own transformations that can be coupled with any inherited transforms from their parent, and these transformations affect them and any of their children down the line.

You’re about to experience this first hand as you continue the solar system exercise. The more you hear about these concepts in different contexts, the easier they will be to master.

Figure 2-19 shows the Outliner and Hypergraph views with a simple hierarchy of objects for your reference. The Outliner and Hypergraph show you the objects in your scene in an outline and flowchart format, respectively. Both of these windows allow you to access the different levels of nodes (the hierarchy) in a scene and are discussed further in Chapter 3.

c02f019.tif

Figure 2-19: A simple hierarchy in both the Outliner and Hypergraph windows

A top parent node called group1 holds its children pCube1, pCylinder1, and the nested group node group2. The node group2 is the parent node of pCone1 and pSphere1.

The Solar System, Resumed

If you still feel a little unsure about nodes and hierarchies, take the time to reread the previous section. You’ll practice these concepts as you resume the solar system exercise. By the time you’ve finished this exercise, you’ll have a strong sense of how hierarchies work in Maya, although you should feel free to repeat the entire exercise if you think that will help you master hierarchies. Understanding nodes and hierarchies is absolutely critical to animating in Maya.

If you’re new to CG animation, take your time with the following section.

Animating Mercury’s Orbit Around the Sun

Load your scene from where you last saved it. When you left off, you had created the self-rotation animation for Mercury and were about to create a second pivot point for the planet to orbit around the Sun sphere by creating a new parent node for the Mercury sphere.

To create a new pivot point by making a new parent node, follow these steps:

  1. With Mercury selected, press E for the Rotate tool and then choose Edit ⇒ Group from the main menu bar (you can also press Ctrl+G). The Channel Box displays attributes for a new node called group1. Notice that nothing about the Mercury sphere changed, except that the Rotation manipulator handle jumped from where it was centered on Mercury all the way back to the origin, where the zero points of the X-, Y-, and Z-axes collide. Figure 2-20 shows the new Mercury group (called group1) and its new pivot location.
    c02f020.tif

    Figure 2-20: Grouping Mercury to itself creates a new pivot point at the origin.

    You just created a new Maya object by grouping Mercury to itself. In doing so, you also created a second pivot point for Mercury, which was placed by Maya at the origin by default. Because an object’s manipulator always appears at the object’s pivot point when it’s selected, Mercury’s Rotate manipulator jumped to the origin when the new parent node was created. That is fortunate for you because that happens to be the center of the Sun sphere—exactly where you need it to be for Mercury to orbit the Sun sphere properly.

  2. Without unselecting anything, click the group1 name in the Channel Box, and change the name of this new group to Mercury_Orbit. It’s important to make the distinction between node names so you never get confused. Now you know that the Mercury node is the planet sphere itself, whereas Mercury_Orbit is the name of the new parent node with which you’ll orbit Mercury around the Sun sphere.
  3. Click anywhere in an empty space in your view window to unselect Mercury_Orbit. Try selecting it again by clicking the Mercury sphere. Notice that when you click Mercury, you select only the planet and not the new parent node Mercury_Orbit, the group that has its pivot point at the center of the Sun sphere. This happens because you’re in Object mode. To select the group Mercury_Orbit, switch into Hierarchy mode by toggling its icon (c02i011.tif) on the Status line at the top of the UI, as shown in Figure 2-21. For more on selection modes, see Chapter 3. Now when you click Mercury, it selects the new Mercury_Orbit parent node you made.
    c02f021.tif

    Figure 2-21: Toggling on the Hierarchy mode

  4. Go back to frame 1 of your animation. Set a keyframe for Mercury_Orbit’s Rotate Y attribute by RMB+clicking its name in the Channel Box and then choosing Key Selected.
  5. Go to frame 240, grab Mercury_Orbit’s Rotate manipulator handle by the green Y-axis, and spin it around the Sun twice in either direction. (It doesn’t matter if you go clockwise or counterclockwise.) You can also enter 720 in the Rotate Y attribute field in the Channel Box (or -720 to go in the other direction).
  6. Set a keyframe at frame 240 for Mercury_Orbit’s Rotate Y attribute, as you did in step 4. Scrub your animation to play it back.
  7. Make sure to switch back to Object mode by clicking its icon (c02i012.tif) in the Status line (Figure 2-21).

Does that make good sense? You’ll have the chance to do this a few more times as you animate the other planets and their moons. However, if you still find yourself a little fuzzy on this concept (which is perfectly normal), repeat the steps to animate Mercury in a new scene file if need be. One down, eight to go.

Creating Venus

For your next planet, Venus, follow the same procedure as for Mercury’s self-rotation (steps 1–6 in the “Mercury’s Rotation” section) and animate it so that it rotates around itself, just like Mercury. Then, create a new pivot point by grouping Venus to itself to create a new parent node (as you did for Mercury_Orbit in steps 1–2 in the previous section) and call the new parent node Venus_Orbit. Lastly, animate Venus_Orbit to revolve around the Sun sphere just as you did with Mercury_Orbit in steps 3–7.

Earth and the Moon

Now you need to animate the third planet, Earth, in much the same way, except that this time there will be the added complication of a moon. (Earth? Hey, I can see my house from here!)

To animate Earth and the moon, follow these steps:

  1. Select Earth and give it its self-rotation animation as you did for Mercury.
  2. Select the moon and give it its own self-rotation animation by spinning it around itself and keyframing it as you’ve just done with Earth.
  3. To spin the moon around Earth, you’ll do as you did earlier in this chapter to orbit a planet around the Sun: first, group the moon to itself by choosing Edit ⇒ Group; then, name the new parent node Moon_Orbit.

This time, however, you need the pivot point to be at the center of Earth and not at the center of the Sun object, where it is currently. Follow these steps:

  1. Turn on the grid snap (c02i005.tif) and press and hold down the D key to be able to move the pivot point. The moon’s manipulator changes from a rotation handle to the Pivot Point manipulator. This manipulator acts just like the Move manipulator, but instead of moving the object, it moves the object’s pivot point as long as you keep the D key pressed. Just don’t rotate the pivot using this Pivot Point manipulator; use just the move handles.
  2. Grab the yellow circle in the middle of the manipulator and move the pivot point to snap it to the grid point located at the center of Earth (see Figure 2-22).
  3. Now release the D key to return to the Rotation manipulator for Moon_Orbit. At frame 1, set a keyframe for the moon’s Y-axis rotation. Then, at frame 240, rotate the moon around the Y-axis and set a keyframe. Return to frame 1.

Grouping the Moon with Earth

To animate Earth’s orbit of the Sun, you need to make sure the moon will also follow Earth around the Sun sphere. Instead of just selecting Earth and grouping it to itself as you’ve done for the other two planets, you need to include the Moon_Orbit node in that group. Follow these steps:

c02f022.tif

Figure 2-22: Moving the moon’s pivot point to the center of Earth

  1. Select Earth. Shift+click the Moon_Orbit group while in Hierarchy mode (c02i011.tif) to make sure you get the topmost node of the moon and then choose Edit ⇒ Group. Name this new parent node Earth_Orbit. Remember, when you select just Earth or the moon in Object mode (c02i012.tif), the Earth_Orbit node isn’t selected. If you select Earth and then Shift+click the moon, you select both objects, but you still don’t select the parent node Earth_Orbit, which is the group that contains both these objects and has its pivot point at the center of the Sun. Make sure you select the right group. Keep an eye on where the manipulator is when you make your selection. If you have the Earth_Orbit node selected, its manipulator should be in the middle of the Sun sphere. I’ll deliberately illustrate this mistake and its consequences when you animate Pluto a little later.
  1. Set a keyframe for Earth_Orbit’s Rotate Y attribute at frame 1, again by RMB+clicking Rotate Y in the Channel Box and selecting Key Selected.
  2. Go to frame 240, spin Earth and the moon around the Sun sphere a few times in whichever direction and for however many revolutions you want, and set a keyframe at frame 240.

Now the first three planets are going around themselves and around the Sun, with a moon for Earth. If you haven’t been saving your work, save it now. Just don’t save over the unanimated version from earlier.

Creating the Other Planets’ Moons

Repeat this animation procedure for the remaining planets and moons, but leave out Pluto for now. (Poor Pluto: first it loses out on being a planet, and now it has to wait for last.)

Auto Keyframe

You can also use the Auto Keyframe feature when animating the planets and moons. Auto Keyframe automatically sets a keyframe for any attribute that changes from a previously set keyframe. For example, an initial keyframe for an attribute such as Y-Axis Rotation needs to be set at some point in the animation. The next time the Y-Axis Rotation is changed at a different frame, Maya will set a keyframe at that frame automatically.

To turn on Auto Keyframe, click the Auto Keyframe icon (c02i013.tif), which is to the right of the Range slider in the lower right of the main UI. When the icon is blue, Auto Keyframe is active.

To use Auto Keyframe to animate the moon orbiting Mars, follow these steps:

  1. Turn on Auto Keyframe.
  2. Start at frame 1. Select the moon of Mars and set a keyframe for its Y-axis orbit by highlighting Rotate Y in the Channel Box and selecting Key Selected.
  3. Go to frame 240. Revolve the moon around Mars several times in a direction of your choosing. Maya automatically sets a frame for Y rotation at frame 240. Save your file.

Using the Outliner

The Outliner is an outline listing of all the objects and nodes in your scene. For an in-depth look at the Outliner, see Chapter 3. For now, let’s look at how to use the Outliner to illustrate the hierarchies for the planets and moons. When all is good and proper, the Outliner should look like Figure 2-23. Choose Windows ⇒ Outliner to open the Outliner window and take a peek at what you have. If you haven’t yet properly named everything, including the moons, take this opportunity to do so by double-clicking a name in the Outliner and entering a new name.

Let’s look at the planet Mars and its layout in the Outliner to better understand the hierarchy for all the planets. All the other planets should be laid out exactly like Mars (except the planets that have just one or no moon).

At the bottom of the hierarchy are Mars’s two moons, mars_moon and mars_moon2. Each of those moons is spinning on its own pivot point. You grouped each moon to itself, created the mars_moon_orbit and mars_moon2_orbit nodes, and placed their pivot points at the center of Mars to animate their orbits around Mars.

c02f023.tif

Figure 2-23: The Outliner view of the planet hierarchies

Mars is spinning on its own pivot point, but it needed another pivot point to be able to orbit the Sun. Because you had to make the moons go with it around the Sun, you selected Mars, mars_moon_orbit, and mars_moon2_orbit (the top nodes of the moons that circle the planet Mars) and grouped them all together, placing that pivot point at the center of the Sun. You called this node Mars_Orbit. This is the parent node because it’s the topmost node for this group. Wherever this parent node goes, the child nodes that are under it will follow.

Hierarchies such as this are a cornerstone of Maya animation. It’s imperative that you’re comfortable with how they work and how to work with them. If you find yourself scratching your head even a little, try the exercise again. A proper foundation is critical. Remember, this learning 3D thing isn’t easy, but patience and repetition help a lot.

Correcting Hierarchy Problems Using the Outliner

One of the most common problems you’ll run into with this project is a planet revolving around the Sun without its moon. To illustrate how to fix it using the Outliner, as opposed to undoing and redoing it as suggested earlier, the following steps will force you to make this error with Pluto. Usually, people learn more from mistakes than from doing things correctly.

Go to Pluto, start the same animation procedure as outlined earlier, and then follow these steps to force an error:

  1. Create Pluto’s own self-rotation by spinning it around itself and keyframing as before.
  2. Do the same for Pluto’s moon’s self-rotation.
  3. Group the moon to itself and grid-snap the pivot point at the center of Pluto to create the moon’s orbit of Pluto.

    When Pluto’s moon (pluto_moon) is orbiting Pluto, you’re ready to group the moon’s orbit and Pluto together to create an orbit of the Sun sphere for both.

  4. Here is where you make your mistake. In Object mode, select the sphere for Pluto’s moon and select the sphere for Pluto. Your error is that you’re in Object mode instead of switching to Hierarchy mode.
  5. Choose Edit ⇒ Group to group them together and call that new node Pluto_Orbit (following the naming convention you used for the others).
  6. Animate Pluto_Orbit revolving around the Sun.
  7. Play back the animation.

Notice that the moon is no longer orbiting the planet. This is because you didn’t include pluto_moon_orbit in your group Pluto_Orbit. The animation of the moon going around Pluto is stored in that node, and because it’s no longer attached to Pluto_Orbit, there’s no moon orbit of Pluto.

Figure 2-24 shows the hierarchy of Pluto and how it’s different from that of the other planets: the moon’s orbit node has been left out of the group. (Earth has been expanded as a contrasting example.)

Using the Outliner, you can easily fix this problem. Place the pluto_moon_orbit node under the Pluto_Orbit node. Go to frame 1 of the animation, grab the pluto_moon_orbit node in the Outliner, and use the middle mouse button to drag it to the Pluto_Orbit node so that it has a white dashed line around it to show a connection, as in Figure 2-25 (left). The proper grouping is shown in Figure 2-25 (right).

c02f024.tif

Figure 2-24: Pluto’s incorrect hierarchy

c02f025.tif

Figure 2-25: Actively regrouping objects in the Outliner (left). Pluto’s moon is grouped properly (right).

You’ve just grouped pluto_moon_orbit under Pluto_Orbit, a practice known as parenting. Now you need to parent pluto_moon under pluto_moon_orbit as well. Use the MMB to drag pluto_moon onto pluto_moon_orbit. When you play back the animation, you’ll see that the moon is revolving around the planet and that Pluto and the moon are orbiting the Sun sphere. Now that you’ve corrected Pluto’s layout in the Outliner, it’s similar to the layouts for the other properly working planets.

The file Planets_v3.mb in the Scenes folder of the Solar_System project on the book’s web page will give you an idea of how this project should look. The first five planet systems are grouped and animated as a reference, leaving the final four for you to finish.

Outputting Your Work: Playblasting

What’s the use of animating all this work and not being able to show it? There are several ways of outputting your work in Maya, most of which involve rendering to images. One faster way of outputting your animation in a simple shaded view is called playblasting. Playblasting creates a sequence of images that play back on your computer at the proper frame rate. Only if your PC is slow or if you’re playblasting a large sequence of frames will your playback degrade. In this case, playblasting 240 frames shouldn’t be a problem.

A playblast, as it’s called in Maya, outputs the view panel’s view into an image sequence or AVI movie. You can also save the image sequence or AVI to disk if you like. Playblasting is done mainly to test the look and animation of a scene, especially when its playback is slow within Maya.

When you have your solar system animated, output a playblast by following these steps:

  1. With your animation completed, click in the perspective panel to make it active in the four-panel layout (don’t maximize the Perspective window). Press 5 to enter Shaded mode.
  2. RMB+click anywhere in the Time slider, and select Playblast ❏ from the context menu, as shown in Figure 2-26. The option box is shown for the Playblast options in Figure 2-27.
c02f026.tif

Figure 2-26: Selecting Playblast

c02f027.tif

Figure 2-27: The option box for creating a playblast preview

  1. In the Playblast options, set Format to qt and Display Size to From Window. Check the Save To File option, and give your playblast a name. Set Scale to 1.0. However, for some Windows users qt is not an option, so you should select avi instead. Mac users should see avfoundation as an option instead of QT for QuickTime output.
  2. Because you checked the qt option, Maya runs through the animation and creates a QuickTime movie file (or an AVI movie file if you selected the avi option) that is based on the Shaded-mode appearance of the currently active view panel (which should be the Perspective panel). Because you also checked the Save To File option, the movie file is saved to disk. By default, it’s saved to the Images folder for the Solar_System project you created on your hard drive. You can also click the Browse button to store the playblast video file anywhere you like. Click the Playblast button.
  3. When Maya runs through the animation, Windows Media Player or QuickTime automatically opens and plays the movie file of the animation at the proper speed of 24fps, as shown in Figure 2-28. Now you can share your animation with others without having to open Maya and play it back in the scene.
    c02f028.tif

    Figure 2-28: Creating a playblast movie file is easy.

Summary

In this chapter, you learned how to start working in Maya by learning how to navigate the UI. Then, you began working by creating a new project, creating basic objects such as primitives, and placing objects in the scene. You learned how to place pivot points for objects and how to use snaps to place points precisely. You gained some experience with the Channel Box and Attribute Editor to set an object’s attributes. You then went on to create simple shaders for your objects and set keyframes to animate a solar system. You explored object hierarchy and grouping conventions to organize your scene better, and finally you learned how to output a basic playblast video file of your completed animation.

The planet animation you created is based on a system of layering simple actions on top of each other to achieve a more elaborate result. Much of your time in actual animation, as opposed to setup or modeling, will be spent adjusting the small things. These small things give the scene life and character. You’ll find that finishing 85 percent of a scene will take about 15 percent of the time. The remaining 85 percent of the time goes into perfecting the final 15 percent of the scene.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset