In this chapter, you're going to start using Maya 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 works.
This chapter will take you through the creation of a Solar System exercise and the mechanics of animating orbits. With this exercise, you'll dive into creating simple objects, setting keyframes, and stacking your animation to get planets and moons to orbit each other and the Sun. This will expose you to object creation, simple modeling, object components, pivot-point placement, grouping and hierarchies, basic keyframing, and timing.
Topics in this chapter include:
Fire up your computer and let's get this project going. This section will introduce you to getting around the Maya user interface (UI). It may seem difficult at first, but it will make sense as you move along.
You'll find everything you ever wanted to know about the interface and more in Chapter 3, “The Maya 2012 Interface.” The overall goal of this chapter is to expose you to Maya UI basics as well as important scene creation and editing tools. You can consider the next chapter a debriefing of sorts, to fill in UI details that aren't covered in this chapter.
KEYBOARD AND SYMBOL CONVENTIONS USED IN THIS BOOK
The following terms are used throughout this book:
Click and LMB+click refer to a mouse click with the primary (left) mouse button.
RMB+click refers to a mouse click with the right mouse button.
MMB+click refers to a mouse click with the middle mouse button.
Shift+click indicates that you should hold down the Shift key as you click with the primary (left) mouse button.
Shift+select indicates that you're holding down the Shift key as you select the next object for multiple selections.
Right-click refers to clicking with the right mouse button.
The symbol next to a menu command indicates that you should click the box () next to the menu command to open the options for that command.
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's title bar, are the UI elements: the Main Menu bar, the Status line, and the Shelf. On a Macintosh system running OS X, note that the Main Menu bar runs at the very top of the screen, above the application's 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; this is where you create and manipulate your 3D objects.
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.
To the right of the panels is the Attribute Editor/Channel Box. This is where most of the information (attributes) about a selected object is displayed and edited. 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. The Attribute Editor is typically wider than the Channel Box, so you'll notice a shift in your view panels when you toggle between them. You can set Maya's preferences to treat the Attribute Editor as its own window, to prevent it from displaying on the right side of the UI. More on this in the next chapter.
Maya is case sensitive in that it distinguishes between lowercase and uppercase letters. The conventions of this book will be to always print an uppercase letter to denote which key you must press, but to specify “Shift + the letter” when you must press the uppercase of that key. In other words, when we ask you to press the E key, for example, you should simply press the E key on your keyboard, lowercase. When an uppercase letter is called for, the book tells you to press Shift+E, requiring you to enter the uppercase letter E into Maya. Make sure your Caps Lock key is turned off.
SHORTCUTS TO NAVIGATING
Here's a rundown of how to navigate Maya. Keep in mind that the Option key is used on a Macintosh in place of the Alt key on a PC:
Alt+MMB+click Tracks around a window. Tracking moves left, right, up, or down in two dimensions; hold down the Alt key, press and hold the MMB, and drag the mouse.
Alt+RMB+click Dollies into or out of a view. A dolly moves the scene's camera in and out of the view, essentially zooming the view in and out. To dolly, hold down the Alt key, press and hold the RMB, and drag the mouse.
Scroll Wheel The scroll wheel, in addition to acting as a middle mouse button, can also dolly into or out of a view just like the Alt+RMB+click combination. Scrolling up dollies in, and scrolling down dollies out.
Alt+click Rotates or orbits the camera around in a Perspective window. Orbiting lets you get around your object to observe it from different vantage points. To orbit, hold down the Alt key and the LMB. This move is called a tumble. You can't tumble your view in an orthographic panel.
Alt+Ctrl+click and Drag Dollies your view into the screen area specified in your mouse drag. Hold down the Alt and Ctrl keys while using the LMB to outline a window in the panel to execute this bounding box dolly. This action is commonly referred to as a window zoom in other applications.
The ViewCube This part of a panel's interface lets you easily change your current panel view from, for example, perspective to side, top, and back to perspective with just a click. By clicking an area of the ViewCube (shown here), you can switch to other views inside that panel. Clicking one of the conical axis markers gives you an orthogonal view from that direction. Clicking the center square gives you the perspective view. You can toggle the ViewCube in the preferences by choosing Window Settings/Preferences Preferences and clicking the ViewCube category.
Macintosh Keys The major difference in keys between a PC and a Mac, as far as Maya is concerned, is that the Option key on a Mac serves the same function as the Alt key on a PC. Although a few Ctrl key combinations in Windows are accessed via the Command key on a Mac, Mac users can generally use the Mac's Ctrl key for their key combinations just as PC users do.
Maya requires the use of a three-button mouse, even on a Macintosh system. The clickable scroll wheel found on most mice can be used as the third button by pressing down to click with the wheel. Scrolling the wheel lets you zoom into or out of a view panel.
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:
Selecting objects in a view panel is as easy as clicking them. If the object is displayed in Wireframe mode, its wireframe turns green while it's selected. If the object is displayed in a Shaded mode, the object's wireframe will appear around the object. Shaded mode is a way of seeing your objects in the view panel with a basic surface, as opposed to a wireframe that you can see through. You'll see this as you do the following exercise.
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. The previous selection's wireframe turns white, and the new selection is now green. If you press Ctrl+LMB (that is, 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.
Remember: Use Shift+click to select, and Maya adds to the current selection. Use Ctrl+click, and Maya deselects the object you clicked on.
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.
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.
Try This Let's put some of this into action, shall we?
Choose Create NURBS Primitives Sphere. Drag in a view panel anywhere on its grid to create a wireframe sphere, and then size it to your liking. In one of the view panels, press the 5 key on your keyboard, and the display of the sphere will become solid gray, as opposed to open wireframe. This is called Shaded mode. Press the 4 key to return to Wireframe mode.
Press 4 for Wireframe mode; press 5 for Shaded mode.
With the sphere selected, select the Move tool () from the Tool Box. The first Manipulator shown 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 about the plane of the view panel, regardless of the axis. When you select a Manipulator handle for movement, it turns yellow. The Free Movement box in the center then turns back to its regular color, cyan.
Next, select the Rotate tool () from the Tool Box, and you'll see the second Manipulator in 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. The Free rotation handle also turns cyan when an axis handle is active.
Now, try selecting the Scale tool () to see the third Manipulator in 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.
Try selecting the Universal Manipulator (). 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.
This project focuses on familiarizing 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 create and animate a simple simulation of our working Solar System. (You may have done this in school using coat hanger wire and Styrofoam balls.) This time-tested tutorial is great practice for getting used to object creation, hierarchies, scene manipulation, UI navigation, and working with objects and selections. It will show you how to set up hierarchies and give you experience in working with the proper nodes within a group to create hierarchically layered animation.
Every smooth operation begins with a good plan. The more research and focused information you gather, the better off you'll be in your work. For this exercise, you need to find out where each of the planets is in relation to the Sun and to the other planets and also how many moons it has.
Starting with the Sun in the center, the planets in order are Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, and Pluto. (We'll label Pluto a planet for old time's sake, even though it was reclassified as a “dwarf planet” by the scientific community in 2006.) All these planets actually orbit the Sun in ellipses, but we'll give them circular orbits for this exercise. Most planets have a number of moons that orbit them, and one, Saturn, has large rings that circle around it.
Earth | 1 moon |
Mars | 2 small moons |
Jupiter | 16+ moons |
Saturn | 3 large rings and 18+ moons |
Uranus | 18 moons |
Neptune | 8 moons |
Pluto | 1 moon |
Creating and animating all those objects may seem overwhelming, but it's a great way to become comfortable with Maya and animation. Because the goal of the project is achievable without making every moon, you'll cut most of them out of your scene and make a maximum of two moons per planet.
The more you run this exercise, the clearer Maya's scene manipulation and hierarchy structure will become to you. Art is a marriage of inspiration, hard work, and practice.
Projects are Maya's way of managing a scene's assets. A file and folder structure keeps your files organized according to projects. You'll have a project for the Solar System exercise.
Start by creating a new project for this assignment. Choose File Project New to open the New Project window. (Figure 2.4 shows the Windows version; the Mac OS X version has the same fields.) Files are organized in a particular way in Maya. The top level of this organization is the Project folder. Within the Project folder are numerous file folders that hold your files. 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 out from your scene. As with clothing and other items around your house, keeping your files and projects organized is a good practice.
NAMING OBJECTS AND KEEPING THE SCENE ORGANIZED
In Maya and most other CG packages, keeping things organized and as clean as possible is more important than you probably realize. Picking up a scene from a disorganized colleague is annoying because it's very time consuming to figure out exactly what is in their scene and how everything works together. Many professional studios have strict naming procedures and conventions to minimize the confusion their artists may have when working in a pipeline. These procedures and conventions are beneficial because many artists will touch the same digital files and assets in the course of a production. Even if you're the only person who will ever see your scene in Maya, it's still a good idea to name and organize your objects. Get into the habit of naming your objects and keeping a clean scene. You'll waste a lot of time if you don't, and you'll be bombarded by dirty looks from other artists when they have to handle your cluttered scenes.
The scene files discussed in this chapter are included on the book's web page, www.sybex.com/go/introducingmaya2012. They are in a project layout explained in the following text. Copy the scene files on the web page for this project into your own Project folders after you create the project.
To create a new project, follow these steps:
The default location for Windows XP, Vista, and Windows 7 is in 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. 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.
After you create projects, you can switch between them by choosing File Project Set 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. Maya by default will list four of your recent projects and scene files on the File menu for easy access.
DON'T FORGET TO SET YOUR PROJECT!
You should make sure to set your project before continuing with your work. The exercises in this book are based on projects, and you'll need to set your project whenever you start a new exercise—otherwise, the scene may not load properly or your files may not save to the proper locations for that project.
As discussed in Chapter 1, “Introduction to Computer Graphics and 3D,” production is typically divided into phases to make workflow easier to manage. In this project, you'll first create the Sun, the planets, and their moons; then, you'll animate their respective orbits and rotations.
The first thing you're going to do is create the Sun and the planets. Follow these steps:
NURBS AND POLYGONS
NURBS and polygons are two types of geometry that you can create and edit in Maya. We'll explore the uses of each modeling type in Chapter 4, “Beginning Polygonal Modeling;” Chapter 5, “Modeling with NURBS, Subdivisions, and Deformers;” and Chapter 6, “Practical Experience.”
Always keep in mind that Maya is case sensitive. An object named “sun” is different from an object named “Sun.”
Maya typically uses an object-naming structure called a humpback style, where words are slung together without spaces. The first letter of a new word in the humpback name is capitalized. An example of humpback style is the name indoorPatioScene. Maya uses this structure when naming nodes, such as the node name nurbsSphere1.
Next, you'll create the primitive spheres you'll be using for the planets. Leave Interactive Creation off, and follow these steps:
Venus | 0.5 |
Earth | 0.5 |
Mars | 0.4 |
Jupiter | 1.0 |
Saturn | 0.9 |
Uranus | 0.7 |
Neptune | 0.7 |
Pluto | 0.15 |
These proportions aren't exactly the same as those found in the real Solar System, but they will do nicely here. Figure 2.9 shows how your Solar System should look now.
No, Pluto isn't actually a planet anymore, but for nostalgia's sake, we'll include it here in our Solar System. Poor Pluto!
Now is the perfect time to start using snaps. Some common snap icons are shown in Table 2.1. Snap icons are explained in greater depth in the next chapter. These icons run across the top of the UI just below the Main Menu bar, as shown here.
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:
SAVING MULTIPLE VERSIONS OF YOUR WORK AND INCREMENTAL SAVING
As you're working on a project, you may want to save multiple versions of your files at various stages of completion. When working in the professional world, you'll find that clients and art directors often reconsider animations you've created—sometimes, it seems, just to make you crazy. So, it's always good to keep as many versions of an animation as you can. Scene files are reasonably small, and hard disk space is inexpensive. Just keep your Scenes folder organized well—for example, by keeping older versions of scenes in separate subfolders—and you should have no problems.
Maya's Incremental Save feature makes a backup of your scene file every time you save your scene. To enable it, choose File Save Scene , and click the Incremental Save box. After you've done this, Maya will create a new folder within your Scenes folder with the name of your current scene file. It will then create a backup of your scene in that folder and append a number to the filename: for example, planets_001.mb. Every time you save your file, Maya will create a new backup until you disable the feature by choosing File Save Scene .
The scene files for the projects in this book are provided on the accompanying web page to give you a reference point for the major stages of each project. These files use a slightly different naming system than the names generated by Incremental Save (for example, the file on the web page is planets_v1.mb instead of planets_001.mb), so there is no risk of files overwriting each other.
For important real-world projects, you may decide to supplement the Incremental Save backups by using Save Scene As to create named files manually, perhaps following a similar naming system with a version number appended, at the stages where you've made significant changes. Whether you do this or use Incremental Save, it's a good idea to keep written notes about the differences in each version of a scene file so that whenever you make a significant change to a file, you have a record of your work.
If you prefer to name files manually, be sure to use an underscore (_) between the filename and version number instead of a space. Using spaces in your filenames can create problems with the software and operating system, especially when you're rendering out a scene.
Now, create the ring for Saturn. To do so, follow these steps:
Now all your planets are complete, and you can move on to the moons.
Changing the original attributes or parameters of an object, as you've just done with Saturn's ring, is often referred to as parametric modeling.
Save your work, unless you like to live on the edge. Saving frequently is a critical habit to develop. Power failures and other unforeseen circumstances (such as your pet jumping onto your keyboard) may not happen often, but they do happen—and usually at the wrong time. (As mentioned in the sidebar “Saving Multiple Versions of Your Work and Incremental Saving,” Maya's Incremental Save feature makes it easy to maintain backups of your work.) 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 .mb (Maya Binary) format.
The file Planets_v1.mb in the Scenes folder of the Solar_System project on the web page shows what the scene should look like at this point.
For the planets with moons, create a new NURBS sphere for each moon. For simplicity's sake, create a maximum of only two moons for any planet. However, feel free to make all the moons for all the planets after you get a handle on this exercise.
The first moon will be Earth's. Use the top view to follow these steps:
To help distinguish one gray planet from another, 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 be color or a tactile texture. You can easily take care of this task using the Hypershade window. Follow these steps:
To rename a node in the Hypershade window, you can also right-click the node's icon and choose Rename from the context menu that appears.
Again, keeping a well-named and -organized scene is critical to a smooth animation experience. It's much more of a chore to root through dozens of unnamed nodes to find the one you want. When you've finished naming all the material nodes, save your work.
SETTING KEYFRAMES
As with many other functions in Maya, you can set a keyframe in several ways. Switch to the Animation menu set by pressing F2. When you're first starting to learn Maya, the best way is to choose Animate Set Key r to display the Set Key Options box. Here, you're selecting the Option box for that menu item by clicking the little empty box to the right of the menu item. The Option box for any particular menu item allows you to set the options for that function. In this case, you're changing the options for the Set Key function.
If you choose Animate Set Key without first changing those options, Maya sets a keyframe for all the keyable attributes for the selected object. Although this may seem convenient, it makes for a sloppy scene, especially if the scene must be heavily animated.
Having keyframes for attributes that may not actually be animated creates unnecessary clutter. In the Set Key Options box shown here, set the Set Keys On option to All Keyable Attributes instead of the default All Manipulator Handles And Keyable Attributes. Set Channels to From Channel Box instead of the default All Keyable. (These attributes will remain grayed out until you change to All Keyable Attributes.) Now, when you choose Animate Set Key, you'll set a keyframe only for the channels that you specify explicitly through the Channel Box, giving you greater control and efficiency. All you have to do is highlight the channel you want to keyframe in the Channel Box and then choose Animate Set Key. Save your settings by choosing Edit Save Settings, and then click Close to close the dialog box.
After you've created the shaders, you can assign the appropriate colors to each of them according to the planet they represent:
Mercury | Orange-brown |
Venus | Beige-yellow |
Earth | Blue |
Mars | Red-orange |
Jupiter | Yellow-green |
Saturn | Pale yellow |
Uranus | Cyan |
Neptune | Aqua blue |
Pluto | Bright gray |
Figure 2.15 shows the shading groups.
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. This way, if you get lost in your animation and need to start fresh, you won't have to re-create everything from scratch. You can return to a previous version of the file and start your animation over.
To begin this phase of the project, load the file Planets_v2.mb 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 orbits 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.
The premise of this exercise deals with hierarchy and pivot points. A pivot point is an object's center of balance of sorts. Every object or node that is created in Maya has a pivot point set at the origin. Because most objects, such as the spheres you created for the planets, appear at the origin upon creation, their pivot points are automatically centered.
When you move an object, as you've done to position the planets and moons, the pivot point moves with it. Therefore, all your planets' and moons' pivot points are already correctly positioned at the center of each planet and moon.
Now, you need to set up your scene file's animation settings:
Choose Window Settings/Preferences Preferences to open the Preferences window. Under Settings: Undo, make sure Undo is on (if it isn't already), and set Queue to Infinite. Setting Queue to Infinite takes a little more system memory, but it's worth it. With this configuration, you can undo (press Ctrl+Z, Command+Z (if you're on a Mac), or just Z) as many times as it takes to undo any blunders. To close the Preferences window, click Save.
Now you're ready to animate Mercury's rotation. Follow these steps:
Clicking so many things just to set two keyframes may seem like a lot of work, but you're doing this the long way right now; you're not yet using any shortcuts or hotkeys. You'll start using those for the next planet.
You have the self-rotation for Mercury worked out. Mercury has no moon, so let's get Mercury orbiting the Sun.
You've learned that every object in Maya is created with a pivot point around which it rotates, from which or to which it scales, and which acts as the placement point for its X-, Y-, and Z- coordinates. To orbit Mercury around the Sun, the sphere must revolve around a pivot point that is placed in the middle of the Sun. If the pivot point for Mercury is already at the center of itself, how can you revolve it around the Sun?
One idea is to move its current pivot point from the center of itself to the center of the Sun. 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 so that Mercury can revolve around that point around the Sun. You'll accomplish this by creating a new parent node above Mercury in the hierarchy. What does that mean?
In order not to get too confusing, we'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, we'll resume the Solar System exercise.
Let's take a timeout from the Solar System exercise and look at how objects and hierarchies work in Maya. On top of everything that 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 defines how you've built your scene. In short, using Maya is essentially programming your computer directly to create 3D objects and animation.
So, having a solid understanding of how Maya defines objects and how they interact is essential to an efficient and successful animation process. This involves getting an intrinsic understanding of how nodes relate, whether it's a straightforward parent-child hierarchy in which one affects the other directly or a more complicated script-driven expression connecting 15 attributes of several objects to simplify a task.
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. Taken together, an object's attributes define it and how it animates. 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 than scaling the sphere as we'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 listens to its creation node attributes first and then moves down the chain to its other nodes' attributes (such as position, rotation, or scale).
Not all primitives are created with shape nodes, so changes at the creation level may not be possible on certain objects; some objects are created without a creation node. When you create a new primitive or an object, make sure the History button () is turned on in the Status line (see Chapter 3 for more about the Status line and its icons). If it displays a small red X in the icon, History is off, and the primitive will be created without a shape node.
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.
Try This As an example of working with transform nodes, you can create a sphere and see what happens in the Attribute Editor as you adjust its position and size. Follow these steps in a new Maya scene:
The tabs along the top of the window let you switch between the nodes that are attached to this object. The current tab should be on the sphere's shape node, called nurbsSphereShape1. This node contains specific information about the object, but it isn't typically a node that you edit.
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.
By creating parent-child relationships, you can easily animate the orbit of a moon around a planet while the planet orbits the Sun. With the proper hierarchy, the animation of the planet orbiting the Sun automatically translates to the moon. 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.
The revolution of one of the planets around the Sun takes into account its moons, but those moons can have their own animation to spin themselves around their planets. You're about to experience this firsthand 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.20 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.
A top parent node called group1 holds its children nurbsCone1, nurbs-Sphere3, and the nested group node group2. The node group2 is the parent node of nurbsSphere2 and nurbsSphere1.
If you still feel a little unsure about nodes and hierarchies, take the time to reread the previous section and try the short exercise again. 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 important to animating in Maya.
If you're new to CG animation, take your time with the following section.
Load up 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 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:
You just created a new Maya object by grouping Mercury to itself. In doing so, you also created a second pivot point for Mercury, in effect, which was placed by Maya at the origin by default. Because an object's Manipulator always centers on its pivot point when it's selected, Mercury's Rotate Manipulator jumped to the origin when the new parent node became selected upon its creation. That is fortunate for you, because that happens to be the center of the Sun—exactly where you need it to be for Mercury to orbit the Sun properly.
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.
For your next planet, Venus, follow the same procedure as for Mercury's self-rotation, and animate it so that it rotates about itself. Then, create a new pivot point (placed by default at the origin) by grouping Venus to itself to create a new parent node for that sphere, and call the new parent node Venus_Orbit. Last, animate Venus_Orbit to revolve around the Sun just as you did with Mercury_Orbit in the previous steps.
Now you need to animate the third planet, the Earth, in much the same way, except that this time there will be the added complication of a moon. In addition, instead of choosing Animate Set Key to set your keyframes, you'll use the keyboard hotkey S. (The Earth? Hey, I can see my house from here!)
Whenever you press S when an attribute is highlighted in the Channel Box, you're essentially choosing Animate Set Key. In the Set Key Options box, be sure you've changed Set Keys On to All Keyable Attributes instead of the default All Manipulator Handles And Keyable Attributes. Also make sure you've set Channels to From Channel Box instead of the default All Keyable, as mentioned in the earlier sidebar.
To animate Earth and the Moon, follow these steps:
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:
To animate Earth's orbit of the Sun, you need to make sure the Moon will also follow Earth around the Sun. 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:
Make sure you use Hierarchy mode () when you click the moon object to select Moon_Orbit and not just the moon sphere. Otherwise, you'll lose the animation of the Moon orbiting Earth.
Now the first three planets are going around themselves and around the Sun, with a moon for the Earth. If you haven't been saving your work, save it now. Just don't save over the unanimated version from earlier.
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.)
If you find that one of your moons is left behind by its planet or that it no longer revolves around the planet, you most likely made an error when grouping the moon and planet. Undo until you're at the point right before you grouped them, and try again. If that still doesn't work, start over from the earlier version of the file you saved just before you began animating it. You'll learn how to fix it in the section “Using the Outliner,” later in this chapter.
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, Maya will set a keyframe at the current frame automatically.
To turn on Auto Keyframe, click the Auto Keyframe icon (), which is to the right of the Range slider. When the icon is red, Auto Keyframe is active.
To use Auto Keyframe to animate the moon orbiting Mars, follow these steps:
USE CUBES INSTEAD OF SPHERES
Feel free to create the planets and moons as cubes instead of spheres. That way, you can see each of their individual rotations much more easily, so you can tell whether the animation is working properly for you.
The Outliner is an outline format 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.24. Choose Window 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 moons).
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.
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.
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:
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 for both.
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.25 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 black horizontal line above and below it to show a connection, as in Figure 2.26.
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 middle mouse button 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, while at the same time Pluto and the moon are orbiting the Sun. 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 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.
You can add objects to a group by MMB+dragging their listing onto the desired parent node in the Outliner. You can also remove objects from a group by MMB+dragging them out of the parent node to a different place in the Outliner.
GROUPING TERMINOLOGY
Grouping terminology can be confusing. Grouping Node A under Node B makes Node A a child of Node B. Node B is now the parent of Node A. Furthermore, any transformation or movement applied to the parent Node B will be inherited by the child Node A.
When you group Node A and Node B, both nodes become siblings under a newly created parent node, Node C. This new node is created just to be the parent of Nodes A and B and is otherwise known as a null node. To group objects, select them and choose Edit Group. Parenting nodes together places the first selected node under the second selected node. For example, if you select Node A, Shift+select Node B, and then choose Edit Parent, Node A will group under Node B and become its child. This is the same procedure as MMB+dragging Node B to Node A in the Outliner, as you did with Pluto's moon and Pluto itself.
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:
When you're creating a playblast, make sure you don't cover the view panel with any other windows, such as an Internet browser, as you wait for the animation to complete. Doing so may create a display error in the playblast output. It's best to allow Maya to complete the playblast before you use the system again.
In this chapter, you learned how to start working in Maya by getting around the interface a bit and 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 had 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 and set up 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. If you work slowly and in segments, animation is more straightforward to produce and generally of higher quality. 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.