Getting Started with Maya
Copyright Notice © 2008 Autodesk, Inc. All rights reserved. Except as otherwise permitted by Autodesk, Inc., this publication, or parts thereof, may not be reproduced in any form, by any method, for any purpose.Certain materials included in this publication are reprinted with the permission of the copyright holder.Portions relating to Graph Layout Toolkit © Copyright 1992-2003 Tom Sawyer Software, Berkeley, California. All rights reserved. Portions relating to TIFF © Copyright 1988-1997 Sam Leffler.
Design|Studio (design/logo), Design Web Format, DWF, DWG, DWG (logo), DWG TrueConvert, DWG TrueView, DXF, Ecotect, Exposure, Extending the Design Team, FBX, Filmbox, FMDesktop, Freewheel, GDX Driver, Gmax, Green Building Studio, Heads-up Design, Heidi, HumanIK, IDEA Server, i-drop, ImageModeler, iMOUT, Incinerator, Inventor, Inventor LT, Kaydara, Kaydara (design/logo), Kynapse, Kynogon, LocationLogic, Lustre, Matchmover, Maya, Mechanical Desktop, MotionBuilder, Movimento, Mudbox, NavisWorks, ObjectARX, Obje
Contents Chapter 1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 About the Getting Started lessons . . . . . . . . . . . . . . . . . . . . . 2 Before you begin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Installing Maya . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Conventions used in the lessons . . . . . . . . . . . . . . . . . . . . . . 4 Using the lesson files . .
Introduction . . . . . . . . . . . . . Creating a new scene . . . . . . . . Primitive objects . . . . . . . . . . . The Toolbox: Layout shortcuts . . . The Toolbox: Transformation tools . The Channel Box . . . . . . . . . . Duplicating objects . . . . . . . . . Save your work . . . . . . . . . . . Beyond the lesson . . . . . . . . . . Lesson 3: Viewing the Maya 3D scene . . Introduction . . . . . . . . . . . . . Camera tools . . . . . . . . . . . . Workflow overview . . . . . . . . .
Adding polygons to a mesh . . . . . . . . Splitting polygon faces . . . . . . . . . . . Terminating edge loops . . . . . . . . . . Deleting construction history . . . . . . . Mirror copying a mesh . . . . . . . . . . . Working with a smoothed mesh . . . . . . Creasing and hardening edges on a mesh . Beyond the lesson . . . . . . . . . . . . . Chapter 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Extruding polygon faces . . . . . . . . . . Deleting polygon faces . . . . . . . . . . . Subdivision surface levels . . . . . . . . . Refining surface components . . . . . . . Creating a crease in a subdivision surface . Beyond the lesson . . . . . . . . . . . . . Chapter 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 . 176 . 177 . 179 . 181 . 183 Animation . . . . . . . . . . . . . . . . . . . . . . .
Extending the length of motion capture data . . Redirecting the motion within a clip . . . . . . Beyond the lesson . . . . . . . . . . . . . . . . Lesson 5: Inverse kinematics . . . . . . . . . . . . . . Introduction . . . . . . . . . . . . . . . . . . . Open the scene for the lesson . . . . . . . . . . Understanding hierarchies . . . . . . . . . . . . Viewing hierarchies using the Hypergraph . . . Creating a skeleton hierarchy . . . . . . . . . . Parenting a model into a skeleton hierarchy . .
Editing cluster weights . . . . . . . . . . . . . . . Creating a blend shape . . . . . . . . . . . . . . Refining deformation effects . . . . . . . . . . . Adding target objects to an existing blend shape . Beyond the lesson . . . . . . . . . . . . . . . . . Chapter 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 . 338 . 340 . 341 . 345 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Open the scene for the lesson . . . . . . . . . Directional lights . . . . . . . . . . . . . . . . Spotlights . . . . . . . . . . . . . . . . . . . Editing light attributes . . . . . . . . . . . . . Shadows . . . . . . . . . . . . . . . . . . . . Creating additional cameras in a scene . . . . Animating camera moves . . . . . . . . . . . Beyond the lesson . . . . . . . . . . . . . . . Lesson 4: Global Illumination . . . . . . . . . . . . Introduction . . . . . . . . . . . . . . . . . .
Preparing for the lessons . . . . . . . . . . . . . Lesson 1: Painting in 2D using Paint Effects . . Introduction . . . . . . . . . . . . . . . . Painting strokes . . . . . . . . . . . . . . Modifying the default brush settings . . . Modifying the canvas . . . . . . . . . . . Modifying the colors of a preset brush . . Editing strokes with tubes attributes . . . Saving brush settings for future use . . . . Blending brushes . . . . . . . . . . . . . . Smearing, blurring, and erasing paint . . .
Using expressions to control multiple attributes . . Linking multiple attributes on the same object . . . Controlling attributes in two objects . . . . . . . . Beyond the lesson . . . . . . . . . . . . . . . . . . Lesson 2: Conditional expressions . . . . . . . . . . . . . Introduction . . . . . . . . . . . . . . . . . . . . . Creating a conditional expression . . . . . . . . . . Other conditional statement options . . . . . . . . Fixing a problem in an expression . . . . . . . . . . Using else statements .
Creating dynamics with MEL commands . . Beyond the lesson . . . . . . . . . . . . . . Lesson 4: User interface creation and procedures . Introduction . . . . . . . . . . . . . . . . . Creating a window . . . . . . . . . . . . . . Window naming . . . . . . . . . . . . . . . Introduction to procedures . . . . . . . . . Loading a script file . . . . . . . . . . . . . Linking the user interface . . . . . . . . . . Saving the script . . . . . . . . . . . . . . . Using the saved script file . . . . . . . . . .
Overview 1 Introduction Welcome to Autodesk® Maya®, one of the world’s leading software applications for 3D digital animation and visual effects. Maya provides a comprehensive suite of tools for your 3D content creation work ranging from modeling, animation, and dynamics through to painting and rendering to name but a few. With Maya, you can create and edit 3D models in a variety of modeling formats and animate your models using Maya’s suite of animation tools.
■ Before you begin–Prerequisite knowledge and skills you should possess before beginning the Getting Started with Maya lessons. ■ Installing Maya–Information on installing Maya. ■ Using the lesson files–How to access and use the lesson files for the Getting Started with Maya lessons. ■ Conventions used in the lessons–Describes the various conventions used throughout the Getting Started with Maya lessons. ■ Using the Maya Help–Outlines the various help resources provided with your Maya software.
to finish or complete only the lessons that correspond to your interests and needs. We recommend that any new Maya user begin by completing the following: ■ Viewing the Essential Skills Movies that are available when you first start Maya. ■ Completing the Maya Basics lessons (Chapter 2) which introduce many fundamental concepts and skills related to the Maya user interface. The version of Getting Started with Maya within the Maya Help also contains Apple® QuickTime® movies for some of the lessons.
Installing Maya You must have Maya installed and licensed on your computer system to successfully complete the lessons in this guide. To operate Maya on your computer you must be running a qualified Microsoft® Windows®, Linux®, or Apple® Mac OS® X operating system with the recommended minimum memory and storage requirements. Maya requires a three button mouse to access its full functionality for menus, commands, and 3D viewing.
Using the lesson files Many of the Getting Started with Maya lessons have accompanying lesson files that were created for use with the lessons. These files are included in the GettingStarted directory that was installed with your Maya software and can be found in the following locations: (Windows XP and Vista, 32 and 64-bit) :\Program Files\Autodesk\Maya2009\GettingStarted (Mac OS X) /Applications/Autodesk/maya2009/GettingStarted (Linux 64-bit) /usr/autodesk/maya2009-x64/GettingStarted Before you
To play the Essential Skills Movies 1 In the Essential Skills Movies window, click the buttons to play a movie. Your computer launches the necessary multimedia player and your chosen movie begins to play. 2 Click your multimedia player’s controls to start, stop, and pause the movie. To close the Essential Skills Movies window or the multimedia player 1 To close the Essential Skills Movies window, click the close box in the upper right corner of the window.
Maya Help Your Maya software application comes installed with Maya technical documentation that assists you in learning the Maya software. The Maya Help is HTML-based, structured by module, fully searchable, and is displayed using your computer’s web browser. The Maya Help is topic based and displays the major functionality categories for Maya. The Maya Help can assist you in finding reference information about particular topics, how to perform specific tasks, and MELTM command references.
The navigation pane updates to display an alphabetic list at the top of the pane with the first index items listed. 3 Click an item/letter in the alphabetic list. The information related to that topic appears in the right pane. To use the Maya Help search 1 Select Help > Maya Help. The Maya Help appears in a separate window (depending on your user preferences). The Maya Search button appears at the top of the left navigation pane. 2 Click the Search button.
To use Popup Help 1 Move your mouse cursor over an icon or button. The name or description of it appears in a popup window directly over it. To turn on the Popup Help if it does not appear 1 If you’re operating Maya on a Windows or Linux operating system: ■ Select Window > Settings/Preferences > Preferences. ■ In the Preferences window, click the Help category and set the Tooltips box to Enable in the Popup Help section so a check mark appears. ■ Click the Save button to close the Preferences window.
To use the Help Line 1 Move your mouse cursor over an icon or button. The icon or button name and instructions about how to use that tool appear in the Help Line. Find Menu The Find Menu feature lets you find the location of a particular menu item. Find Menu works only on the main menu items. To find the location of a main menu item 1 Select Help > Find Menu. The Find a Menu Item window appears.
The Maya Web site The Maya Web site contains a wealth of resources related to your Maya software and many other related products and services. You can view the Maya Web site athttp://www.autodesk.com/maya www.autodesk.com/maya using your web browser. Autodesk Training Autodesk provides a range of products and services to help you get the most from your Maya software.
the prefs directory, your original preferences will be maintained and Maya will create a new prefs directory the next time it is run. 2 Rename your existing user preferences file to a different name; for example, myprefs. The prefs directory path is: Windows (Windows XP) \Documents and Settings\\My Documents\maya\ 2009\en_US\prefs (Windows XP 64bit) \Documents and Settings\\My Documents\maya\ 2009x64\en_US\prefs (Windows Vista) \Users\\Documents\maya\2009\en_US\prefs (Window
Maya Basics 2 Introduction Critical to learning any software application is some initial understanding of the basic concepts: how that software’s world works and the fundamental skills you need to work in that world. If you have never used a three dimensional (3D) software application before, you may initially find Maya different compared to 2D applications.
If you are wondering “where do I begin?”, this chapter is the best place to start. We recommend that you complete the lessons in this chapter so the essential concepts and skills presented become familiar to you.
Lesson 1:The Maya user interface Introduction Just as the driver of an automobile is familiar with the dashboard of their vehicle, it is important for you to become familiar with the Maya “dashboard.” The Maya user interface refers to everything that the Maya user sees and operates within Maya. The menus, icons, scene views, windows, and panels comprise the user interface.
■ From the Windows Start menu, select All Programs > Autodesk > Autodesk Maya 2009 > Maya 2009 (Maya Complete or Maya Unlimited). To start Maya on Mac OS X 1 Do one of the following: ■ Double-click the Maya icon on your desktop. ■ Click the Maya icon in the Dock. ■ From the Apple Finder menu, select Go > Applications and then browse for the Maya icon and double-click it to start Maya. To start Maya on Linux 1 Do one of the following: ■ Double-click the Maya icon on your desktop.
The Maya workspace The Maya workspace is where you conduct most of your work within Maya. The workspace is the central window where your objects and most editor panels appear.
When you start Maya for the first time, the workspace displays by default in a perspective window, or panel. There are the other components of the default perspective view panel: ■ The panel is labeled persp at the bottom to indicate that you are viewing the Maya scene from a perspective camera view. ■ The panel has its own menu bar at the top left corner of the panel. These menus allow you to access tools and functions related to that specific panel.
In Maya, like many other 3D applications, the three dimensions are labeled as the X, Y, and Z axes. The origin is located at X, Y, Z position of 0, 0, 0. The grid also lies along the X, Z plane. We refer to this as a plane because you might visualize an imaginary, flat, two-dimensional square laying along this 3D position. Maya labels the X, Y, and Z axes with a color scheme: red for X, green for Y, and blue for Z.
Main Menu bar Tools and items are accessible from pull down menus located at the top of the user interface. In Maya, menus are grouped into menu sets. These menu sets are accessible from the Main Menu bar. The Main Menu bar appears at the top of the Maya interface directly below the Maya title bar and displays the chosen menu set. Each menu set corresponds to a module within Maya: Animation, Polygons, Surfaces, Rendering, and Dynamics. Modules are a method for grouping related features and tools.
2 Using the menu selector, choose Polygons from the drop-down menu. The main menu changes to display the menu set for Polygons. Menu titles such as Select, Mesh, Edit Mesh, and so on, appear. For now, leave the menu set at Polygons. You will use this set in the next step. To create a primitive 3D object from the Polygons menu set 1 Select Create > Polygon Primitives > Interactive Creation and ensure that a check mark does not appear beside this item. For this lesson, you won’t use this option.
You’ve already learned the first item on the Status line: the Menu Selector used to select between menu sets. The second group of circled icons relate to the scene and are used to create, open, and save your Maya scenes. The third and fourth group of buttons are used to control how you can select objects and components of objects. You will learn more about selection of objects in later lessons. The fifth group of icons are used to control the Snap Mode for objects and components.
To create an object using a tool from the Shelf 1 From the Shelf, select the Surfaces tab in order to view the tools located on that shelf. 2 Select Create > NURBS Primitives > Interactive Creation to ensure that a check mark does not appear beside the item. For this lesson, you won’t use this option 3 From the Shelf, select the NURBS sphere icon located at the left end by clicking on it.
In your scene view the wireframe outline of the cube you created earlier in the lesson has changed color to navy blue, and the sphere is displayed in a bright green color. The sphere is now the selected object and the cube is no longer selected. In Maya, when the object displays like this, we refer to it as being selected or active. Selection of objects and components is a way of indicating to Maya that this particular item is to be affected by the tool or action you will subsequently choose.
To hide or show the Channel Box 1 To hide the Channel Box, click the Show/Hide Channel Box icon from the right end of the Status line. The Channel Box disappears, and the perspective scene view expands slightly. With the Channel Box hidden, you have more working area in your scene view. 2 To show the Channel Box, click the Show/Hide Channel Box icon on the Status line. The Channel Box appears in the scene view.
To copy and set the GettingStarted folder as your Maya project 1 Navigate to the GettingStarted folder that was installed with your Maya software. The location of this folder depends on the operating system that you are using. (Windows XP and Vista, 32 or 64-bit) :\Program Files\Autodesk\Maya2009\GettingStarted (Mac OS X) /Applications/Autodesk/maya2009/GettingStarted (Linux 64-bit) /usr/autodesk/maya2009-x64/GettingStarted 2 Copy the GettingStarted folder.
Maya refers to everything you’ve created in your workspace as the scene. This includes any objects, lights, cameras and materials associated with your working session. To save your Maya scene 1 Select File > Save Scene. A file browser appears, listing the GettingStarted project directory where you can save your scene. If the GettingStarted directory does not appear, you need to copy the GettingStarted folder and set it as your Maya project. See Copying and setting the Maya project on page 25.
Beyond the lesson In this lesson you began your orientation to Maya by learning: ■ How to start Maya on your computer. ■ The Maya workspace, and how it shows three dimensional space (X, Y, Z). ■ How Maya color-codes items and tools related to X, Y, Z. ■ The location of the main menus for the various modules within Maya. ■ How to create a three-dimensional object from the Polygons menu. ■ The location of the Status Line and how items are displayed as icons.
Lesson 2: Creating, manipulating, and viewing objects Introduction Using primitive objects to model 3D forms is a great place to continue learning about Maya. You can create many types of 3D objects using Maya and then move, scale, and rotate them to create more complex forms in your scene. In this lesson, you begin to construct a classic temple using the primitive object creation tools in Maya.
■ Undo actions when you need to undo a particular task or step. Creating a new scene You begin your temple project by creating a new empty scene. To create a new scene 1 Start Maya (if it is not already running). When Maya starts, it automatically creates a new scene. If Maya was previously running, follow steps 2 and 3. 2 From the main menu, select File > New Scene. Maya displays the following prompt. 3 Click No. Maya creates a new scene and delete everything that was in the previous scene.
■ Move, scale, and rotate the primitive object into its final position either by direct manipulation (the move, scale, and rotate tools), or by entering numeric values through an editor. ■ Duplicate the primitive objects to create multiple copies of the original or create different variations from your original primitive object. In this section, you construct the base for the temple using a polygonal cylinder primitive.
Maya creates a cylinder primitive object that is octagonal in shape and positioned at the center of the Maya workspace. This cylinder is 20 units wide by one unit high, and has eight faceted sides. NOTE You were instructed to reset the option settings as a precaution in case they had been set differently. This is a good habit to practice when working with tool options to avoid getting a result that was different from what you expected.
The workspace changes to a four-view layout. The perspective view is located in the top right corner and the other views show the object from the top, front and side. The layout shortcuts have other options that you will learn later in this tutorial. It’s now possible to see the base from the side view, but it would be easier to determine the position of the base if the side view were enlarged to a full view.
TIP You can position your mouse cursor in any scene view and tap the spacebar once to toggle the view. If the view is a full panel view, it will change to a four panel view and vice versa. The Toolbox:Transformation tools You need to move the base slightly upwards in the Y direction so it is positioned on the X, Z plane. To do this you use the Move transformation tool located in the Toolbox.
box around some portion of the object to indicate what you want selected. To deselect an object, you simply click somewhere off of the selected object. To select the base primitive object in the scene view 1 Do one of the following: ■ With your left mouse button, click the object’s wireframe outline in the scene view. ■ With your left mouse button, drag a bounding box around one corner or edge of the object’s wireframe.
The base cylinder now needs to be rotated slightly so the front of the base is parallel to a grid line. Since each facet of the octagon represents 45 degrees of a circle, you need to rotate the object approximately half of that amount or 22.5 degrees. To use the Rotate Tool to adjust the position of the base 1 Display all four views by positioning the mouse cursor in the view and tapping the spacebar of your keyboard. The four view panel appears.
You are rotating the cylinder around its Y axis. You may be asking yourself the question “How do I know if I’ve rotated the base exactly 22.5 degrees?” You can check the accuracy of the rotation by viewing the Channel Box. Rotate Y should be close to 22.5 degrees. TIP You can undo and redo the last action you performed. Undo reverses the last action you performed on a selected object. It also reverses any action you performed from the Edit Menu. To undo an action select, Edit > Undo, Redo, Repeat.
To move and rotate the base using the Channel Box 1 With the base cylinder selected, view the Transformation attributes in the Channel Box. Specifically, view the values for Translate Y, and Rotate Y. 2 In the Channel Box, adjust the attribute values so they match the above image by clicking in the field and entering the correct numerical values. This accurately positions the base in your Maya scene. Maya named the cylinder primitive when it was first created.
Duplicating objects Duplicating an existing object is a useful way to make an exact copy of it without having to start over. When you duplicate an item the copy takes on the characteristics of the original. Using the Duplicate Tool you can additionally apply transformations to the copy (move, rotate, scale). Return to a four view layout to view what you’ve accomplished to this point. To change the panel layout to a four view layout 1 From the Toolbox, click the Four View layout shortcut.
3 In the Duplicate Special Options window, select Edit > Reset Settings and then set the following options: ■ Translate: 0 1.0 0 ■ Rotate: 0 0 0 ■ Scale: 0.9 1.0 0.9 ■ Geometry Type: Copy ■ Group under: Parent 4 In the Duplicate Options window, click Duplicate Special. Maya creates a duplicate of the templeBase object that is scaled to 0.9 of the original in the X, Z axes, and is one unit above templeBase. As a result of the scale operation, the base for the temple now appears stepped.
If you do not see the GettingStarted project directory, you have not yet copied the GettingStarted folder and set it as your Maya project. For more information, see Copying and setting the Maya project on page 25. 2 Within the GettingStarted project directory, ensure that you are saving in the scenes sub-directory. 3 Type Lesson2Base in the file name text box. 4 Click Save.
■ Try using the ViewCube™ located in the upper-right corner of the active scene view to change the camera’s viewing angle in relation to the objects in the scene. ■ Practice moving, rotating, and scaling objects, and changing between the various scene views (single perspective, four view, single side, single top etc.) Lesson 3:Viewing the Maya 3D scene Introduction In the previous lesson you learned how to view your 3D scene by changing between single and four view layouts.
■ Display objects in both wireframe and shaded modes. ■ Use additional primitive objects and options. Camera tools In the lessons so far, when you looked at an object from the top, front, or side views you have been viewing the scene through an orthographic view. Orthographic views appear two-dimensional because the object is displayed using parallel projections of only two axes at a time.
The three primary methods for manipulating the camera view are dolly, tumble, and track. Dolly Tool The Dolly Tool gets its name from filmmaking where a camera, mounted on a wheeled tripod, is moved towards or away from the scene. In Maya, dollying allows you to view the items in your scene either close up or from further back. To dolly the perspective view 1 Enlarge the scene view to a single perspective view.
TIP If you make an error when adjusting your camera view of the scene, you can reset the camera to its default home setting. To reset the camera view for a particular orthographic or perspective view: From the panel menu, select View > Default Home. Tumble Tool The Tumble Tool allows you to tumble or rotate the camera’s view around a particular center of interest to achieve either a higher or lower vantage point, or a different side angle.
Track Tool The Track Tool allows you to move the camera up, down, or sideways in relation to the scene. To track the perspective view 1 Press the Alt key (Windows & Linux) or the Option key (Mac OS X) and drag the mouse in any direction, while holding down the middle button on your mouse. The Track Tool works for both orthographic and perspective views.
To create a polygonal cube for the pedestal 1 From the Main Menu, select Create > Polygon Primitives > Cube > . 2 In the Polygon Cube Options window, select Edit > Reset Settings and then set the following options: ■ Width: 1.75 ■ Height: 0.6 ■ Depth: 1.75 Leave the other options at their default settings.
5 In the Channel Box, rename the cube columnPedestal. To create a polygonal cylinder for the shaft 1 From the main menu, select Create > Polygon Primitives > Cylinder > . 2 In the Polygon Cylinder Options window, select Edit > Reset Settings and then set the following options: ■ Radius: 0.5 ■ Height: 6 ■ Axis divisions: 12 Leave the other options at their default settings 3 In the Polygon Cylinder Options window, click Create. Maya creates the cylinder primitive at the origin.
5 In the Channel Box, rename the cylinder columnShaft. The capital for the column rests on top of the column and is very similar to the pedestal. You duplicate the pedestal and position the duplicate at the top of the column. To duplicate the pedestal to create the capital 1 With only columnPedestal selected, select Edit > Duplicate Special > from the main menu. The Duplicate Special Options window appears.
4 In the Channel Box, rename the duplicated cube columnCapital. The base for the column rests on top of the pedestal. You will create the base using one half of a NURBS sphere primitive and then move and rotate it into position. You will do this by modifying the creation options for the sphere primitive. To create a NURBS sphere for the column base 1 Select Create > NURBS Primitives > Sphere > .
This is accomplished by either of the following methods: ■ Rotating the sphere about the X axis using the Rotate Tool’s manipulator handle. ■ Using the Channel Box to change the Rotate X value to -90. 2 Move the sphere so it rests on the top surface of columnPedestal (Translate Y = 2.6, if you have been inputting values into the Channel Box). 3 Using the Scale Tool, scale the sphere along its Z axis (blue manipulator handle) so that the sphere becomes slightly squashed in appearance.
wire outline that indicates their position and general shape. Maya provides several options for displaying objects in a shaded manner. Change the display of your scene so that the objects display as shaded objects. To display the objects in smooth shaded mode 1 Enlarge your perspective view, and dolly and tumble the scene so you can easily view what you’ve completed so far. 2 From the panel menu, select Shading > Smooth Shade All. The objects in your scene display in an opaque dark gray color.
To group the objects for the column 1 Select the four objects that comprise the column simultaneously by doing one of the following: ■ With your left mouse button, shift-click each object in turn until the four objects are selected in the scene view. ■ With your left mouse button, drag one large bounding box around the column objects in an orthographic view. It is important that you do not select any of the templeBase objects as part of your selection.
3 At the top of the Hypergraph panel, select the Scene Hierarchy icon to ensure the Hypergraph is displaying the scene hierarchy. 4 In the Hypergraph panel, select View > Frame All. The Hypergraph displays the hierarchy for all of the objects in the scene. This approach to viewing the entities in the scene provides a very graphical approach to viewing all of the various nodes in your scene.
To rename the parent node in the Hypergraph 1 In the Hypergraph, click on the group1 node so it becomes active. In the scene view, all of the objects in the column group become selected as a result of selecting the group at the top (parent) level of the hierarchy. 2 In the Hypergraph, right-click the top node representing group1 and select Rename from the pop-up menu. A small text box appears in the node. 3 Enter Column as the new name.
With your first column in position, you can now create a copy of the column and position it on the adjacent corner of the base. To create a duplicate copy of the column 1 With Column still selected in the Hypergraph, select Edit > Duplicate Special > from the main menu. The Duplicate Special Options window appears. 2 In the Duplicate Special Options window, select Edit > Reset Settings and then set the following options: ■ Number of Copies: 1 Leave the other options at their default settings.
3 From the Toolbox, click the Four View layout shortcut. The workspace changes to a four view layout and the Hypergraph is no longer displayed. Selection modes and masks It isn’t always efficient to have the Hypergraph window open when you want to select an object at a particular level within its hierarchy. Maya allows you to select items in different selection modes depending upon your specific needs. There are three main types of selection modes: Hierarchy, Object and Component.
TIP If you set the selection mask, it will remain that way until you change it again. If an item won’t select for you in Maya, you should check the selection mask setting to see if it is set correctly. To use the Hierarchy and Combinations selection mask 1 On the Status Line, choose the Select by Hierarchy and Combinations icon The Selection Mask icons update to display the three selection choices. 2 On the Status Line, choose the Select by hierarchy icon.
3 In the Group Options window, select Edit > Reset Settings. Set the following options: ■ Group Under: Parent 4 In the Group Options window, click Group. Maya groups the objects together in a hierarchy and the pivot point is positioned at the origin. (When the pivot point is relocated to the origin the Move Tool manipulator for the selected group appears at the origin.
Save your work Your temple is taking shape! Save your work before proceeding to the next lesson. To save your Maya scene 1 To save your Maya scene, select File > Save Scene As. 2 Type Lesson3Columns in the file browser area reserved for file names. 3 Click Save. Beyond the lesson In this lesson, you explored additional tools and skills within Maya as you continued with the construction of the classic temple.
■ Practice moving and rotating objects, and changing between the various scene views (single perspective, four view, single side, single top, and so on). ■ View objects in the Hypergraph so you can understand their relationships and hierarchy. Lesson 4: Components and attributes Introduction Working with components is an important part of the workflow when working in Maya. Components describe objects at a more detailed level.
To template the base and columns 1 In the side view, with the Selection Mask set to Hierarchy, select all the objects in your scene. 2 From the main menu, select Display > Object Display > Template. The selected objects become templated. For your classic temple, you need to create the entablature using a torus primitive. An entablature is a structure that lies horizontally upon the columns of a temple and supports the roof.
Components All objects in Maya have a transform and a shape node. Geometric shapes, like the primitives in this tutorial, have smaller parts called components. A few examples of components in Maya are control vertices, faces, and hulls. Components allow you to work with objects at a finer level and allow you to edit them in creative ways. In order to change the shape of the entablature beyond the basic scale transformations, you need to modify its component information.
The menu that pops up is a marking menu for quickly selecting operations relevant to the object where you right-click the mouse. In this case, the choices pertain to the display of the entablature’s components. A set of small blue squares appear on Entablature called control vertices. Control Vertices (CVs) describe the shape of an object based on their position in space. If you move any combination of these vertices, you change the shape of the object.
■ Number of Spans: 4 In the NURBS Sphere Options window, click Create. 3 Rename the half-sphere templeRoof. The roof needs to be rotated -90 degrees about the X axis and positioned on top of the entablature. To rotate and position the roof on the entablature 1 In side view, rotate the roof so that the dome part is pointing up. 2 Move the roof so it is positioned close to the top edge of Entablature.
3 In the scene view, drag a selection box around all the objects in the scene so that the templated objects are selected simultaneously. 4 From the main menu, select Display > Object Display > Untemplate. 5 On the Status Line, choose the Select by hierarchy: root button. The Attribute Editor The Attribute Editor provides information about the various nodes and attributes for the objects and materials in your scene.
3 Click the templeRoof tab to see its attributes. This tab is known as the transform node, because the most important attributes on this tab control templeRoof’s transformation. Every visible object in Maya has a transform node, including cameras and lights. 4 Click the templeRoofShape tab to see its attributes. This tab is called the shape node because the attributes establish the object’s geometric shape or physical properties when the object is first created.
Surface materials The color, shininess, and reflectivity attributes of an object are controlled by its surface material (sometimes referred to as a shader, or shading material). Material attributes relate to how the object simulates a natural reaction to light in Maya’s 3D computer world. Maya assigns a default shading material to all objects when they are first created. In this section, you learn how to assign a new material to your objects.
inventor of this shading algorithm) provide for high-quality specular highlights on surfaces. 5 In the Attribute Editor, rename the blinn1 shading material to templeShader. With a shading material assigned to all the objects, you need to edit the color attributes of the templeShader material. To edit the shading material’s attributes 1 In the Attribute Editor, click in the gray box to the right of the word Color. The Color Chooser appears.
2 Click inside the color wheel (hexagon) and drag the pointer to achieve a sand color. The exact color is unimportant for this lesson. As you adjust the color wheel indicator, the temple objects become the same color you select in the Chooser. 3 Click Accept to close the chooser. You will learn more about Maya’s shading and texturing capabilities in future lessons. 4 In the Attribute Editor menu, choose the Selected menu item, and select templeBase from the list.
Save your work You have completed this lesson. Save your work before proceeding. To save your Maya scene 1 Select File > Save Scene As. 2 Type Lesson4Final in the file browser area reserved for file names, and then click Save. Beyond the lesson In this lesson, you completed the construction of the classic temple and learned how to: ■ Display objects in template mode. ■ Select objects at their component level using selection masks and the right mouse button.
72
Polygonal Modeling 3 Introduction In Maya, modeling refers to the process of creating virtual 3D surfaces for the characters and objects in the Maya scene. Surfaces are vital for creating a convincing 3D image. Modeling is a process requiring keen visual skills and mastery of the modeling tools. The more accurate you are when modeling your forms in terms of size, shape, detail, and proportion, the more convincing your final scene will be.
Polygon surfaces are a network of three-or-more sided flat surfaces called faces that get connected together to create a poly mesh. Polygon meshes are comprised of vertices, faces, and edges. The wireframe lines on the mesh represent the edges of each face. The regions bounded by the edges are faces. Where the edges intersect each other is the location of a point called a vertex. When a polygon mesh is rendered, its edges can be set to appear hard or smooth.
6 As you work through this lesson, remember to save your work frequently and increment the name of the file every so often (filename1, filename2, and so on). In this way you’ll have earlier versions of your work to return to should the need arise. 7 Make sure that Soft Selection is turned off by opening the Attribute Editor with the Select Tool active and unchecking the box marked Soft Select.
■ Create polygon faces by placing vertices ■ Scale and extrude faces on a polygon mesh ■ Move and rotate extruded polygonal meshes ■ Split vertices and subdivide polygonal faces ■ Combine separate meshes into one mesh ■ Bridge between meshes ■ Add faces to an existing mesh ■ Use Snap to Grid ■ Preview a smoothed high resolution version of a polygon mesh ■ Harden and soften polygon edges Setting modeling preferences Before you create your polygon model change some of the default settings
dot). In addition, when a face is selected in the scene, the entire face appears highlighted. 5 Click the Save button to close the settings window. 6 Turn off the Interactive Creation option for primitives: Select Create > Polygon Primitives > Interactive Creation (no check mark).
To load reference images into the front and side orthographic views 1 In the Toolbox, click the Four View shortcut from the Layout Shortcuts bar. The perspective view is located in the top right corner and the other views show your scene from the top, front, and side. 2 In the front view panel menu, select View > Image Plane > Import Image. 3 Select the image file named HelmetFront.jpg.
NOTE The front and side images for this lesson were created so that the two views are aligned and the height of each image is identical. When you import them as image planes, they appear at the same scale. These are important considerations when you construct your own reference images in the future. Otherwise, your reference images may not align or may be at different scales between the two orthographic views.
TIP You can change the Alpha Gain at any time if you want the image planes to appear more or less transparent. 6 In the perspective view’s panel menu, select Show > Cameras to temporarily turn off the display of the image planes in the perspective view. Creating a polygon primitive You’ll create the top portion of the helmet mesh from a cube primitive using the image planes as a reference. Primitive objects are one method for starting 3D meshes because they can be modified to create other forms.
■ Height divisions: 2 ■ Depth divisions: 1 4 Click the Create button. A cube primitive is created at the origin with the dimensions you specified and one subdivision around the middle. This cube primitive is comprised of four-sided polygon faces called quads. Quad polygons are used frequently with 3D character models as they are easily smoothed and deform well when bound into a skeleton.
The polygon faces are still four-sided even though their shape and position have been modified by the smooth operation. NOTE If the top, domed portion of the smoothed cube doesn’t roughly match the helmet sketches as indicated in the image below, scale the cube with the Scale Tool to make it match. To rename the polygon mesh 1 With the cube still selected, rename the cube primitive using the Channel Box from pCube1 to helmetmesh.
Modeling in shaded mode Modeling a polygon mesh in shaded mode gives you a better sense of the 3D volume that the model occupies as well as how any surface details appear. You can control the shading of an object separately in each view. For example, you can display the object as shaded in the perspective view only, and set the orthographic views to display objects in wireframe mode. You can also set the display settings to show both a shaded and wireframe display simultaneously.
To display the helmet mesh in shaded X-Ray mode 1 With the helmet still selected, choose the following from the side view’s panel menu: ■ Shading > Smooth Shade All ■ Shading > Wireframe on Shaded ■ Shading > X-Ray. The helmet mesh updates to a semitransparent shaded display with the wireframe. You can see the 2D image behind the mesh. 2 Repeat the previous step for the front view as well.
To delete the faces on the left half of the mesh 1 In the top view, right-click on the mesh and select Face from the marking menu that appears. 2 Drag a bounding box around the faces on the left half of the helmet mesh to select them. 3 Press the delete key. The selected faces are deleted. You now have half as many components in your model. When you near the completion point of the model, you will copy the finished half across the axis of symmetry to get the complete model.
2 In the side view, right-click the helmet mesh and select Face from the marking menu that appears. 3 In the side view, paint select the faces that appear along the front and lower areas of the mesh (see image) by dragging the mouse over the faces. NOTE The Paint Selection Tool only selects components on the mesh that face towards the camera. 4 Press the delete key to delete the selected faces. 5 Tumble the perspective view to review your work so far.
Selecting edge loops In the top view, the rows of edges immediately above and below the X axis, and the row to the right of the Z axis are not straight. You’ll want to align the edges in these rows (referred to as edge loops) by snapping them to the grid using the Move Tool. An edge loop is a path of polygon edges that are connected in sequence by their shared vertices. Edge loop selections are very useful when you model using polygons.
6 In the top view, click-drag the blue arrow on the Move Tool manipulator downwards a small distance. The edge loop immediately snaps to a lower grid line. It is not positioned at the location you want, but all of the edges in the loop you selected are now aligned to each other. 7 On the Status Line, turn off the Snap to Grids feature by clicking its icon.
Editing components in the orthographic views Component selection and transformation is one fundamental method for editing the shape of a polygon mesh. As you model, you’ll find yourself frequently examining and then refining the position of the polygon components (vertices, edges, and faces) while working in the various scene views so they match the reference images on the image planes.
5 Repeat steps 2 through 4 for the other pairs of vertices on the rear of the helmet. Ensure that the edge loops appear smooth in relation to each other. When you have finished, the back region of the helmet should closely match the reference image on your image plane. 6 In the side view, select other pairs of vertices along the top and front of the helmet and move them in a similar fashion so they match the reference image. Do not reposition the vertices for the top of the face shield yet.
Next, you’ll reposition the border edges that lie along the bottom edge of the mesh. You can select these edge types using the Select Border Edge Tool. To reposition the lower border edges on the helmet 1 In the side view, select the lowest horizontal edge loop on the helmet by choosing Select > Select Border Edge Toolfrom the main menu, and then clicking the first and then the last edge on the loop as indicated in the image below.
NOTE Up to this point in the lesson, you’ve been instructed to reposition the vertices on the helmet mesh only within the side view (Y, Z plane). Once you achieve the shape you want in the side view you will then concentrate on how the model appears when viewed from the front and perspective views. To edit the border edges on the upper edge of the face shield 1 From the Select menu, choose Select Border Edge Tool.
5 With the border edges still selected, click the Move Tool again and drag the green manipulator upwards to match the location of the border edges in the reference sketch. 6 Reposition the pairs of vertices on the upper front of the helmet to match the reference sketch.
At this point in the lesson, the outline of your helmet should roughly match the helmet in the side view reference image. If it doesn’t, review the earlier steps in this lesson and make any adjustments to your polygonal mesh as required. If you view your helmet in the front orthographic view, you’ll notice that the helmet shows a wider profile from this view than the reference sketch. In the next steps you’ll correct this using the front and top orthographic views of the helmet for reference.
3 In the front view, move these vertices to the left until they match the widest area of the helmet in the reference sketch (see image). When you view your helmet from the top orthographic view the region between the side and rear of the helmet appears a bit flat in relation to the other areas. To correct this you can move the other vertices in this region outwards in a similar fashion so the curvature in this area appears fuller and more rounded.
Editing components in the perspective view Repositioning polygon components in the perspective view can be more challenging when compared to the orthographic views because your frame of reference changes as you track, dolly, or tumble the 3D view. By default, the Move Tool lets you reposition components in relation to world space coordinates. That is, the movement of a component is referenced to a direction based on the center of the 3D scene and the X, Y, or Z axes.
4 In the perspective view, click the vertex you wish to reposition. The vertex highlights and the Move manipulator appears to indicate the three directions of movement that are possible in this mode. The U and V handles slide the vertex in relation to its associated edges, while the N handle moves the vertex either away or towards the mesh depending on the direction you move your mouse. 5 Drag the N handle outwards or inwards depending on what’s required for that particular vertex.
Drawing a polygon To create the lower front region of the helmet (that is, the region that would protect the mouth and jaw of the wearer) you’ll create a polygon for the cross section of the lower front region by manually placing vertices using the Create Polygon Tool (Mesh > Create Polygon Tool). To place vertices for a polygon 1 In the side view, select Mesh > Create Polygon Tool > . The Create Polygon Tool settings editor appears.
4 Press the q key to quit the Create Polygon Tool when the polygon face is complete. The new polygon component remains selected in Object Mode. NOTE If the polygon face doesn’t appear shaded in the side view but does appear shaded in the perspective view, it means that the polygon face and the image plane lie on exactly the same plane.
Extruding polygon components You can create new polygon components from existing ones using the Extrude feature (Edit Mesh > Extrude). When you extrude a polygon component (for example, a face, edge, or vertex), you create additional polygon components from the ones you selected. Using the Extrude feature you will: ■ Create the lower front region of the helmet by extruding the polygon face you created in the last section of the lesson.
TIP As you change the angle of rotation and extrude the mesh you can also momentarily switch between the move or scale manipulators to fine tune the position and scale of each section as you extrude it. 6 Press the g key once again and create a third extruded region using the manipulator to move, rotate, or scale the extruded segment of the mesh so you position it correctly when compared to the reference sketch (see image).
2 Select the faces that appear on the inside of the mesh you just extruded, including the faces on either end of the extrusion. These faces were required for creating the extruded portions of the lower region but are not needed beyond this point. 3 Press the Delete key to delete the selected faces. When you are finished, a gap will exist between the last extruded segment of the lower region and the helmet mesh.
To extrude the bottom edges of the helmet mesh 1 In the perspective view, select the lower edges of the helmet mesh using Select > Select Border Edge Tool. 2 Select Edit Mesh > Extrude, then drag the blue arrow manipulator in a direction towards the inside of the helmet to create a row of edges that are perpendicular to the selected bottom edges. Extrude these edges a distance that is approximately one grid unit in depth (see image below).
To move vertices on the lower front region to match the reference sketch 1 In the perspective view, right-click on the helmet and select vertex mode to change the selection type to vertices.
Bridging between edges Next you’ll connect the lower front region to the helmet mesh. You can create meshes that bridge between one or more border edges of a mesh using the Bridge feature (Edit Mesh > Bridge). When using the bridge feature you must ensure that: ■ the edges to be bridged are in the same polygon mesh. That is, you must combine the two meshes into one using the Combine feature, before you perform the bridge.
has three. You can increase the number of edges on the lower side region by inserting two edge loops across the mesh. Inserting two edge loops in this region of the mesh also divides the large faces so they better match the size of the other faces on the rest of the mesh. To insert edge loops on the side region of the helmet 1 Select Edit Mesh > Insert Edge Loop Tool > . The Insert Edge Loop Tool settings editor appears.
5 Press the q key to return to selection mode, and click anywhere off the mesh to unselect the edges. Now that you’ve inserted the necessary edges, you can proceed with creating the bridge. To bridge between the lower front and side region of the helmet 1 Choose Select > Select Border Edge Tool and then click the border edges on both the lower front as well as the side region of the mesh where you want the bridging mesh to be constructed. (You should have five edges selected on either side).
2 Select Edit Mesh > Bridge > . 3 In the Bridge Options window, set the Divisions to 0, then click the Bridge button to create the bridge. 4 Press the q key to return to select mode, and click anywhere off the mesh to unselect the edges. NOTE If your bridge appears to twist or cross over itself it indicates that the two meshes have their surface normals mismatched.
2 Select Edit Mesh > Append to Polygon Tool > . 3 In the Append to Polygon Tool settings window, set the following: ■ Keep new faces planar: Off If the planar option is on, the Append to Polygon Tool will not create a multi-sided polygon as the edges you’ll select do not form a planar region.
Ideally, all faces should be four-sided to match the other faces on the helmet mesh. In the next section, you'll split the n-gon vertically and horizontally into several smaller four-sided polygons using the Split Polygon Tool. Splitting polygon faces Earlier in the lesson you split the helmet mesh by inserting edge loops across the mesh. You can split localized areas of a mesh using the Split Polygon Tool. When using the tool you draw a line across the faces to indicate the location for the split.
3 Tumble the camera in the perspective view so you can view both the upper inner edges of the face shield as well as the lower inner edges. 4 Click-drag the top inner edge of the face shield to indicate the start of the split (see image below). Drag the mouse to position the vertex until it stops at the right side of the edge. 5 Click-drag on the lower inner edge of the helmet mesh to indicate the end of the split (see image). Drag the mouse to the right until the vertex stops at the right side of the edge.
To split the face shield horizontally 1 In the perspective view, with the Split Polygon Tool still active, click-drag the inner side edge (see image) to indicate the start location for the horizontal split. 2 In the side view, click-drag the front vertical border edge of the face shield (this border edge lies on the axis of symmetry) and release the mouse button at the mid-point along the edge where the vertex naturally snaps (as if a magnet were attracting it towards that location).
NOTE When you split across multiple faces at the same time you only need to click an edge to indicate the start point for the split and on a second edge to indicate the end point. The Split Polygon Tool automatically splits the edges in between. 4 Press the q key to quit the Split Polygon Tool. In the next steps you'll reposition some of the vertices along the horizontal split to make the face shield protrude outwards a small amount.
TIP Tumble the perspective view so you can see the relationship between the vertices as you move them outwards. 3 Reset the Move Tool's Move Settings to World before continuing to the next steps. To create the diagonal grill vents on the lower front of the helmet you’ll insert edges on the face, reposition some of the vertices, and then extrude some of the faces. To insert multiple edges for the diagonal grill vents 1 Select Edit Mesh > Insert Edge Loop Tool > .
4 Press the y key to complete the edge loop insertion 5 Click off the mesh to deselect the edges. 6 Press the q key to exit the tool and return to selection mode. To make the grill vents appear diagonally you’ll select the vertices on the right side and then slide them downwards using the Move Tool. To move vertices along an edge using the Move Tool 1 Right-click the helmet mesh and change the selection mode to Vertex. 2 Select the vertices on the right side of the grill feature (see image below).
6 Drag the red arrow on the Move manipulator downwards to move the vertices so that the shape of the faces for the grill are more diagonal (see image). NOTE Make sure you do not move the vertices so that the lowest vertex touches the corner vertices or you’ll create an edge that has zero length. 7 Click off the mesh to deselect the vertices. 8 Before proceeding to the next section, double-click the Move Tool and reset the tool settings by clicking the Reset Tool button.
3 Select Edit Mesh > Extrude. The Extrude manipulator appears. 4 Drag the blue arrow on the Extrude manipulator towards the helmet a short distance to create the two recessed vents for the grill. 5 Press the q key to quit the Extrude feature.
6 Shift-select the two side faces on the grill vents that lie on the axis of symmetry and delete them (see image below). These faces will not be required when you create the opposite half of the helmet. 7 Save your work before proceeding to the next section. Terminating edge loops When you inserted the edges for the grill vents the adjacent face was changed from four-sided to eight-sided as a result of the splitting that occurred along the shared edge.
To manually split the multi-sided polygon into three four-sided polygons 1 Select Edit Mesh > Split Polygon Tool. 2 In the perspective view, click-drag on the top side edge of the top grill vent. Drag your mouse so the vertex is positioned at the bottom of the edge (see image). 3 Click-drag on the top edge of the multi-sided polygon and slide the vertex to the right end of the edge (see image). 4 Press the y key to split the face.
6 Click-drag the bottom edge of the multi-sided polygon and slide the vertex to the right end of the edge (see image). 7 Press the y key to split the face. Your multi-sided face is now split into three four-sided faces, maintaining the overall quad topology on the helmet mesh. 8 Press the q key to exit the Split Polygon Tool. Deleting construction history Maya keeps track of the options, attribute settings, and transformations made to an object via its construction history.
As you near the completion of a model, these construction history nodes are not required. If your production work entails having another person texture or animate the model, you’ll want to delete these history nodes from the objects in your scene altogether so another user doesn’t accidentally change your work. Deleting the construction history is usually done only when a model is completed to a particular milestone stage and the next major phase of production with it needs to occur.
Mirror copying a mesh Once you’ve finalized one half of your polygon model (and deleted its construction history) you’ll want to create the opposite half by copying it across the axis of symmetry so you have the complete model. You can produce a mirrored copy of a polygon mesh using Mirror Geometry (Mesh > Mirror Geometry). Before copying one half across the axis of symmetry, you should check that all of the border edges lie along the axis of symmetry.
7 On the Status Line, turn off Snap to Grids. 8 Click off the mesh to unselect the vertices. To mirror copy the polygon mesh 1 Right-click the mesh, change the selection mode to Object, and then select the helmet mesh. 2 Select Mesh > Mirror Geometry > click the Mirror button. ■ Mirror Direction: -X ■ Merge with original: On ■ Merge vertices: On , set the following options, and then The mesh is copied along -X to create the opposite half of the model.
3 Save your work before proceeding to the next section. At this point, the low resolution version of the helmet model is complete. In the next section you’ll preview how the model appears at a higher resolution using the subdiv proxy feature. Working with a smoothed mesh Depending on the intended use of your polygonal model, you may want a low resolution version, a high resolution version, or both. In Maya, its easy to increase the resolution of a model using the Smooth feature (Mesh > Smooth).
To create a high resolution smoothed model using Subdiv Proxy 1 Right-click the mesh, change the selection mode to Object, and then select the helmet mesh. 2 Select Proxy > Subdiv Proxy > ■ Division Levels: 2 ■ Mirror Behavior: None ■ Subdiv Proxy Shader: Keep , and set the following: 3 Click the Smooth button. A higher resolution, smoothed copy of the helmet mesh is created in the same position as the original mesh.
5 Press the ‘ key (located to the left of the 1 key) to toggle the display between the low and high resolution versions. Toggling the display between the two versions is useful when you want to view one or the other. 6 Press the ~ key to toggle the display so that both are visible again. NOTE The Toggle Proxy Display (‘) and the Both Proxy and Subdiv Display (~) display items are also available from within the Proxy menu.
In this lesson, you’ll try both methods on your helmet mesh. To display hard and soft edges on a mesh 1 Right-click the low resolution mesh, set the selection type to Object Mode, and then select the helmet mesh. 2 Select Soft/Hard Edges. The wireframe mesh on the helmet updates to display both dashed and solid lines. The dashed lines indicate edges that are set to display as soft shaded. The solid lines indicate edges that are set to display as hard shaded.
To harden the edges surrounding the face shield 1 Right-click the low resolution mesh and set the selection mode to Edge. 2 Select the inner edges that surround the perimeter of the face shield (see image below). TIP You can quickly select the inner edges surrounding the perimeter of the face shield using the Select Edge Loop Tool. You may need to double-click in a couple of areas to complete the selection. 3 Select Normals > Harden Edge. The selected edges are hardened on the low resolution mesh.
Notice that the same edges on the smoothed high resolution version of the helmet are unchanged. For edges to display sharp on the smoothed version, you must turn on the Keep Hard Edge attribute. To turn on the Keep Hard Edge attribute 1 In the perspective view, select only the smoothed high resolution version of the helmet mesh. 2 In the Channel Box, in the Inputs section, click the listed proxy to display its attributes. 3 Set the Keep Hard Edge attribute to On.
To crease edges on the mesh 1 Select the lower outer edges on the face shield (see image). 2 Select Edit Mesh > Crease Tool. 3 In the scene view, press the middle mouse button then drag the mouse to the right to add a crease to the selected edges. A thick line appears on both the low resolution model and the high resolution version to indicate that a crease has been applied.
4 Save your work. NOTE You can toggle the creased edge display (thick lines) by selecting Crease Edges. Your model is now complete. Depending on your requirements you can delete the construction history on both the low resolution and high resolution versions. Refine any regions on the helmet as required to gain more experience with the tools presented in this lesson.
Hypergraph window (Window > Hypergraph: Hierarchy) and selecting Edit > Ungroup. Beyond the lesson In this lesson you learned some basic techniques of polygonal modeling: ■ You can create complex polygonal models with surprisingly few techniques. ■ Starting from a primitive surface such as a cube, you can smooth, scale, move, extrude, split, and rotate components of the primitive to create a low resolution version of the model you want to create.
NURBS surface, you can apply many of the same techniques when sculpting polygonal surfaces. ■ You can also modify a polygon mesh using the Soft Modification Tool which lets you smoothly modify a group of vertices on a mesh. If you want to learn more about a particular tool or feature that has been presented in this lesson, refer to the Maya Help.
134
NURBS Modeling 4 Introduction NURBS (Non-Uniform Rational B-splines) use a method of mathematically describing curves and surfaces that are well suited to 3D applications. NURBS are characterized by the smooth organic forms they produce. NURBS surfaces can be quickly modeled and edited using a variety of techniques.
Preparing for the lessons To ensure the lessons work as described, do these steps before beginning: 1 Select File > New Scene to create a new scene before starting each lesson. 2 Make sure the Construction History icon (below the menu bar) is on: . (If it is turned off, it has a large X across it.) 3 If you have not already done so, copy the GettingStarted folder from its installation location to your projects directory. Then, set the GettingStarted directory as your Maya project.
Lesson 1: Revolving a curve to create a surface Introduction A simple technique for creating NURBS surfaces is to create a curve for the profile of your desired form and then create a surface using one of the various NURBS surfacing tools available in Maya. In this lesson, you create an egg holder using NURBS curves and the Revolve Tool. In this lesson you learn how to: ■ Create a NURBS curve using the control vertices (CV) creation technique. ■ Use the grid for visual reference when modeling.
To create a profile curve 1 Make sure you’ve done the steps in Preparing for the lessons on page 136. 2 Select Panels > Layouts > Four Panes so you can see multiple views of the scene. 3 Select Create > CV Curve Tool. This is the most commonly used tool for drawing curves. 4 In the front view, click the numbered positions as shown in the figure. Make sure the first and last positions are on the grid’s Y-axis (the thickest vertical line of the front view’s grid).
It takes a little practice to be able to predict exactly where a curve will be positioned when you click CV positions with the CV Curve Tool. Once you’ve learned the technique, you’ll be able to create and edit curves with graceful symmetry. By default, you must click at least four points to create a curve with the CV Curve Tool. For some advanced operations in Maya, you need to know the meaning of the start of a curve and the curve direction.
Editing a revolve surface After you create a surface from a revolved curve, you can reshape the original creation curve to reshape the surface. This is possible because Maya’s Construction History feature was turned on before you did the revolve operation. Selecting the original creation curve can be challenging when it is situated amongst other existing curves and surfaces. The Outliner is an editor that is useful for quickly examining the structure and components of a scene.
This modifies the shape of the egg holder because it is linked to the shape of the curve by its construction history. 5 If desired, save the scene for future review. 6 Close the Outliner window. Beyond the lesson In this lesson you were introduced to a few basic techniques related to NURBS modeling: ■ Revolving a curve is the easiest way to create surfaces with radially symmetrical forms— wheels, vases, glasses, pillars, and so on. ■ NURBS surfaces are webs of interconnected curves.
Lesson 2: Sculpting a NURBS surface Introduction In addition to creating NURBS surfaces using curves, you can edit and sculpt surfaces and primitive objects in Maya using the Sculpt Geometry Tool. The Sculpt Geometry Tool allows you to interactively push or pull on the surface regions to create areas that are embossed or in relief in relation to the surface.
Preparing a surface for sculpting Because a head is roughly spherical, you can create a primitive sphere as a quick starting point for creating a head and face. To prepare a sphere for sculpting 1 Make sure you’ve done the steps in Preparing for the lessons on page 136. 2 Select Create > NURBS Primitives > Sphere > .
NOTE In wireframe display mode, if you select Display > NURBS > Fine or Medium, more isoparms appear than there are actual spans and sections. The surface is visually displayed with extra precision, but the extra isoparms have no CVs and cannot be edited. 3 Name the sphere Egghead. 4 Rotate the sphere 90 degrees on its side (Rotate Z: 90). This positions the sphere’s CVs well for modeling a simple head and face. You’ll learn why later in this lesson.
Basic sculpting techniques In the next steps, you’ll become familiar with features of the Sculpt Geometry Tool. With this tool, you use your mouse or stylus to push, pull, or smooth a surface’s shape without selecting or displaying CVs. After you practice sculpting the surface, you’ll erase your practice strokes then begin sculpting Egghead’s features. To practice sculpting using basic sculpting operations 1 With Egghead selected, select Edit NURBS > Sculpt Geometry Tool > .
Unlike smoothing, Relax works by only averaging the largest surface anomalies so that the overall shape is maintained. ■ The Erase operation eliminates the effects of the other four operations. The Erase operation works up to the last time you saved the scene or clicked the Update button to the right of Erase Surface. 2 Experiment with each of the five operations on the surface. Don’t be concerned with the results. Just become familiar with the response to your mouse strokes.
The strokes alter the surface because the radius overlaps the CVs. As this example shows, you need to make sure the radius is big enough to influence the desired CVs. It’s common to change the radius many times during a sculpting session. If you prefer to affect a small region without increasing the radius, you can add CVs to the region by inserting more isoparms. You’ll do this later in the lesson. 6 Flood-erase the changes to the surface as you did previously.
8 Flood-erase the changes to the surface as you did previously. 9 Rotate the camera view so the X axis of the View Axis points toward you. Draw a vertical Pull stroke again. As your stroke nears the center of Egghead, a kink occurs. It’s challenging to alter a surface symmetrically in a region where many isoparms converge at a single point, called a pole. Always consider the position of isoparms as you sculpt a surface. In general, sculpt where isoparms are evenly, regularly distributed.
2 Draw a vertical Pull stroke. 3 Change the Max Displacement to 1. 4 Draw another vertical stroke nearby. The Max Displacement sets the maximum distance the surface’s CVs are pushed (or pulled) with a single stroke. 5 Erase the changes to the surface. 6 Set Max Displacement to 2. 7 Draw a vertical Pull stroke. 8 Set the Opacity from the default value of 1 to a value of 0.2. 9 Draw another vertical stroke nearby. One ridge is higher than the other. The Opacity value scales the influence of Max Displacement.
TIP Consider using an electronic tablet with pen stylus. A pen stylus is more natural for stroking surface changes as it feels like a pen. With a stylus, you can set an option that causes the Radius or Opacity to vary with stylus pressure. For example, you can have heavy strokes create a bigger Radius than light strokes. To do this, display the Stroke tab of the Sculpt Geometry Tool. For Stylus Pressure, select Opacity, Radius, or Both. Radius is a common choice.
To build up a small area, position the stroke icon there and click the mouse rather than drag. Tumble the view to examine your results after each stroke or click. If the strokes create a bumpy surface, turn on the Smooth operation and click Flood once or twice to smooth all strokes on the surface. Because Opacity is 0.2, the Smooth operation is subtle. Alternatively, you can smooth a selected region by stroking just that area. It’s common to smooth a surface regularly while using pull and push strokes.
NOTE If the Reflection setting does not push or pull in the same direction on either side of a NURBS surface you can adjust the Reference Vector to alter the direction of these operations. In the Sculpt Parameters section select UV Vector and turn on Enable UV Vector Adjustment. Click and drag the mouse left or right to adjust the direction of the U and V reference vectors. Sculpting eyebrows Eyebrows help define how stern or pleasant a face appears.
Sculpting a mouth With the 30 Sections and 30 Spans specified for the original sphere in this lesson, the large space between isoparms in the mouth region makes it impossible to create a subtle shape for the lips. To overcome this problem, you must insert isoparms in the mouth region before sculpting. To insert additional isoparms 1 Right-click Egghead and select Isoparm from the marking menu. 2 From the Toolbox, choose the Select Tool.
4 Select Edit NURBS > Insert Isoparms > . In the options window, turn on Between Selections, enter a value of 2 for # Isoparms to Insert, then click Insert. This inserts two extra isoparms between each pair of selected isoparms, for a total of four extra isoparms. This provides enough CVs to create subtlety in the mouth. You might want to add vertical isoparms at the lips in a similar way. The extra isoparms would also be useful if you were to later enhance the shape of the nose.
NOTE It might be easier to push or pull the lips with the Ref. Vector set to Z Axis. This moves the region you stroke in the world Z-Axis direction. The default Normal setting moves the region in a direction normal (perpendicular) to the surface. Because the normal direction on a lip might be up, down, or straight out, depending on the part of the lip you stroke, there’s more possibility of undesired results when you use the Normal setting.
■ To create simple, unadorned ears, you can create, scale, and squash a sphere. Create ridges and valleys by pulling CVs or by using the Sculpt Geometry Tool. Duplicate the ear by first setting its pivot point to the origin and with the Scale option set to -1, 1, 1. Parent the ears to Egghead. To import existing models into your scene: 1 If you saved the Eggholder scene in the prior lesson, you can import the egg holder into this Egghead scene, then position Egghead into the egg holder.
■ The density and orientation of isoparms on a surface affects the results with the Sculpt Geometry Tool. As you gain NURBS modeling experience, you’ll learn how to use the density and orientation of isoparms to your advantage. ■ Primitive objects are useful objects for sculpting in many cases. After you create a primitive, you typically sculpt, scale, trim, or otherwise alter the object into a more complex shape.
Another method for creating NURBS surfaces is to loft a series of curves that define the cross section of your desired surface form. Lofting a surface works like stretching a skin over each of the cross sections to create the final surface. In this lesson, you learn additional NURBS surfacing techniques by using the Loft tool to create the body of a salt shaker. You will also create the cap for the salt shaker by modifying the shape of a primitive sphere.
A circle is a curve that loops back on itself. The CVs work the same way as for any other curve. The more CVs you create for a curve or surface, the more detail you can give its shape. The drawback to using many CVs is that you’ll have a harder time making smooth shape changes to broad regions. Also, more CVs means slower processing time as you work with the curve. It’s best to make curves with as few CVs as necessary. With experience, you’ll learn how many CVs to use in a situation.
8 Turn off Snap to Points. Turn off the display of CVs for both circles by right-clicking on the circles and selecting Object Mode from the marking menu. Duplicating curves In the next steps, you’ll create several copies of the previously created circles (also called curves) to form the skeletal contours of the salt shaker’s surface. To duplicate curves for the lofted surface 1 Right-click the outer curve and choose Select from the marking menu. 2 Select Edit > Duplicate Special > .
This creates four copies of the original curve, each translated three units above the last, and each scaled smaller than the last. 3 Select the inner circle and then move it to 0, 13, 0 by entering these translate values in the Channel Box. Increase its Scale attributes to 1.33, 1.33, 1.33.. 4 Use Edit > Duplicate Special > ■ Translate: 0 2 0 ■ Scale: 1.05 1 1.
2 Select Surfaces > Loft. This creates the salt shaker’s body. 3 Name the surface shakerBody. 4 Press 5 to display the view with smooth shading. NOTE Many of the surface creation tools also have the option of creating polygon or subdivision surface versions of a surface with the same input curves. You do this by setting the appropriate Output Geometry option for that particular surface tool.
4 Scale the cap size so that its diameter fits snugly at the top of the body. 5 Adjust the cap’s position as desired. 6 In a side view, make sure that the cap is displayed as a wireframe. 7 Right-click on the Cap and choose Control Vertex from the marking menu. 8 Select the top row of CVs and drag them down until the top of the cap is flattened: Check that the bottom half of the cap isn’t poking through the visible surface of the body. You can scale the bottom CVs inward to avoid this problem.
Using the Outliner to parent objects The Outliner is an editor that is useful for quickly examining the structure and components of a scene. You can use the Outliner to quickly parent objects to create an object hierarchy. To parent an object using the Outliner 1 From the main menu, select In the main menu bar:. The Outliner window is displayed. A list of the scene’s components is listed in the Outliner. 2 In the Outliner, click on the word Cap to select it.
By parenting the objects, you can move, rotate, or scale the cap and the body as a single entity by selecting only the body. Notice that the salt shaker displays horizontal curves that wrap around the body. The curves are the original circles you used to loft the surface. Because these curves are part of the surface’s construction history, you can alter their shape if you decide you want to alter the shape of the body and the body will update based on the construction history.
166
Subdivision Surfaces 5 Introduction Subdivision surfaces are a hybrid surface type that possess characteristics of both NURBS and polygonal surfaces as well as other features not offered by the other surface types. Like NURBS, subdivision surfaces are capable of producing smooth organic forms and can be shaped using relatively few control vertices. Like polygonal surfaces, subdivision surfaces let you extrude specific areas and create additional detail in your surfaces.
5 Select Window > Settings/Preferences > Preferences. 6 In the Preferences window, select Subdivs from the Categories list to display the subdivision surface preferences. 7 In the Subdivision Surfaces Component Display settings, set the Component display to Numbers, then click Save. Setting the subdivision components to display as numbers allows you to see the subdivision surface level directly on the surface.
■ Change the Display Level when working in Standard Mode. ■ Add more detail to subdivision surface models using Refine Selected Components. ■ Create a crease along a vertex edge. Creating a subdivision surface You begin the lesson by creating a polygonal cube. You’ll convert this cube to a subdivision surface that will be the foundation of the hand.
2 Press 3 on your keyboard (to select Display > Subdiv Surfaces > Fine). 3 Press 5 (to select Shading > Smooth Shade All). With the smoothness set to Fine, you can see that the conversion to a subdivision surface creates a rounded, smooth shape. By pressing 3, the subdivision surface is displayed more precisely in the scene view. This gives a closer approximation of what the surface will look like when you create a rendered image of the scene.
The wireframe cube looks the same as the original polygonal cube. The new cube is called a polyToSubd1 for the subdivision surface as a result of the conversion. Rename it LeftHand. You can use polygonal modeling tools to edit the shape of the polygonal proxy, which indirectly alters the shape of the subdivision surface. Unlike working with an actual polygonal object, your modifications result in perfectly smooth surface changes rather than faceted changes.
This splits the face into two faces. You’ll extrude the left face into a finger later. 4 Repeat the preceding two steps as necessary to split the face as follows: Notice how splitting the face into multiple faces alters the shape of the subdivision surface. The front part of the subdivision surface now resembles the proxy shape more. If you were to split the front face several more times, especially near the outer edges, the subdivision surface would sharpen and resemble the proxy shape even more.
Extruding polygon faces Next, you’ll extrude faces to create fingers for the hand. To extrude the polygon faces to create fingers 1 In a perspective view, right-click LeftHand and select Face from the marking menu. This lets you select faces. 2 Select the right-most face by dragging a selection box around the tiny box at its center. (The subsequent illustration shows which face to select.) 3 Select Edit Mesh > Extrude.
7 Similarly, extrude the ring, middle, and index fingers from the appropriate wide faces. Don’t extrude the three small faces that lie between the wide spaces. Leave them in position to allow for webbing between the fingers. NOTE Do not be concerned if the hand you create does not match the lesson’s illustrations. Your goal in this lesson is to learn the workflow of subdivision surfaces, not to perfect your modeling technique. Next, you extrude a thumb using similar techniques as you used for the fingers.
3 Extrude the middle face and drag it directly outward. 4 Click the surrounding blue circle and use the rotate manipulator to aim it in a direction appropriate for a thumb. 5 Extrude three times more to create each segment of the thumb. Use the extrusion manipulator to rotate, move, and scale each extrusion to create the desired shape of a thumb. Use the following figure as a guideline. Again, it’s unnecessary to match the illustration or create a realistic thumb for this lesson.
7 Make coarse adjustments to various parts of the hand by repositioning the vertices with the Move, Scale, and Rotate Tools. The Move Tool works on individual vertices or groups of vertices. Rotate and Scale works on two or more vertices. Undo any changes you don’t like using Ctrl-Z (Windows and Linux) or Control-z (Mac OS X). Try to create the approximate thickness, length, and curvature of a cartoon character’s hand and fingers. There’s no need for perfection. You’ll refine the fingers later.
3 Scale the four vertices that surround the hole and scale them inward to narrow the wrist region of the hand. Subdivision surface levels Next, you refine the shape of the fingers by working in Standard Mode. In Standard Mode, you can make edits to mesh vertices, edges, or faces at different levels of refinement, that are not possible in Polygon Proxy mode. The different levels of refinement are referred to as subdivision surface levels.
This displays 0s on the surface in the same positions as the vertices in Polygon Proxy mode. In fact, the 0s are vertices. The number 0 refers to the level of detail you are capable of editing. The 0 level is identical to the coarse control possible in Polygon Proxy mode by manipulating the vertices. You can move, rotate, and scale the 0s to alter the shape of the surface just as you did for vertices in Polygon Proxy mode. 5 Right-click the surface and select Display Level > 1.
there are fewer of them. It’s common to switch back and forth between levels repeatedly in a work session. The hand has level 2 vertices at various locations, for instance, at the webbing between the fingers. You can also work at that level of detail if desired (select Display Level > 2). Refining surface components By default, a subdivision surface displays up to three levels of detail (0, 1, and possibly 2). The 0 level is the least refined.
5 In the scene view, right-click LeftHand and select Vertex from the marking menu. This displays additional level 2 vertices in the fingertip region. 6 Select Modify > Transformation Tools > Move Tool, Rotate Tool, Scale Tool, Show Manipulator Tool > . In the Tool Settings window, turn on Normal, then close the window. You can thereafter use the Move Tool manipulator to move vertices in a direction normal (perpendicular) to the surface. 7 Select the vertices in the nail region.
Creating a crease in a subdivision surface One of the unique features of subdivision surfaces is that it’s easy to create a crease or ridge on a smooth surface. You’ll do this in the next steps. To crease the edge of the fingernail 1 Switch to Edge selection mode and shift-click the edges around the nail to select them. (It might be easier to see the desired edges by first selecting Shading > Wireframe.) 2 After you select the edges, select Subdiv Surfaces > Full Crease Edge/Vertex.
4 Now experiment on your own by moving individual vertices to shape the nail and surrounding region as desired. A few suggestions follow: ■ In Smooth Shade display mode (Shading > Smooth Shade All), certain vertices might be below the shaded surface and therefore impossible to select and move. To display and select such vertices, switch to wireframe shading (Shading > Wireframe).
window, click Reset Tool, and then close the window. This returns the Move Tool to its default settings. This will avoid confusion in future lessons. Beyond the lesson In this lesson, you were introduced to some basic techniques related to subdivision surface modeling: ■ Modeling with subdivision surfaces is an easy way to create intricate, smooth objects such as human hands and faces.
184
Animation 6 Introduction Maya lets you apply action to the objects in your 3D scene. In Maya, when an object or attribute changes in relation to time, it is referred to as being animated. Maya provides a large selection of tools to help you animate the objects in your scene. You may decide to use a combination of several techniques to achieve your desired results.
2 If you have not already done so, copy the GettingStarted folder from its installation location to your projects directory. Then, set the GettingStarted directory as your Maya project. For more information, see Copying and setting the Maya project on page 25. 3 Select the Animation menu set. Unless otherwise noted, the directions in this chapter for making menu selections assume you’ve already selected the Animation menu set.
In this lesson, you learn how to: ■ Set keyframes for animatable objects and their attributes. ■ Use the Time and Range slider and Playback Controls to control the playback. ■ Use keyboard shortcuts to set keyframes. ■ Use the Graph Editor to view animation curves. ■ Modify the animation of objects using the Graph Editor. ■ Set preferences to increase the playback quality. Setting the playback range In this lesson, you work with a scene we’ve created for your use.
The Time Slider displays the playback range and keys you’ve set for a selected object. Keys are displayed as red lines. The box at the right of the Time Slider lets you set the current frame (time) of the animation. The Playback Controls control animation playback. You may recognize the conventional buttons for play and rewind (return to the start time). The stop button appears only when the animation is playing. To find out which operation a button represents, hold the mouse pointer over it.
To set beginning and ending keyframes 1 Click the rewind button to go to the start of the playback range. This changes the current frame to 1. 2 Select the ball, then select Animate > Set Key. (Keyboard shortcut: s). This sets a key at frame 1 for all transform attributes of the ball. Transform attributes are the X, Y, Z move attributes.
To set intermediate keyframes 1 Go to frame 33 or so—at the moment where the ball sits in the middle of the fence. 2 With the Move tool, drag the Y-axis handle of the ball until it sits slightly above the fence. TIP Throughout this lesson, tumble the perspective view or examine a front view to make sure the positioning is correct. 3 Set a key. (Press s.) 4 Play the animation.
3 Set a key. 4 Go to frame 60. 5 Move the ball up again, but not as high as its peak height above the fence. 6 Set a key. When you play the animation, the ball travels over the fence and bounces on the other side. If you have a fast computer, you might notice that the animation plays too fast. By default, Maya plays the animation as fast as it can be processed. Because this scene is simple, the animation might play faster than the default film rate (24 frames per second).
The Graph Editor displays several animation curves, one for each keyed attribute of the ball. The animatable attributes for the ball are listed in the left column. Specifically, it displays the attributes of the selected transform node of the ball. Each curve graphs how an attribute changes value during the animation. The column of numbers at the left represents attribute values that can be animated, while the row of numbers at the bottom represents time (frame) values.
The green curve represents Translate Y, while the red represents Translate X. The color of each curve matches its attribute name. This color scheme is consistent throughout Maya for X, Y, and Z (red, green, blue). If you’ve never used a graph editor before, the relationship between a curve’s shape and the animation it represents might be hard to understand. With experience, you’ll quickly recognize how curve shape affects animation.
■ Use the Graph Editor’s Tangents menu items to change the adjacent curvature. This is the operation you’ll use in the next step. 5 In the Graph Editor, select Tangents > Linear. This changes the curvature around the key point from rounded to cornered. Specifically, the setting you select specifies how the key point tangent handles lie at this key point. This affects the type of interpolation between key points. 6 Play the animation and you’ll see the ball bounce more sharply.
12 Select the right tangent handle and use the Move Tool to move it up a little. Do the same for the left tangent handle. Be careful not to select the key point. This sharpens the bounce to simulate the effect of gravity and elasticity. Changing the timing of an attribute The ball seems to move too slowly in its journey. In the following steps, you’ll use the Graph Editor to hasten its movement.
This scales the curves symmetrically towards frame 1. The animation of the ball now plays from frame 1 to 48 rather than 1 to 72. The ball traverses the scene in less time, which, of course, means it moves faster. If you had started your drag operation from the middle of the frame range, the scale operation would have pulled the curves toward the middle of the frame range. You can snap the keypoints to whole values to keep the keyframes on a consistent timing.
If you want your curves to match the shape of the curves in the above figure, here’s what you would need to do: To adjust the animation curves to match the above images 1 On the Translate X curve, delete the three key points between the two key points at the end. To delete keys, select the key points and press Delete. (The preceding figures show the curve after the points were deleted.) To delete the points, drag a selection box around them and press Delete.
4 On the Translate Y curve, select the left-most key point and move its right tangent handle up slightly. 5 At the key point where the bounce occurs on the Translate Y curve, move the left tangent handle up a bit. This raises the high part of the curve left of that key point, which makes the ball rise higher over the fence. 6 If you want to change the shape of Translate Y curve but lack adequate control with the existing key points, you can add a key point at the position of your choice.
When you remove redundant key points, the shape of the curve doesn’t change and you speed up Maya processing. Using Playblast to playback an animation When you play a scene, you see a rough approximation of the animation. The playback speed and quality is imprecise as compared to rendering each frame and playing the frames in sequence with a playback utility specifically designed for this purpose.
Beyond the lesson In this lesson, you learned how to: ■ Set keys for attributes, then use the Graph Editor to refine the animation and remove unnecessary keys. This is a typical workflow when keyframing. You can animate most any attribute in Maya, not just the Translate, Rotate, and Scale attributes of a surface. For example, you can animate the intensity of a light, the transparency of a surface, the rotation of a camera view, or the position of CVs.
problems that occur when the animation of one object in a hierarchy conflicts with the animation in another part of the hierarchy. Lesson 2: Set Driven Key Introduction With keyframe animation, you key an attribute value to a time in the Time Slider. You repeat this process with different values at different times to animate the object. When you must animate multiple objects or attributes that interrelate, setting keyframes can quickly become a complex task.
Lesson setup In the following steps, you set a playback range that’s long enough to see the animation clearly. You also create the ball and the door, and position them in the scene view in preparation for the animation. 1 Make sure you’ve done the steps in Preparing for the lessons on page 185. 2 Create a new scene. 3 Go to the start frame. 4 Create a polygonal cube and name it Door. 5 Scale and position it roughly as shown in the previous figure.
2 Click translateY in the Driven list. This is the attribute to be driven by the ball’s movement. 3 Select the ball in the scene view. 4 In the Set Driven Key window, click the Load Driver button. The ball appears in the Driver list. 5 In the Set Driven Key window, click translateZ in the Driver list. This is the attribute that will drive the door’s movement. You can set a driven key only after you select an attribute in the Driver list and in the Driven list. 6 In the Set Driven Key window, click Key.
The Time Slider is not involved in a driven key relationship and displays no red markers for keys. 7 Move the ball to the door’s position and then move the door above the ball. 8 In the Set Driven Key window, click Key. This sets another driven key that links the current Translate Z value of the ball to the Translate Y value of the door. 9 Move the ball to the right of the door and then lower the door to its previous position as shown in the following figure. 10 In the Set Driven Key window, click Key.
Viewing the results in the Graph Editor In the next steps you’ll examine the animation curve resulting from the driven keys you’ve set. If you are unfamiliar with animation curves and the Graph Editor, see Lesson 1: Keyframes and the Graph Editor on page 186. To view the set driven key results in the Graph Editor 1 Select the door. To display the animation curve for a driven key in the Graph Editor, you must select the object containing the driven attribute, not the object containing the driving attribute.
you can use regular animation keys, expressions, motion paths, or other techniques to animate the driving attributes. This indirectly animates the driven attribute. You may find the following notes helpful when using Set Driven Key: ■ You can set driven keys to control a driven attribute with multiple driving attributes. For instance, you can have a muscle bulge when an elbow rotates, and have the bulge increase when the wrist rotates.
In this lesson, you make an aircraft follow a motion path so it appears to fly and bank while it changes trajectory. We provide a scene for your use in the lesson. In this lesson, you learn how to: ■ Set an object to animate along a motion path using a NURBS curve as the path. ■ Modify the timing and rotation of an object along a motion path. ■ Blend between keyframe and motion path animation. Open the scene for the lesson In this lesson, you work with a scene we created for your use.
The path animation occurs between frames 60 and 240 (180 frames in total). Between frames 1 and 60, you keyframe the aircraft’s motion so it rises from the ground plane. You then blend between the two animation types. Animating an object along a motion path To animate the aircraft along the path curve, first select the aircraft and the path curve and then set appropriate options for the motion path animation. In the options window, you need to set the required time range for the path animation.
The aircraft is repositioned to the start of the curve, and oriented towards the direction of travel. The Start and End Times set the time duration the aircraft travels along the path curve (240 - 60 = 180 frames). The start and end times are displayed at the ends of the curve. 5 Click play on the Timeslider playback controls to play back the animation. The aircraft travels along the path. Observe that it begins its motion at frame 60.
Changing the timing of an object along a motion path When you first assign an object to a motion path, by default, the object travels along the path at a constant speed. In this lesson, you want the aircraft to initially travel along the path slowly, accelerate, and then finally move more slowly when it nears the end of the motion path. You can change the rate of travel for the aircraft by keyframing attributes that affect where the aircraft is positioned on the curve at a given time.
By default, the parameterization of a path curve is set between zero and one. At frame 60, the aircraft is at the beginning of the curve where the parameterization value is zero. When the aircraft is at the end of the curve (frame 240) the parameterization value for the curve is one. When the aircraft is halfway through the path animation (frame 150), it is located along the curve at a UValue of 0.5.
5 Right-click on the selected name. A drop-down list appears. 6 From the drop-down list, choose Key Selected. A position marker appears on the path curve indicating that a key frame has been set. The position marker is useful for determining where the aircraft is at a given time. Position markers do not appear when you render the animation. Using Key Selected ensures that a keyframe is set only for the item selected and nothing else.
11 Click play on the Time Slider’s playback control to play back the animation. The motion of the aircraft is not smooth as it travels along the path. It initially moves forwards and backwards a bit at the beginning and end of the path. This indicates that some adjustment of the animation is required. You adjust the animation using the Graph Editor. To view the Graph Editor 1 From the main menu, select Window > Animation Editors > Graph Editor. The Graph Editor appears.
The animation curve updates so that the keys connect via straight lines. This eliminates the dips in the curve that caused the aircraft to travel backwards. Next, you modify the tangents for keys 120 and 180 so the aircraft accelerates and decelerates near those points on the path curve. 1 In the Graph Editor, shift-select only the two keys for frames 120 and 180. 2 In the Graph Editor menu, select Keys > Break Tangents.
7 Select the key for frame 180. 8 Select the handle to the left of the key. The handle highlights in blue. 9 Using the middle mouse button, drag the handle so the curve has a gentle curvature as it enters the key as shown below. Modifying this tangent for this key will cause the aircraft to decelerate smoothly near the end of its travel. The modified animation curve appears as shown below. 10 Close the Graph Editor. 11 Click play on the Time Slider’s playback control to play back the animation.
The backwards and forwards motion that previously occurred is corrected. The aircraft travels slowly towards the first bend in the path curve, then accelerates and travels at a constant speed around the curve until it nears the end of the path where it decelerates and then slowly moves towards the end of the curve. Rotating an object along a motion path As the aircraft travels along the motion path, its orientation remains the same throughout the animation.
■ Set the values for Front Twist in the Channel Box. ■ Select the Front Twist channel by clicking its name. Right-click on the selected name and choose Key Selected.
In the steps that follow, you keyframe the aircraft to rise vertically from the floor surface and then travel along the motion path by blending between the two animation types. To accomplish this, you do the following: ■ Move the motion path up above the ground plane. ■ Keyframe the aircraft so it rises vertically above the ground plane. ■ Blend between the keyframe and motion path animations. To move the motion path 1 In the scene view, select only the path curve.
5 Right-click on any of the highlighted names, and choose Key Selected from the drop down list that appears. Keys are set for the selected channels. Keyframing these channels establishes a blending connection that will be discussed in subsequent steps. 6 In the Channel Box, set the following: ■ Rotate Y: - 90 The aircraft is rotated 90 degrees from its motion path position. 7 Select the Rotate Y channel by clicking on its name so it becomes highlighted.
1 To set the remaining keyframes for the keyframe motion of the aircraft, use the table below as a guide, keeping in mind that you set the keyframes in the following order: ■ Set the frame in the Time Slider. ■ Set the Translate and Rotate values in the Channel Box. ■ Select only the channels for those values. Right-click on the selected name and choose Key Selected.
The aircraft rises above the ground plane and then stops at frame 40. The animation stops because the motion path animation was shut off when the blend attribute was automatically created when you set the first keyframe. The blend attribute values are set to zero by default. When the blend values are set to zero, the keyframe animation has full influence on the object, and the path animation is shut off.
4 Right-click on one of the names, and choose Key Selected from the drop down list that appears. A key is set for the blend starting point for the aircraft. At frame 30 the two animation types will begin to blend together. 5 Set the Timeslider to frame 70. 6 In the Channel Box, set the following: ■ BlendAddDoubleLinear1: 1 ■ BlendMotionPath1: 1 7 Right-click on one of the names, and choose Key Selected from the drop down list that appears. A key is set for the blend ending point for the aircraft.
To edit the rotation interpolation type for blending 1 In the Channel Box, click on the pairBlend1 channel. 2 Scroll the Channel Box so you can view the Attributes for pairBlend1. 3 Set the Rot Interpolation setting to Quaternions by clicking on the Euler angles name with the left mouse button. 4 Click on the pairBlend2 channel. 5 Click on the Euler angles name in the Rot Interpolation attribute and choose Quaternions. 6 Click play on the Timeslider playback controls to play back the animation.
Playblast calculates the frames for the animation and then plays them back in the player window. You have completed this lesson. Beyond the lesson In this lesson you learned how to: ■ Create a motion path animation using a NURBS curve as the motion path. When you draw your own curves remember that a curve has a defined start and an end point based on how you create it.
Lesson 4: Nonlinear animation with Trax Introduction Nonlinear animation allows you to create and edit an animation sequence by arranging smaller animation sequences (known as clips) on a timeline. A clip is a time-independent sequence of animation that you create from an existing animation (keyframe animation, expressions, constraints, and motion capture data - except motion path animation).
■ Create clips from your animation sequences for use in the Trax Editor. ■ Use the Trax editor to position, modify, and arrange clips in order to create and modify animation sequences in the scene. ■ Scale clips to modify the timing of an animation sequence. ■ Trim clips to remove unwanted motion. ■ Cycle clips to create motion that repeats. ■ Use the Graph Editor to modify the animation of a clip. ■ Use the Trax Editor to work with motion capture data.
3 In the Time Slider, set the Playback range as follows: ■ Playback Start Time: 1 ■ Playback End Time: 240 To work more efficiently with the scene and the Trax Editor, you need to set a panel layout. To set a panel layout for use with the Trax Editor 1 From the perspective view’s menu, select Panels > Saved Layouts > Persp/Trax/Outliner. The panel layout updates to display the Perspective view, Outliner, and Trax Editor simultaneously.
Creating clips with Trax A clip is a time-independent sequence of animation data for one or more animated attributes that you create from existing animation (keyframe animation, expressions, constraints, motion capture data, and so on). A clip is time independent, allowing you to position, scale, and cycle a clip independently of other animatable attributes or other clips. This means you can arrange the clips into a particular sequence, and then play it back to see the results.
5 Press s to set a keyframe. In the Channel Box, the channels display in a different color. The color change indicates that the channels now have animation applied to them. NOTE If you normally use the Auto Keyframe function, you must shut it off for this lesson. For more information see Auto Key in the Maya Help. 6 In the Time Slider, set the current time indicator to frame 240.
The aircraft travels from left to right in the front view. 2 Click stop on the Time Slider’s playback control. Now that you have keyframed an animation sequence and confirmed that it works, you can create an animation clip. To create an animation clip of the keyframe animation 1 In the Trax Editor menu, with the aircraft still selected, select Create > Animation Clip > . 2 In the Create Clip Options window, select Edit > Reset Settings, and then click on the Create Clip button.
A clip does not yet appear in the track area of Trax Editor because the character set associated with the clip (the aircraft) has not been loaded to display. 3 In the Trax menu, with the aircraft selected, click the Load Selected Characters icon. The clip appears as a blue rectangular box in a track in the Trax Editor. A track is an area in the Trax Editor to place and work with one or more non-overlapping clips in relation to the animation timeline.
■ Source In and Source Out indicates the range of frames from the original source clip. ■ Duration indicates the length (duration) of the original source clip in frames. ■ Clip Name...the name of the clip. A default clip name is assigned to the clip, unless you specify it from the Create Clip Options window when you first create the clip. ■ Scale indicates the scale percentage for the clip. The scale percentage is the multiplier on the length of the original clip.
For more information see Nonlinear animation components in Trax in the Maya Help. Now that you have created your first animation clip and renamed it using the Trax Editor, you need to create a few more clips by setting additional keys and creating clips of the sequences. You need to create separate clips of the aircraft taking off and landing. To create an animation clip of the aircraft taking off 1 In the scene view, select the aircraft.
The Trax Editor updates to create an additional track and places the new clip on the new track. The Outliner updates to list the new clip and source clip. 10 In the Trax Editor, double-click on the new clip and rename it to Aircraft_Rise. 11 Click play on the Time Slider’s playback control to play back the animation. The aircraft rises as it travels forward. 12 Click stop on the Time Slider’s playback control.
7 In the Channel Box, select the Translate Y name so it becomes highlighted. 8 Right-click on the name and choose Key Selected to set a keyframe for this position. 9 Click play on the Time Slider playback controls to play back the animation. The aircraft travels forward and then lands as it nears the end of its travel. 10 Click stop on the Time Slider’s playback control. 11 In the Trax Editor menu, with the aircraft selected, select Create > Animation Clip.
To change the position of a clip in a track 1 In the Trax Editor, move the mouse cursor over top of the Travel_Forward clip. When the mouse cursor is over top of a clip in the Trax Editor, the cursor icon changes to a pointer indicating that you can drag the clip to either side or up and down between tracks. 2 Click-drag the Travel_Forward clip horizontally to the right in its track until the Frame In reads 60 as shown below. 3 Click play on the Time Slider playback controls to play back the animation.
You also need to modify the Playback End Time because the animation timeline is longer as a result of repositioning the clips. 1 In the Time Slider, edit the Playback range as follows: ■ Playback End Time: 360 2 Click play on the Time Slider playback controls to play back the animation. The aircraft takes off vertically, then travels to the right, and then lands vertically once the Travel_Forward clip’s motion is complete.
The selected clip highlights in yellow. 2 From the Trax menu, select View > Graph Anim Curves. The Graph Editor appears. 3 In the Graph Editor, shift-select the two keys on the animation curve as shown below. 4 In the Graph Editor, select Tangents > Flat. The shape of the animation curve updates to a gentle S-shape.
Reusing clips within Trax You can save and reuse clips for future use. You can key specific types of motion or attribute effects, save them as clips, and reuse the clips for other characters. When you reuse a clip created for one character and apply it to another, the clip attributes must be mapped to correspond between the two characters. For more information, see Mapping animation between characters in the Maya Help. In this lesson, you work with clips created for this aircraft animation.
To place clips into a track from the Outliner 1 In the Outliner, using the middle mouse button drag the clip named Bank_LeftSource into the same track as the Rise and Lower clips. Ensure you drag into an open area on the track that the clip will fit into. 2 Position the Bank_Left clip on the track so its Frame In number matches the Frame Out number on the Aircraft_Rise clip, as shown below.
A new track appears in the Trax Editor and the clip is placed on the new track. The narrow blue box is the summary track for the character set (in this case the Aircraft) The summary track represents all of the clips under a character, subcharacter, or group. When you import a clip onto the summary area by dragging it from the Outliner or Visor, the Trax Editor creates a new track for the clip. 2 Click-drag the Shift_Left clip so it lies directly below the Bank_Left clip on the track above it.
6 Dolly and track the view so you can fully see the area the aircraft will travel within. 7 Click play on the Time Slider’s playback control to play back the animation. After the aircraft rises, it travels forwards as before but now it shifts sideways to the left while one wing tips downwards, and then shifts sideways to the right, while the opposite wing tips downwards. 8 Click stop on the Time Slider’s playback control.
The aircraft rises, tilts left and right, and then lowers, without moving forward. Because the other tracks have been shut off temporarily, the aircraft’s motion is controlled by only one track. 3 Click stop on the Time Slider’s playback control. 4 Click the Solo button again to enable all the tracks. The dimmed tracks become active again. Muting a track disables only the selected track so it does not play back.
or longer period of time. The resulting animation occurs faster or slower as a result. In the next steps, you select the four clips you imported to Trax, and scale them together so they occur over the same time frame as the Travel_Forward clip. To scale multiple clips in the Trax Editor 1 In the Trax Editor, shift-click on the clips: Bank_Left, Bank_Right, Shift_Left1, and Shift_Right1. The clip manipulator appears.
Open the second scene for the lesson In this second half of this lesson, you work with a second scene file that contains motion capture data applied to a skeleton. Motion capture data is produced by capturing the movement of a real human or animal and digitizing it so it can be applied to a 3D animation character. Motion capture data contains keyframe animation. Motion capture data is useful because it can capture the subtle nuances of motion and gesture that make a character’s actions appear life-like.
NOTE If you are beginning the lesson from this point, you must first set your panel layouts and display settings for the Trax Editor and Outliner. Refer to To set a panel layout for use with the Trax Editor on page 227 and To set the Outliner to display clips on page 227. If your skeleton doesn’t appear as shown, you will need to increase the size of the skeleton’s joints. To resize the joints on the skeleton 1 From the main menu, select Display > Animation > Joint Size.
2 Press the Go to Start of playback range button to return to frame 1 in the Time Slider. The skeleton is repositioned at frame 1 where the walking motion begins. 3 In the persp view, select the skeleton by click-dragging a bounding box around the skeleton. The skeleton is highlighted. When the skeleton is selected, many red ticks appear in the Time Slider. The red ticks represent keyframes from the motion capture data. 4 In the Trax Editor menu, select Create > Animation Clip > .
Extending the length of motion capture data You often need more animation of a motion sequence than is provided in the motion capture data. For example, you may need to have a walk cycle that is substantially longer than what was provided in the original file. You can use the Trax Editor to edit the motion capture data and create clips that can be cycled to make longer animation sequences.
5 In the Create Clip Options window, click Edit > Reset Settings to set the tool to its default settings, and then set the following: ■ Type WalkCycle in the Name field. ■ Put Clip in Trax Editor and Visor: On ■ Time Range: Start/End ■ Start Time: 6 ■ End Time: 45 ■ Click Create Clip Two clips appear in the Outliner named WalkCycle and WalkCycleSource. 6 In the Trax Editor, with the skeleton selected, click the Load Selected Characters icon. The clip named WalkCycle appears in a new track.
7 In the Time Slider, set the current time indicator to frame 1. 8 Click play on the Time Slider playback controls to play back the clip. The skeleton takes two steps and stops. 9 Press stop on the playback controls to stop the playback and reset the current time indicator to frame 1. 10 In the Trax Editor, drag the clip to the left in its track until the Frame In number reads 1. This sets the clip to begin at frame 1 in the Time Slider.
The region is highlighted to indicate you can edit the values in the region. The number will likely not be exactly 2.0. This means that the cycle will not repeat exactly twice. 3 Type 2.0 to modify the clip so it cycles exactly twice. 4 With the clip selected in the Trax Editor, open the Attribute Editor. Open the Channel Offsets menu and ensure that the WalkCycle clip’s root.scale and root.translate offset attributes are set to Relative and root.rotate offset attributes are set to Absolute.
6 Press stop on the playback controls to stop the playback and reset the current time indicator to frame 1. Redirecting the motion within a clip Motion capture data can be used in a variety of ways. You can redirect the motion of a character using the same motion capture data. The Redirect tool allows you to alter the original animation for a character by modifying its path or orientation at any time during its animation.
This frame is where the ball of the skeleton’s right foot is planted on the ground plane. Use this frame as the location where the skeleton will turn to the right. 2 Select the skeleton in the scene view by click-dragging a bounding box around it. 3 In the main menu, select Character > Redirect > . 4 In the Character Redirection Options Window set the Redirection Type to Rotation only and then click the Redirect button.
2 Press the v key and click-drag the redirection control until it is located on the ball of the right foot as shown below. Pressing the v key while using the Move Tool momentarily enables the Snap to Points tool. The redirection control is now positioned to redirect the skeleton’s walking motion. To complete the redirection process, you need to set keyframes while setting the redirection control so the redirection of the skeleton can occur.
5 With the redirection control still selected, press s to set a keyframe. Setting a second keyframe establishes when the redirection rotation for the skeleton ends. 6 Set the current time indicator to frame 1. 7 Click anywhere in the perspective view to deselect any items in the scene. 8 Click play on the Time Slider playback controls to play back the clip.
NOTE When redirecting motion within Trax, you may want to consider creating a clip that contains the redirection animation to make it possible to reposition the redirect animation as a clip. Now that you’ve redirected the character to a different direction of travel during the walk cycle, you can reuse some of the motion from the original source clip you created earlier in the lesson and saved to the Outliner/Visor. You insert the source clip from the clip Library in Trax.
6 In the Trax tool bar, click the Trim Clip Before Current Time icon to trim the section of the clip that occurs before frame 98. The WalkSit clip is trimmed and the portion of the clip before frame 98 is discarded. 7 Click the Mute button again for the track containing the WalkCycle clip to reactivate the track. The dimmed track becomes active again. The skeleton however has updated to an incorrect pose near its previous position.
11 Press stop on the playback controls to stop the playback and reset the current time indicator to frame 1. A small jump cut occurs during the transition between the two clips. The jump cut occurs because the poses for the skeleton do not match from the end of the first clip and the beginning of the second. In your own work, try to anticipate how motion will blend between clips when working in Trax. You can correct the jump cut in this particular example by extending the WalkCycle clip.
4 Click play on the Time Slider’s playback control to play back the animation. The jump cut is less noticeable than before. 5 Press stop on the Time Slider’s playback control. You have completed this lesson. Before leaving this lesson, reset the joint size back to its default setting. To reset the joint size 1 From the main menu, select Display > Animation. The Joint Display Scale window appears. 2 Set the Joint Display Scale to 1. 3 Close the Joint Display Scale window.
When you create a clip, a character set is created if one does not already exist. You can load and work with multiple character sets in the Trax Editor. To select different character sets when working in Trax you can use the Select Current Character drop-down menu. Clips can also be arranged, scaled, and moved as groups. For more information see Move clips and Track view area in the Maya Help.
results are obtained when blending between similar motions. In some situations, a blend can be used to correct jump cuts. For more information see Create and edit blends in the Maya Help. Key into clip You can set keyframes to alter the animation within a clip. This process is called Keying into a clip. When you key into a clip, keyframes are placed at the current time on all the animation curves in the selected clip. For more information see Key into a clip in the Maya Help.
Lesson 5: Inverse kinematics Introduction Inverse Kinematics (IK) allows you to efficiently pose your models and characters for animation. You pose the skeleton by positioning IK handles, usually located at the end of an IK joint chain (for example at the hand). The rotations for the other joints are calculated automatically by an IK solver. An IK solver calculates the rotations of each joint back up the hierarchy of the joint chain based on the position of the IK handle.
As you work through the lesson, you’ll learn about many of the basic features related to skeleton hierarchies, IK, and parent constraints. Some initial setup of the model and IK is required so that it can be posed and keyframed to provide a convincing animation. In this lesson you learn how to: ■ Create and use hierarchies to define logical relationships between animatable objects. ■ Combine the components of a 3D mechanical arm model into a hierarchical grouping.
The scene contains a model of a mechanical arm and a cargo box to be moved by the arm. The components of the mechanical arm include: ■ A cargo magnet cup on the end ■ Three arm segments ■ A base for the arm to swivel about ■ A four-legged base for the assembly To work with this model using IK you must create a hierarchy for it. Understanding hierarchies Inverse Kinematics relies on hierarchical relationships between the components of a model and the IK system to pose and animate the components.
Selecting the parent node at the top of the hierarchy also selects the items contained in the hierarchy below. Selecting a child node lower in the hierarchy selects any child nodes that are lower in the hierarchy. Hierarchies allow you to create complex structures with relationships between components. For example, when you animate a hierarchical model, you simply need to select and move the parent node of the hierarchy and the rest of the model (child nodes) also moves.
3 In the Hypergraph menu, select Graph > Scene Hierarchy. If the menu item appears dimmed, it indicates that the Hypergraph is already displaying the scene hierarchy The Hypergraph displays with a black background by default. In order to see the relationships between the items, the background has been modified for the images in this lesson. 4 In the Hypergraph menu, select View > Frame All to see all the components of your scene. The boxes represent the nodes for the various items in the scene.
Hierarchies combine the various objects into discrete components for the mechanical arm, that is, the base, lower arm, middle arm, upper arm, etc. If you select and rotate any of the parent nodes in the hierarchies, none of the other arm components follow because they are not combined into one unified hierarchy. Creating a skeleton hierarchy To link the various components of the mechanical arm into a hierarchy that can be posed, you need to create a skeleton.
Skeletons are integral to the animation of any character or hierarchical model. Examples of characters that use skeletons are two and four legged animals. Skeletons are also useful for animating other organic components such as the tail of an animal, a tentacle of an octopus, or a snake. In the following steps, you create a simple skeleton consisting of four joints that you combine with the mechanical arm model into a skeleton hierarchy, allowing you to pose and animate the model.
4 From the main menu, select Skeleton > Joint Tool > . The Tool Settings window for the Joint Tool appears. The Joint Tool is used to create the joints and bones for a skeleton. 5 In the Joint Tool settings window, do the following: ■ Click Reset Tool to set the tool to its default settings. ■ Hide the Tool Settings window by clicking the right-pointing arrow that is located in the upper left corner of the Tool Settings window.
7 In the Hypergraph, dolly the view to see the skeleton node hierarchy you just created. (It appears at the right side of the view.) 8 In the Hypergraph, select the joint1 node. The entire skeleton becomes selected. Any rotations on this node also affect anything lower down the hierarchy. 9 Select joint2 (You can also press the down arrow on your keyboard to select further down the hierarchy). The skeleton is selected from joint2 downwards in the hierarchy.
Once a skeletal hierarchy is created, the various surface components can be added to the hierarchy. Parenting a model into a skeleton hierarchy Parenting is the term used when placing a node beneath another in a hierarchy so it becomes the child of the node above it (its parent) in the hierarchy. In the following steps, you add the surfaces of the mechanical arm model into the skeleton hierarchy.
4 Repeat the parenting process for the following items: ■ pin3 is parented under joint3 ■ pin2 is parented under joint2 ■ pin1 is parented under joint1 Your new hierarchy should appear as shown in the diagram below. In the next steps, SwivelBase becomes the parent node for the new hierarchy so that the entire arm assembly swivels about the center of the base component. 5 In the Hypergraph, select the node named joint1 and then shift-select the node named SwivelBase.
9 In the Hypergraph, select the node named Swivel_base. In the side view, observe that both the mechanical arm model and the skeleton are selected. Swivel_base is the parent or root node for the hierarchy. If you rotate SwivelBase, everything else below that node (the entire arm with skeleton) rotates. 10 Select the node named joint3. Observe that the last two components of the mechanical arm are selected. If you rotate joint3, only the components below that node in the hierarchy will be affected.
efficient to use Inverse Kinematics to pose the skeleton. For more information on forward and inverse kinematics, see Posing skeletons in the Maya Help. NOTE It’s not a simple matter to state that one technique or another is the only approach to achieving a desired result when animating in Maya. You must decide whether a particular technique works for a particular scenario based on the options it provides. A combination of animation techniques can be creatively used in a variety of ways.
■ Hide the Tool Settings window by clicking the right-pointing arrow that is located in the upper left corner of the Tool Settings window. The ikSCsolver setting selects the IK Single Chain Solver. This solver ensures that the joints in the skeleton will lie along a single plane. This solver is well suited for the mechanical arm, because the arm doesn’t need to twist, unlike a real arm.
5 In the Hypergraph, select the node named ikHandle1. The IK Handle (in combination with the end effector) is used by the IK solver to calculate the rotation of the joints in the IK chain. By default, the IK Handle is located at the last joint of the IK chain in the scene view. 6 Select the Move Tool from the Toolbox, and drag the Move Tool’s Z axis manipulator (blue arrow) to reposition the mechanical arm. When you drag the manipulator, the skeleton and mechanical arm model are repositioned.
You create a control object to select and manipulate an IK system instead of directly using the IK Handle. You can create a control object with a curve or a locator, which are often used because they don’t appear in the rendered image. The control object controls the movement of the IK Handle using a constraint. You can constrain the position, orientation, or scale of an object to other objects using constraints. To create a control object: ■ Create and position the control object in the scene view.
To rename the control object using the Hypergraph 1 In the Hypergraph, right-click the node named locator1. Choose Rename from the pop-up menu that appears. The locator1 name is highlighted on the node. 2 Type the name ArmControl and press Enter to save the name for the locator. Before you constrain the IK handle to the control object, you need to freeze the transformations for the control object. Freeze Transformations zeros the transformations for an object without changing the position of the object.
To easily identify the locator as the control object in the scene view, label the control object using an annotation. An annotation is a text label that can be set to point at the labeled item. Annotations are useful because they always face the viewer, regardless of the orientation of the model in the scene view. To label the control object in the scene view 1 In the Hypergraph, select the ArmControl node. 2 In the main menu, select Create > Annotation. A input window appears.
To simplify the display of the Arm Control node 1 In the Hypergraph, right-click the ArmControl node. Choose Collapse from the pop-up menu. (You can also double-click a node to collapse or expand the hierarchy below it.) The ArmControl node appears as a single node instead of the previous three node hierarchy. The small arrowhead on the lower left-hand corner of the node indicates that the node is collapsed. The control object must be linked to the IK Handle to control the IK Handle.
The IK handle is constrained to the control object. In the Hypergraph, a constraint node is created beneath the ikHandle1 node. 4 In the Hypergraph, select only the ArmControl node. 5 In the Toolbox, select the Move Tool. 6 In the side view, drag the manipulator to reposition the control object. (Experiment with a few different positions in the side view only.) When you drag the manipulator, the control object moves, which in turn moves the IKHandle.
You make CargoMagnet point downwards using an orient constraint. An orient constraint constrains the orientation (rotation) of the X, Y, and Z axes of one object to match those of the constraining (target) object. In the next steps, you reset the position of the mechanical arm to its default position, and then apply an orient constraint to the last joint in the IK system so that its orientation matches the control object.
2 In the Hypergraph, select ArmControl and then shift-select the node named joint4. (You may need to dolly and track the Hypergraph view to view these nodes.) 3 In the Main Menu bar, select Constrain > Orient > . 4 In the Orient Constraint Options window, do the following: ■ Select Edit > Reset Settings to set the tool to the default settings. ■ Click the Add button. Joint4 is constrained to have the same orientation as the control object.
Limiting the range of motion of an IK system It’s possible to move ArmControl so that the mechanical arm fully extends to a straight position or orients itself to other positions that you don’t necessarily want. You can limit the range of motion of the arm to ensure that the IK system poses in a predictable manner. In the following section, you limit the motion for the IK system as follows: ■ Lock the translation of the control object (ArmControl) so that it can only move in Y and Z.
The numerical field for Translate X is dimmed indicating that the channel is locked. If you try to move ArmControl in X, it will not be possible unless you unlock the Translate X channel. To lock the Rotate X and Z channels for SwivelBase 1 In the Hypergraph, select only the SwivelBase node. 2 Open the Channel Box to view the rotation channels for SwivelBase. 3 Set all Translate or Rotate channels to 0, if they are not already.
SwivelBase rotates in the view but the mechanical arm does not rotate. You first might think something is wrong because SwivelBase and all of the arm’s skeletons and surfaces are parented into the same hierarchy. NOTE You may sometimes discover that something doesn’t work in the manner you originally anticipated when setting up an IK system. When this occurs, it’s useful to stop and diagnose why something is working the way it is (or not working the way it should).
The order of selection is important. You want to shift-select the items that will be the child nodes first, and then shift-select the item that will be the parent node last. 6 In the main menu, select Edit > Parent (Hotkey p). In the Hypergraph, IKHandle and ArmControl are now child nodes for the SwivelBase node in the skeleton hierarchy. 7 In the Hypergraph, select only SwivelBase. 8 Using the ChannelBox, set Rotate Y for SwivelBase to 45.
To determine translation limits for the Arm Control 1 In the Hypergraph, select ArmControl. 2 Ensure the Channel Box is open so you can view the translate channels for ArmControl. 3 In the view, select Panels > Orthographic > side. 4 Dolly the side view so you can fully view the mechanical arm. 5 Select the Move Tool. 6 In the side view, press the middle mouse button and drag the mouse diagonally until the mechanical arm is fully extended as shown below.
9 In the Channel Box, observe the numbers that display in the Translate Y and Z channels. When the arm is articulated to a compressed pose, the translation values are roughly as follows: ■ Translate Y: -13 ■ Translate Z: -13 These minimum and maximum values will be used in the steps that follow as the minimum and maximum translation limits for the ArmControl. To set translation limits for the Arm Control 1 In the Hypergraph, select the ArmControl node.
5 In the Translate attributes, click the Trans Limit Y and Z check boxes to undim the numerical boxes and then set the following values: ■ Trans Limit Y (Min): -13 ■ Trans Limit Y (Max): 7.5 ■ Trans Limit Z (Min): -13 ■ Trans Limit Z (Max): 1 6 Hide the Attribute Editor. 7 Select ArmControl. 8 In the side view, move ArmControl to test the range of movement for the IK system. The mechanical arm moves with a limited range of motion.
The child nodes below joint1 disappear, simplifying the display of the hierarchy. The small arrowhead on the corner of the joint1 node indicates that a hierarchy exists below joint1. If you later need to view or select these nodes you can expand them again. 2 Collapse the ArmControl and IKHandle nodes. The display of the hierarchy is simplified as shown below. The IK system is now rigged and ready for animation.
3 In the Hypergraph, select ArmControl. 4 In the ChannelBox, set the Translate Y and Z values as follows: ■ Translate Y: -9 ■ Translate Z: 0 The arm is repositioned so that the cargo magnet is directly above the cargo box as shown below. Track, tumble, or dolly the view if required so you can see the mechanical arm unobstructed. 1 In the Hypergraph, with ArmControl still selected, shift-select the CargoBox node. The order of selection is important when you apply constraints.
5 In the ChannelBox, set the Rotate Y value for SwivelBase as follows: ■ Rotate Y: -100 The mechanical arm and the cargo box are positioned as shown below. 6 In the Hypergraph, select Platform and then shift-select the CargoBox node. 7 In the main menu, select Constrain > Parent. CargoBox is constrained to Platform. This is the second constraint for the CargoBox. 8 In the Hypergraph, select only CargoBox. 9 In the ChannelBox, view the parent constraints for CargoBox.
to a value of 1. If you move the mechanical arm, the cargo box will move somewhere between its first and second position. This occurs because each constraint has equal influence on the cargo box at this point. Before you can animate the objects in the scene, you also need to reset the default weight values for each constraint, so that one parent constraint has full influence on CargoBox when the other does not. To set the weighting for the parent constraints 1 In the Hypergraph, select only CargoBox.
Planning the action usually involves sketching a simple storyboard, and writing out a brief timeline for the action for each component. In this lesson we’ve provided a simple version for you. The basic premise for the action is as follows: ■ The cargo box is positioned directly in front of the mechanical arm. ■ The mechanical arm extends, and positions the cargo magnet to be directly touching the top of the cargo box.
■ The mechanical arm lowers the box, placing it in a new position. ■ The mechanical arm extends upwards, leaves the cargo box in the new location, and rotates back to its original position. The table below breaks down the action indicating what action occurs for each object at the specified keyframes.
Frame Mechanical Arm Cargo Box 160 SwivelBase rotated with arm to original position Second position 180 Collapsed position Second position To pose the mechanical arm you select either the ArmControl or SwivelBase nodes and set a keyframe depending on which component you want to pose: ■ ArmControl controls the movement of the mechanical arm. ■ SwivelBase controls the rotation of the arm. ■ CargoBox’s position is based on the parent constraint weights.
3 In the Channel Box, set the following values: ■ Translate Y: 0 ■ Translate Z: -13 4 From the main menu, select Animate > Set Key. To set the remaining keyframes for the arm and the swivel base, use the table below as a guide, and set the attributes in the following order: ■ Set the frame using the Time Slider. ■ Set the attributes for the object in the ChannelBox. ■ Set the keyframe (Animate > Set Key).
Frame Select Set attribute Select 120 ArmControl TransY: -9 TransZ: 0 Set Key 121 ArmControl TransY: -9 TransZ: 0 Set Key 140 ArmControl TransY: 6 TransZ: -13 Set Key 140 SwivelBase RotateY: -100 Set Key 160 SwivelBase RotateY: 0 Set Key 160 ArmControl TransY: 6 TransZ: -13 Set Key 180 ArmControl TransY: 0 TransZ: -13 Set Key Once the keyframes for the mechanical arm are set you can use the playback controls to playback the motion for the mechanical arm.
3 In the Channel Box, set the following values (if they are not set already): ■ ArmControl W0: 0 ■ Platform W1: 0 4 In the Channel Box, select the ArmControl and Platform channels by shift-clicking on the names. 5 Right-click on either one of the selected names. A drop-down list appears. 6 From the drop-down list, choose Key Selected. Key Selected sets a keyframe for the selected attributes only.
Frame Select Set attribute Select 60 CargoBox parentConstraint ArmControl W0: 1 Platform W1: 0 key selected 120 CargoBox parentConstraint ArmControl W0: 1 Platform W1: 0 key selected 121 CargoBox parentConstraint ArmControl W0: 0 Platform W1: 1 key selected To playback the animation using the playback controls 1 Click play on the TimeSlider playback controls to play back the animation.
Skeletons and skinning in the Maya Help. For a tutorial on smooth skinning see Lesson 2: Smooth Skinning (Introduction on page 304). An easy method to parent one node to another using the Hypergraph is to drag one node over top of the other using your middle mouse button. ■ Create an IK system with a control object for manipulation. It is very common to create characters with multiple joint chains and multiple IK handles to control them. Control objects simplify the selection and posing of the character.
Character Setup 7 Introduction A typical 3D character can be made up of many surfaces and components. To ensure that the character animates in the way that you want, it is important to carefully plan the process of character setup. Character setup or rigging is the general term used for the preparation of 3D models with their accompanying joints and skeletons for animation.
■ Lesson 2 Smooth skinning: Introduction on page 319 ■ Lesson 3 Cluster and blend shape deformers: Introduction on page 330 Preparing for the lessons 1 To ensure the lessons work as described, select the Animation menu set. Unless otherwise noted, the procedures in this chapter assume the Animation menu set is selected. 2 If you have not already done so, copy the GettingStarted folder from its installation location to your projects directory. Then, set the GettingStarted directory as your Maya project.
■ Use Inverse Kinematics (IK) techniques to pose a skeleton. Learning how to bind a character to a skeleton is described in the next lesson. Open the scene for the lesson In this lesson, you’ll work with a scene that we created for your use. The scene contains a human character. In the remainder of the lesson, you’ll create and animate a skeleton for the character. To open the scene 1 Make sure you’ve done the steps in Preparing for the lessons on page 304. 2 Open the scene file named Skeleton.ma.
group the chains together to create a single skeletal hierarchy. In the steps that follow, you create the joints for the legs. To create joints for the legs 1 Select Window > Settings/Preferences > Preferences. In the Preferences window, click the Kinematics Category. Enter 0.4 for the Joint Size, then click the Save button. This displays the joints smaller when you create them in the next steps. At the default size, 1.0, the size of the joints makes them hard to position accurately for this character.
joint is in a position that creates a slight forward bend. The forward bend ensures that you will be able to animate the leg easily in a direction natural for a leg. 4 Press Enter (Windows and Linux) or Return (Mac OS X) after creating the toe joint. This completes the joint chain. 5 Select Window > Hypergraph: Hierarchy. The Hypergraph is a convenient place to select, rename, and parent objects. It is similar to the Outliner, but it has features tailored for character setup.
refer to directions from Jackie’s point of view, not from your view of the scene.) As mentioned before, when you move a joint, all joints lower in the hierarchy move with it. If you press Insert (Windows and Linux) or Home (Mac OS X) while a joint is selected, you can move the joint without moving joints below it in the hierarchy. (To exit this mode, press Insert or Home again.) NOTE You may need to rotate left_hip so that the skeleton fits inside the leg.
In the next steps, you create a joint chain for the spinal column. You also extend a joint from the upper neck region of the joint chain so that you can animate the jaw. To create joints for the spine and jaw 1 In the side view, use the Joint Tool to create a series of joints at the locations shown in the figure. Start at the base of the spine near the existing hip joints (left_hip and right_hip) and end at the top of the head.
The S-shaped curvature of the joint chain resembles Jackie’s spinal curvature. This makes it easier to animate the character’s torso and neck naturally. 2 Starting at the base of the spine, name the joints back_root, pelvis, lower_back, mid_back, upper_back, lower_neck, upper_neck, and crown. 3 To set up the skeleton for jaw movement, extend a joint from the upper_neck joint.
3 In the top view, select the left_elbow joint, select the Move tool, press Insert (Windows and Linux) or Home (Mac OS X), then move the joint to the back of the arm. Press Insert or Home again. Moving the joint to the back of the arm creates a bend at the elbow. This will make it easier to animate the character’s arm in the direction an arm naturally bends. 4 In the perspective view, select left_arm_root. Select Skeleton > Mirror Joint.
It’s useful to add extra joints in areas of the character where you want the surface to keep its volume upon deformation. In the next steps, you’ll add ribs to Jackie’s skeleton. Although you will not bind the character in this lesson, the technique of adding ribs is important to learn so that when you do bind a character, the skin in the torso area will not collapse as you pose shoulder and spinal rotations. The rib joints are for structure only, not for posing the skeleton.
6 For easy identification in the Hypergraph, you can optionally name the ribs as desired. For instance, name them left_top_rib, left_mid_rib, left_bottom_rib, and so on. 7 Mirror the left rib joints to create ribs for the right side of the skeleton. Creating a skeleton hierarchy So far you have created five separate joint chains: one for the spine, and one for each arm and each leg. You need to create a single hierarchy from the five joint chains so you can move all of them as a single unit.
Forward and inverse kinematics There are two techniques for posing a skeleton: forward kinematics and inverse kinematics. Forward kinematics (FK) To pose a character with forward kinematics, you rotate each joint individually until you get the desired positioning. For example, to move a hand to some location, you must rotate several arm joints to reach the location.
To set up the character prior to creating IK handles 1 Select the root of the hierarchy, back_root, and then select Skeleton > Set Preferred Angle. This sets the current joint angles throughout the skeleton as the preferred angles. This is a useful step after you complete a skeleton. Maya thereafter uses the current bend in the knees and elbows as the preferred initial rotation direction of these joints during inverse kinematics (IK) posing.
7 In the side view, use the Move tool to drag the IK handle up and to the left (see illustration), as if Jackie were stepping up a staircase. The foot and knee move while the hip stays in place. 8 Set another key for the IK handle. 9 Go to frame 24. Move the IK handle back to its prior position. Set another key. 10 Play the animation to see the leg step up and down during the first 24 frames. This completes a simple animation of the leg using an IK handle to control its position.
As you drag the handle to some positions, you might notice the leg joints flip abruptly (see the next figure for an example position). It’s therefore hard to control the leg positioning in this region. The default IK handle (IK Rotate Plane handle) has manipulators you can use to avoid joint flipping. With the handle selected, select Modify > Transformation Tools > Move Tool, Rotate Tool, Scale Tool, Show Manipulator Tool.
2 Click left_shoulder, and then click left_wrist. This creates an IK handle for the left arm. 3 Select Skeleton > IK Handle Tool. 4 Click right_shoulder, then click right_wrist. This creates an IK handle for the right arm. 5 Practice posing and animating the handles.
■ As you created the skeleton in this lesson, you ended the arm’s joint chain at the wrist. This prevents you from animating hand motion. If you need to animate hand motion or even finger motion, you would need to make additional joints and IK handles. The same applies to foot and toe motion. ■ When you create a skeleton, you can animate a character bound to it to produce natural skin deformations. Although you animated an unskinned skeleton in this lesson, it’s more common to animate a skinned skeleton.
By default, the influence a joint has on a skin point’s movement depends on how close it is to that joint. You can edit skin point weighting to change the default movement. In this lesson you learn how to: ■ Bind a skeleton using a smooth bind technique. ■ View and modify skin weights using the Skin Weights Tool. ■ Use influence objects to enhance the skin deformation of a character. Open the scene for the lesson In this lesson, you work with a scene we created for your use.
3 Select Window > Settings/Preferences > Preferences. In the Preferences window, click the Kinematics Category. Enter 0.4 for the Joint Size, then click the Save button. This displays the joints smaller. At the default size, 1.0, the large size of the joints obstructs the view of the skin. Smooth binding a skeleton You use Jackie as the surface to be bound to the skeleton. To bind the skeleton using smooth skinning 1 Select Jackie. 2 Shift-select the back_root joint.
Note that you can also select the IK handles in the Hypergraph. The handles are indented under jackieSkeleton. Each is named for a leg or arm, for example, ikHandleLeftLeg. For more details on IK handles, see Lesson 1: Skeletons and kinematics on page 304. 6 If you prefer to turn off the skin’s transparency so you can see the skin more clearly, turn off Shading > X-Ray. Do not be concerned that the skeleton pokes through the skin, as the skeleton is not displayed in a rendered image.
Skin weighting and deformations In the next steps, you’ll learn how joints and skin weights influence deformations at Jackie’s chest. In a subsequent section, you’ll improve uneven deformations. To see how skin weights affect a skin’s deformation 1 Pose the left arm similar to the following figure. The left breast becomes irregularly shaped. 2 Select Jackie. 3 Select Skin > Edit Smooth Skin > Paint Skin Weights Tool > .
In general, a white region of skin is influenced nearly entirely by the joint selected in the Influence section of the Tool Settings window. A gray region is influenced significantly by one or two additional joints. The reason the left breast becomes irregularly shaped as you pose the arm is that some joint is exerting too much or too little influence on the breast. 5 Select each entry in the Influence list to determine which joints are influencing the irregular region of the breast.
that increasing the influence of one joint lessens the influence of the other influencing joints. 4 To check the shape with full-color shading, click the Select Tool. (You might also prefer to cancel the selection of Jackie to eliminate the display of the highlighted wireframe.) 5 To continue modifying the skin weights with the Paint Skin Weights Tool, select Jackie and once again select Skin > Edit Smooth Skin > Paint Skin Weights Tool.
various poses. It is common for a surface to look good in one pose but not in another. Strive to make the surface look good in the poses that you are likely to use during animation. 2 If you want more practice, pose the right arm as you posed the left arm and fix the corresponding irregular region in the right breast. This time, fix the region by modifying the weights for the upper_back joint rather than the right_arm_root.
4 Select Skin > Go To Bind Pose. 5 Select the ikHandleLeftArm in the Hypergraph. Use the Move Tool to move the handle manipulator slightly in any direction. When you release the mouse, note that the arm does not move and that the IK handle manipulator snaps back to the desired position at the end of the joint chain. Repeat this step for any other IK handles you posed previously. 6 Turn on Modify > Evaluate Nodes.
To make the sphere an influence object 1 In the Hypergraph, select Jackie and Shift-select elbow_influence. 2 Select Skin > Edit Smooth Skin > Add Influence > . In the Add Influence Options, select Edit > Reset Settings, and then click the Add button. Maya completes the operation within a few moments. To ensure the influence object stays in the correct position at the elbow, you will parent it to the left_shoulder joint.
The left elbow looks more natural than the right elbow. To tune the elbow’s deformation during bending, change the position, scale, and rotation of elbow_influence. Do not be concerned if the influence object pokes through the skin. It won’t be displayed when you render the animation. Beyond the lesson In this lesson you learned how to: ■ Bind a skeleton to a single surface. You can bind a skeleton to multiple surfaces or even to a selection of polygonal vertices or NURBS CVs or subdivision surfaces.
Smooth skinning is just one of the techniques for perfecting a character’s deformations during animation. You can use Maya’s other deformers alone or in addition to smooth skinning to achieve the results you want. For more information, please refer to Smooth skinning in the Maya Help. Lesson 3: Cluster and blend shape deformers Introduction Facial animation is an integral component of character animation. The face of a character can be animated to impart a range of emotions and expressions.
2 Open the scene file named ClusterBS.ma. This file can be found in the GettingStarted directory that you set as your Maya project: GettingStarted/CharSetup/ClusterBS.ma 3 Select Shading > Smooth Shade All and then Shading > Hardware Texturing, and Lighting > Use All Lights to view the head fully textured (Hotkey 7). Creating a target object for a blend shape In the next steps, you duplicate the face of the head to create a target object for the blend shape.
3 Move the duplicate face to a position where both faces are visible for comparison, for instance, to the right side of head. 4 Rename the duplicate face as smilingFace. This duplicate face will be modified so it can be used to influence the original. Creating a cluster deformer on a target object In the next steps, you create a cluster deformer on the duplicated face (target object) to reshape the expression into a smile.
The region of selected vertices does not need to be exact. The objective is to select all vertices where a smile might deform the face. You might want to look in a mirror to see which parts of a face move while smiling. It’s better to select too many vertices than too few. It’s easier to work with too many vertices than too few. TIP An easy way to select the vertices is to use the Paint Selection Tool. First, right-click smilingFace in the scene view and select Vertex from the marking menu.
2 Select Create Deformers > Cluster. This puts the vertices into a cluster—a set of points you can move as single entity. The cluster’s handle appears in the view as a C icon. 3 In the Outliner, make sure the cluster2Handle is selected. 4 Use the Move tool to drag the cluster handle up along its Y-axis a small amount until smilingFace is deformed as follows: The cluster set on smilingFace should be slightly higher than the cluster on the original face.
2 Select Edit Deformers > Paint Cluster Weights Tool > the smilingFace in grayscale. . This displays The white area shows the points that make up the cluster. The whiteness also indicates the weights—how much the points move in response to the movement of the cluster handle. White indicates a cluster weight of 1—the points move the same distance as the handle. By default, each point has a weight of 1. Black indicates a cluster weight of 0. The points do not move in response to cluster handle movement.
The selected vertices move down a bit, as the weight of 0.5 lessens the effect of the prior movement of the cluster by 50%. 5 To check the shape with full-color shading, click the Select Tool. (You might also prefer to cancel the selection of smilingFace to eliminate the display of the highlighted wireframe.) 6 To return to the Paint Cluster Weights Tool, select smilingFace and Edit Deformers > Paint Cluster Weights Tool > again. 7 In the Tool Settings window, make these settings: Radius(U): 0.
While painting weights, it’s useful to intermittently check the shape with with full-color shading rather than with the grayscale shading. To do this, click the Select Tool to turn off the Paint Cluster Weights Tool. (You might also prefer to cancel the selection of smilingFace to eliminate the display of the highlighted wireframe.) 9 Enter a Value of 0.
move up slightly also. (For many people, skin at the chin and neck moves during smiling.) 10 In the tool settings editor for the Paint Cluster Weights Tool, set the Paint Operation to Smooth. Paint any region where the surface has become irregular. Irregular regions are typically indicated by jagged wireframe curves (isoparms) or where a grayscale color makes an abrupt change to a lighter or darker color. Smoothing averages the weights of the stroked points with the weights of the surrounding region.
4 Select Window > Animation Editors > Blend Shape. This displays the Blend Shape editor, which has a slider for changing the base into the target shape, and buttons for setting keys. 5 Cancel the selection of the faces so you can see the surfaces without the obscuring highlighted wireframe. 6 Drag the slider from 0 to 1 to morph the baseFace into the target, smilingFace. Note that you can click the Key button below the slider to set an animation key for the shape of the face at the current frame.
Refining deformation effects The combination of a cluster and blend shape is ideal for facial animation because it lets you tune various subtle deformations. A few common techniques follow. ■ In the box below the slider of the Blend Shape editor, you can enter a numerical value below 0 to invert the deformations, or above 1 to amplify the deformations. For example, -1 creates a frown, while 1.
undesirably or doesn’t give the exact look you desire. You can also use Ctrl - Z (Windows and Linux) or Control-z (Mac OS X) to undo any undesired changes. Adding target objects to an existing blend shape In the next steps, you duplicate the face again and reshape the duplicate into a new facial expression. You then add the new face to the blend shape node to create another slider in the Blend Shape Editor.
For these vertices, you need to select the vertices by dragging a selection box rather than by using the Paint Selection Tool. The eyebrows have vertices that lie behind its outer surface. The Paint Selection Tool selects only vertices at the outer surface. Dragging a selection box selects all vertices in the boxed region, including vertices that lie behind the outer surface.
8 Select Create Deformers > Cluster. 9 In the perspective view, turn off the selection of Show > Isolate Select > View Selected. Do this again in the front view. By turning off these menu selections, Maya displays all objects in the views again.
4 You can use the sliders alone or in combination to create a smile with raised eyebrows, a frown with lowered eyebrows, and so on. 5 You can optionally select raisedBrow and edit the cluster weights to tune the deformation of the eyebrow region as desired. See Editing cluster weights on page 334 for details.
TIP After you create a blend shape, you can optionally hide or delete a target object (in this lesson, smilingFace and raisedBrow). If you delete a target, you improve Maya processing time but lose the capability to manipulate the cluster handle. For versatility, many animators hide the target rather than delete it. Hiding the target is necessary when you render the scene. It is also useful when you want to unclutter the scene view.
Before you create the blend shape, turn on In-Between in the Create Blend Shape options window, and select the multiple targets in this order: least extreme shape difference first, most extreme shape difference last. Although the lesson showed how to blend individual objects, you can also blend hierarchies of objects. See the Maya Help for more information.
Polygon Texturing 8 Introduction Texture maps let you modify the appearance of your 3D models and scenes in Maya. Texture maps are images you apply and accurately position onto your surfaces using a process called texture mapping. When an image is texture mapped onto a surface, it alters the appearance of the surface in some unique way. Texture maps let you create many interesting visual effects: ■ You can apply labels and logos to your surfaces.
■ You can use illustrations as texture maps to create interesting backdrops in your scenes. Most shading attributes for a surface material can be altered by a texture map. For example, color, specular, transparency, and reflectivity are examples of attributes that can be modified by a texture map. Texture mapping is a key component in the 3D production workflow. Many production environments employ texture artists whose only role is to create and apply the texture maps to 3D models.
Lesson 1: UV texture mapping Introduction There are several techniques for texture mapping 3D surfaces depending on the surface type (NURBS, polygons, subdivision surfaces). Some techniques involve preparing the surfaces for texture mapping. For example, when texture mapping polygonal and subdivision surface types you need to understand how textures are applied using UV texture coordinates.
In this lesson you’ll learn the basic principles of UVs by applying (mapping) an existing image (texture) to a simple polygonal model and creating and modifying the UV texture coordinates so that the texture map appears correctly on the surface. In this lesson you learn how to: ■ Assign a 2D texture map to a polygonal model. ■ Map UV texture coordinates (UVs) to a polygonal surface. ■ Correlate the UVs between the scene view and the UV Texture Editor.
■ Depth: 3 ■ Width divisions: 1 ■ Height divisions: 1 ■ Depth divisions: 1 ■ Axis: Y ■ Create UVs: On ■ Normalize: Off A cube primitive in the shape of a rectangular box appears in the scene view. When the Create UVs option is on it ensures that the primitive object is created with a set of default UV texture coordinates. All polygon primitives in Maya provide an option for creating UV texture coordinates at the time of creation.
Depending on your final image requirements, you can enhance the visual impact of an object by adding one or more texture maps to the assigned shading material. One basic texture map you can apply is a bitmap image also referred to as a file texture. In this lesson, you apply a texture map we’ve created for your use on the cracker box. For more basic information on shading materials and texture maps see the Rendering chapter of this guide and the Maya Help.
The new Lambert material is identical to the default gray material that was previously assigned to the cracker box. However, it’s always a good practice not to modify the default shading material in the scene and create a new shading material and modify it to suit your requirements. 3 In Attribute Editor, double-click in the lambert2 box and then type: box_material to rename the shading material. Renaming the shading material lets you easily identify it later on when you need to edit it.
5 Click the Map button located to the right of the Color slider. The Create Render Node window appears and lists the various texture options you can apply (or connect) to the color channel of the box material. 6 Click PSD File from the list of 2D Textures. Choosing this option specifies that you want to apply an Adobe® Photoshop® format file as a texture. A PSD format file lets you keep the various components of your texture map on multiple layers.
A browser window appears with the path set to the default project directory. By default, Maya looks for source images for texture maps in a sourceimages folder whenever the project folder is set. Maya can use file texture images from anywhere on your workstation or local network. For example, you can have images on a central disk drive that is shared among users in a production environment. 8 Select the image file named UVLesson.psd.
A small preview of the image appears in the Texture Sample box in the Attribute Editor. When a texture is applied to a shading material its attributes get added to the existing attributes for shading material. That is, all of the existing shading attributes remain unchanged except for the attribute that gets modified by the texture. In this case, the grey color is substituted by the image of the cracker box artwork.
The texture map does not appear correctly on the cracker box model. The texture map was designed so that specific sides of the box receive specific regions of the image. Instead, the complete image is being placed on every side of the object. To correct this problem you must modify the default UV texture coordinates for the model so they match the layout of the texture image. To do this, you use the UV Texture Editor.
The panel layouts update to display the Perspective view in the left pane and the UV Texture Editor in the right pane simultaneously. (You can close the Attribute Editor if it is still displayed.) This two pane layout is helpful for two reasons: ■ The two view layout shows you how one item selected in the 3D view relates to the UVs displayed in the 2D view of the UV Texture Editor and vice versa, without having to open and close the views repeatedly.
■ When you edit UVs for a surface mesh in the UV Texture Editor, you can immediately see the effect of the texture map on the model in the 3D scene view. UVs do not initially appear in the 2D view of the UV Texture Editor until you select an object or change the selection mode for an object in the scene view. To view UVs in the UV Texture Editor 1 In the scene view, right-click any region of the cracker box model and select Object Mode from the marking menu. 2 Select the cracker box model.
relation to the displayed image has a direct bearing on how the texture gets mapped onto the surface. TIP If the texture map for the cracker box doesn’t appear in the 2D view, select Image > Update PSD Networks in the UV Texture Editor to refresh the 2D view of the UV Texture Editor. Update PSD Network is normally used to refresh a PSD texture in Maya after you have modified the PSD texture in Adobe® Photoshop®.
is because the default UVs for a Maya cube primitive are created based on a predetermined default shape and do not get updated if the shape or scale of the primitive is modified later on. There are a number of things you can do to correct these issues depending on the situation. For this lesson, you will correct the UV and texture map misalignment by doing the following: ■ Map a new set of UVs for the cracker box model that better matches the individual faces of the cracker box.
to a flat 2D view that can be subsequently correlated to your texture map using the UV Texture Editor. In this lesson, you use a feature called Automatic Mapping to create new UVs for the cracker box model. Automatic mapping lets you specify the number of planes that will be used for the UV projection.
Setting Planes to 3 creates UVs based on projections from three separate directions. Setting the Percentage Space option to 2 sets the size of the space that appears between each of the separate UV projections when they are laid out in the UV Texture Editor. When the projection is complete the new projected UVs from the triplanar projection appear in the UV Texture Editor.
The intensity of the image map is reduced so you can view the UV borders on the projected UVs more easily. The new UVs appear in the UV Texture Editor as shown below. ■ The six rectangular UV shapes, referred to as UV shells or simply shells, now match the aspect ratio for each of the six sides of the cracker box better than the earlier UVs. ■ The UV shells fit within the 0 to 1 UV texture range. Automatic mapping fits the UVs to the 0 to 1 range by default.
Working with UVs in the UV Texture Editor When texture mapping a polygon or subdivision surface type model it is often necessary to modify the UV components for a model so they match the texture map. The UV Texture Editor provides many tools for working with UVs. In this section you learn how to: ■ Select UVs from either the scene view or the UV Texture Editor and accurately correlate them. Selecting UV components is critical to modifying them accurately.
2 In the scene view, right-click on the cracker box model and select UV from the marking menu that appears. 3 In the scene view, select one UV on any corner of the cracker box. Selecting a UV is very similar to selecting a vertex on an object. That is, you select a point that resides in exactly the same position as the vertex. When you select a UV in the scene view, the corresponding UV is also selected in the UV Texture Editor.
When you select this edge in the scene view, notice that two corresponding shell edges also get selected in the UV Texture Editor. This indicates the following: ■ The selected edge is shared by two faces; the front and the top. ■ Selecting the top front edge in the scene view, identifies the corresponding front and top UV shells for the box. (Indicated by the selection in the UV Texture Editor.
2 In the UV Texture Editor, select Polygons > Move and Sew UV Edges. The small rectangular UV shell is repositioned to match the top of the large UV shell and the two shells are combined into one. When you later select and move this sewn shell, it will move as one piece. When two UV shells are selected for sewing, the smallest UV shell is moved to the larger.
4 To display the texture borders for the two shells, select Texture Border Edges. (You can also launch this window by right-clicking the Toggle Texture Borders button on the UV Texture Editor’s toolbar.) In the UV Texture Editor, the texture borders for two UV shells now appear with a thicker line. Displaying texture borders on the UV shells is useful for visualizing where the texture borders exist on the 3D model in the scene view.
which UV shells are combined and which shells are not when you have many UV shells displayed in the UV Texture Editor. If you want to be able to view areas where UV shells overlap in the UV Texture Editor select Image > Shade UVs. When Shade UVs is turned on any selected UV shells appear shaded in a semitransparent fashion. Areas where the shading appears more opaque indicate the regions of shell overlap.
6 In the Move UV Shell Tool options window, turn off the Prevent overlap option which prevents UV shells from being moved so they overlap and then select Apply and Close. The Move Tool manipulator icon appears over the selected UV shell. 7 Drag the green (Y axis) and red (X axis) Move Tool manipulator handles to reposition the UV shell so it matches the displayed texture image. The position of the texture updates on the cracker box model in the scene view as you do this.
11 Confirm that the texture appears correctly on the cracker box model in the scene view by tumbling the scene so you can view the back of the box. TIP If the texture appears upside down, you can continue to rotate it another 180 degrees. If the texture appears reversed, that is, the letters are backwards, you can correct this by selecting Polygons > Flip from the UV Texture Editor menu and choosing the appropriate option setting. 12 From the UV Texture Editor menu, select Tool > Move UV Shell Tool.
TIP The exact UV boundaries can be viewed more clearly when the anti-aliasing for the texture image is temporarily turned off. To do this, select Image > Display Unfiltered to view the texture image without anti-aliasing. If you need to move a single UV so it precisely matches a particular location on the texture map you can turn on Pixel Snap (Image > Pixel Snap). When you select and move the UV using the Move Tool, it will reposition the UV coordinate based on pixel boundaries.
modify and save the file in Photoshop®, remember to select Image > Update PSD Network in the UV Texture Editor so the texture map gets updated on the model in the Maya scene. If you would like to learn how to render an image of the cracker box model see the Rendering chapter of this guide as well as the Maya Help to learn more about lighting, shading, and rendering. This lesson used a simple polygonal model to introduce the fundamental concepts.
Rendering 9 Introduction In Maya, rendering refers to the process of creating bitmap images of your scene based on the various shading, lighting, and camera attributes that you set. When rendering, Maya takes into account all of the various objects and scene attributes, and performs mathematical calculations to produce the final image or image sequence. Once you render a sequence of images, you can then play them back in sequence, producing an animation.
■ Lighting and shadows ■ Cameras and animation ■ Rendering method ■ Visual effects In Maya, rendering can be accomplished using software (Maya Software Renderer, mental ray® for Maya® Renderer, or the Maya® Vector Renderer) or hardware rendering methods. Each type has its distinct advantages. Which renderer you decide to use will be determined by your image requirements (that is, the look you require) and time constraints.
Preparing for the lessons 1 If you have not already done so, copy the GettingStarted folder from its installation location to your projects directory. Then, set the GettingStarted directory as your Maya project. For more information, see Copying and setting the Maya project on page 25. 2 To ensure the lessons work as described, select the Rendering menu set. Unless otherwise noted, the directions in this chapter for making menu selections assume you’ve already selected the Rendering menu set.
Open the scene for the lesson In this lesson, you render a scene we’ve created for your use. 1 Make sure you’ve done the steps in Preparing for the lessons on page 377. 2 Open the scene file named apple.mb. This file can be found in the GettingStarted directory that you set as your Maya project: GettingStarted\Rendering\apple.mb The scene contains an apple sitting on a plane, with another plane as the background. A camera in the scene is animated to revolve around the apple at varying distances.
Creating shading materials for objects A shading material is a collection of attributes that you apply to a surface to control how the surface appears when it is rendered. Shading materials include such attributes as color, shininess, and texture. The following table outlines the materials you’ll be working with: Material Description Lambert Creates a matte surface without specular highlights. Lambert is the default shading material.
The apple and the other surfaces appear with a default gray, smooth shading material, lit using default lighting. Default lighting occurs when no other lights have been placed in the scene. 2 In the perspective view, select the apple stem by clicking its geometry. (Be sure that only the apple stem is selected.) 3 From the Rendering menu set, select Lighting/shading > Assign New Material. The Attribute Editor appears for the Lambert material.
4 Click the gray box to the right of Color. The Color Chooser window appears. 5 Click inside the color wheel and drag to a brown color. The color you select in the Color Chooser is applied to the apple stem. 6 Click Accept to close the window. 7 In the Attribute Editor, rename the lambert shading material to appleStem_lambert. To create materials for the apple 1 Right-click the apple and select Assign New Material > Blinn from the marking menu.
The apple’s surface updates to the same color you select in the Color Chooser. 4 Click Accept to close the window. 5 In the Attribute Editor, rename the Blinn shading material to appleSkin_blinn. To create materials for the counter and wall 1 Right-click the background plane and select Assign New Material > Lambert from the marking menu. The Attribute Editor displays the attributes for the Lambert material. 2 Click the gray box to the right of Color.
The counter, wall, and apple stem all have a matte Lambert surface, while the apple has a shiny Blinn surface. There are many other attributes you can set to change the appearance of these objects, which you’ll explore in the next section. Refining shading materials for objects You can refine the shading materials in the scene to make the objects appear more realistic. In the next steps you connect (or apply) a procedural texture to the counter, and a ramp texture to the apple.
2 To the right of the Color slider, click the Map button The Create Render Node window appears and lists the various textures you can connect to the color attribute of the Lambert material assigned to the counter surface. 3 In the Create Render Node window, scroll through the list of textures, and from the list of 3D Textures, click Granite. The procedural texture gives the counter the look of a stone granite counter top when it is rendered, and provides the context for the scene.
■ In the Color Chooser window, select a beige color and click Accept. NOTE Materials and textures displayed in the perspective view do not show their true appearance. To see the accurate appearance of the texture you must render the scene. To connect a ramp texture to the apple surface 1 Right-click the apple and select Material Attributes from the marking menu. The Attribute Editor updates to display the appleSkin_blinn material properties. 2 To the right of the Color slider, click the Map button.
This texture creates a gradation through a series of selected colors. Applying the ramp texture provides the apple with a realistic variation in surface color. 4 In the Attribute Editor, under Ramp Attributes, change the Type to U Ramp. The Ramp Type indicates the direction of the color gradient. A U ramp applies the gradient in a linear, vertical direction across the object. 5 Add another color component by clicking within the ramp.
6 To change the ramp colors, click the top circular color handle (to indicate which color you want to modify), then click the color box to the right of Selected Color to display the Color Chooser window. 7 Click inside the color wheel and drag to a very dark brown for the first ramp color. Click Accept to close the window. 8 Repeat steps 6 and 7 for the other three ramp colors. For the two middle ramp colors, select a dark red. For the last ramp color, select a deep olive green.
The position of these handles and the corresponding colors affect the location and breadth of the color within the gradient on the apple’s surface. 11 Save your work. In the next section you render your scene to view the textures and materials you’ve assigned to the objects. Maya renderers So far, you’ve seen the results of shading the apple and other surfaces in the scene view. In this view, Maya uses your computer’s graphics hardware to display the shading and textures quickly but with low quality.
Renderer Use Interactive Photorealistic Rendering (IPR) A feature of Maya’s software renderer, used to make interactive adjustments to the final rendered image. You can adjust shading and lighting attributes in real-time, and IPR automatically updates the rendered image to show the effects of your changes. IPR is useful for tweaking an image before rendering to disk.
The following table shows the differences between the Render View and the Scene View: Scene View Render View Display 3D object scene 2D rendered image Surfaces modeled surfaces, the grid, vertices, curves, and object manipulators shaded surfaces only Background default gray background black background by default because only objects with materials that are lit can be seen Quality low-quality, colors and textures do not appear in their final display form high-quality, colors and textures appear
A dark green rectangular border shows the region to be rendered. This region defines the area of the final image, and allows you to decide what appears or does not appear in the final image. (The left and right borders of the rectangle may be positioned at the edge of the window.) 3 Select Render > IPR Render Current Frame (or select the IPR render current frame button on the Status Line). (By default, Maya uses the Software renderer as indicated on the Render View window’s toolbar.
The message displayed at the bottom of the IPR Render View window states “Select a region to begin tuning”. In the next step, you create a subregion of the image to render using IPR. 4 In the Render View, select View > Frame Image to resize the Render View window so it fits closely to the rendered image.
NOTE If the region does not update, in the Render Settings window, turn the Raytracing option off. (You won’t alter any other attributes in this lesson. The purpose of the lesson is to learn the process of rendering, not to perfect the results at this point.) 4 From the Render View menu, select View > Reset Region Marquee. This resets the border of the tuning region to the full resolution of the image. If you update an attribute, the entire image will be updated.
The Render Settings window appears. 2 Click the Common tab, open the Image Size section, and select 640x480 from the Presets drop-down list.
(An image size of 640 by 480 is four times as large as the 320 by 240 image size.) 3 Close the Render Settings window. 4 Close the Render View window.
5 Select Render > IPR Render Current Frame (or select the IPR render current frame button on the Status Line). The Render View window opens and renders an image with an image size of 640 by 480 pixels. NOTE If you are using Maya on Windows or Linux, rendering the scene displays another window called the Output window, typically behind other windows on your desktop. The Output window lists statistics about the image just rendered. For now, you can ignore and close the Output window.
3 Stop the animation at a frame you want to test render. To test render the current frame of animation 1 In the Render View window, select Options > Render Settings. 2 In the Render Settings window, select Maya Software from the Render Using drop-down list. 3 In the Render Settings window, select the Maya Software tab. 4 In the Anti-aliasing Quality section, select Production quality from the Quality drop-down list.
7 Go to frame 120 of the animation, where the apple is viewed in a different position. 8 In the Render View, select Render > Render > Current (apple_camera). Ensure that the rendered image looks good at this frame also. Now that you’ve checked a pair of rendered frames that represent the entire animation, you are ready to render the entire animation sequence. In your own projects, you might want to test render several frames, particularly where new shading and lighting elements occur in the animation.
■ Frame/Animation Ext: Select name.#.ext. This specifies that the filenames will have the format prefix.frameNumber.fileFormat. For example, batch rendering the entire 200-frame animation will create Apple.0001.iff, Apple.0002.iff, and so on through Apple.00200.iff. ■ Image Format: Select Maya IFF (.iff), Maya’s standard image file format. You can use the .iff format for any further work you need to do, including previewing and compositing the animation.
4 Close the Render Settings window. To batch render animation frames 1 Save the scene. It’s a good practice to save the scene before batch rendering. This is useful if, after batch rendering, you need to change any display settings and render again. By saving the scene prior to batch rendering, you can examine the scene to learn which option settings were in effect at the time you batch rendered. 2 From the Rendering menu set, select Render > Batch Render > . The Batch Render Frame window appears.
NOTE For users of Maya Personal Learning Edition, the Use all Available Processors option is disabled. Use the default settings. Batch rendering 50 frames of a simple scene takes a few minutes. A complex scene may take hours per frame, depending on the speed of your computer. To check the status of the batch render 1 While Maya is rendering, select Window > General Editors > Script Editor. Expand the size of the Script Editor window. The window shows a completion log for the frames being rendered.
2 Using the File Browser, navigate to the images directory for your current project (or wherever you saved the rendered sequence of images for the Apple). 3 Click the image file Apple.0001.iff to select the first image in the sequence and then click Open. The FCheck image viewing utility appears and the rendered sequence of 60 frames plays back as an animated loop. 4 Close the window after viewing the animation.
Using IPR There are a few limitations to using IPR for fast visual feedback as you adjust shading and lighting. Besides being unable to provide production-quality anti-aliasing, IPR cannot display several other advanced display characteristics, for example, true surface reflections (raytracing) and 3D motion blur. If an advanced display characteristic seems to be missing from an IPR-rendered frame, try rendering the frame with the software renderer.
objects quickly if the need arises. To set up layers, use the Layer Editor, which appears below the Channel Box by default. For more information, see “Render layers” in the Maya Help. Lesson 2: Shading surfaces Introduction In the real world, objects are seen in specific ways based on the following: ■ The materials they are made of. ■ Their surface textures. ■ How they are lit and reflect light. ■ The environment surrounding them.
Shading Materials provide instructions to the renderer so it can simulate how the surfaces in your scene react to light and appear in the final image. Shading involves such attributes as color, transparency, shininess, and many others to create a realistic look. Editing the material attributes associated with shading materials affects how they appear in the rendered image. In this way, Maya provides the option of allowing you to create images as they would appear in the real world or in your imagination.
The scene’s perspective view also has two settings turned on—Shading > Smooth Shade All and Shading > Hardware Texturing (Hotkey: 6)—which let you see the shading changes you are about to make. Assigning a shading material In the next steps, you create a material and assign it to the surface. A material is a collection of attributes that define color, shininess, and other surface characteristics.
4 In the Color Chooser, click inside the color wheel (hexagon) and drag the pointer to an orange-colored area, as illustrated. The sphere becomes the same color you select in the Color Chooser. Also drag up the slider to the left of the hexagon to get a brighter shade. 5 Click Accept to close the Color Chooser. If you compare the color in the Color attribute box with the sphere’s color in the scene view, you’ll notice a difference. The color you assigned is only one aspect of surface appearance.
In practical usage, the Diffuse setting makes a surface appear brighter. The name diffuse comes from a property in physics that describes how light spreads after it strikes a surface. A surface with a high diffuse property spreads the light that strikes it, making the object appear brighter. Like the Diffuse attribute, the other Common Material Attributes also refer to general characteristics of light and the way a surface reacts to light.
following illustration). You can also render a test image (Render > IPR Render Current Frame). As you work with shading, you’ll find many attributes that have no effect in the scene view, for instance, Ambient Color and Translucence. Generally, the scene view is a rough approximation of how the scene will render. The IPR renderer is ideal for testing shading. It shows the results of all changes you make to shading and shows them immediately.
way each handles specularity. By switching between the material types, you can compare which material gives you the specularity you need. Your settings for the Color and Diffuse attributes are maintained because they are common to all material types. The Specular Shading and all other attribute settings do not convert when you change the material, so it’s best to choose your material before you make many changes.
Textures have a more specialized display purpose than materials. For example, you can use textures to create the appearance of a marbled pattern, bumps, or a logo image on the side of a can. In the Maya Help, a texture is also referred to as a texture node. A node is a collection of attributes (or actions) with a common purpose. A shader is sometimes called a shader node or material node. To display a texture on a surface, you apply a texture node to an attribute of the surface material.
2 Before you create the texture, make sure Normal is selected in the options above the texture swatches. The Normal option means Maya will stretch the texture evenly around the surface. The other settings—Projection and Stencil—are other ways you can apply a texture. You will learn about these settings at the end of the lesson. 3 In the 2D Textures list, click the File button once.
The place2dTexture1 tab is a node with attributes that control the texture’s position on the surface. If you select another object and the Attribute Editor no longer displays the file texture attributes, it’s easy to restore the display. Right-click the sphere, select Material Attributes, and click the texture map icon next to the Color attribute. 8 As an example of the place2dTexture1 placement controls, move the Rotate UV slider slightly to the right, to a value about 5.9.
This tab shows all the materials currently in your scene. It is especially useful when you have a complex scene and you need to locate a material to edit it. The materials you will recognize are the default Lambert material and the Phong E material. You can ignore the others. They exist in all scenes, by default, for use with other Maya features. In addition to the Materials tab, Hypershade includes other tabs to help you keep track of textures, lights, and other nodes related to rendering.
6 From the menus in Hypershade, select Graph > Graph Materials on Selected Objects. A graph appears in the Work Area tab in the bottom section. This graph shows all material and texture nodes applied to this object. While the Materials tab shows a catalog of the materials in the scene, the Work Area tab shows whatever material, texture, or other node you are currently working on. The Graph menu has several menu items that change the contents of the Work Area display.
another material instead. In a later step, you will learn about using Hypershade to make connections between textures and materials. 8 Select Edit > Undo, Redo, Repeat to restore the file texture connection you deleted. 9 In Hypershade, right-click the center of the phongE1 swatch and select Rename. 10 Type: Orange. Renaming is not as important in this scene as it would be in more complex scenes with several materials.
The Mayakist logo file texture is a 2D texture, which wraps evenly around the surface. Next, you create a 3D texture. A 3D texture is for making objects appear to have been carved out of a solid substance, such as marble or wood. To create a bump texture within the Hypershade Editor 1 In the Create bar, scroll down to the 3D Textures heading. For this bump effect, you use a Brownian 3D texture. Experience has shown that a Brownian texture is the best texture for approximating the bumps on an orange skin.
4 Select Graph > Input and Output Connections to view the node connections for the new texture you created. Also notice that bumps from the bump map appear in the Orange material’s swatch. The Orange material swatch is the same as the Material Sample that appears in the Attribute Editor for the material node. (The bumps also appear in a rendered image, but not in the scene view.) 5 Double-click the bump3d1 swatch (the checkered cube) to display its attributes in the Attribute Editor.
■ Octaves: 4.0 These values produce a rendered image closer to real orange skin. Our recommendation for these values is based on experimentation. For Brownian and some other textures, it’s usually faster to get desirable results by experimenting with the settings rather than trying to understand the definition of each attribute. Modifying a bump texture The bump texture is too crater-like to be a convincing orange. The bumps are too numerous and too deep.
2 Click the Interactive Placement button in the Attribute Editor. A manipulator appears for the texture placement cube. 3 In the scene view, click on the center scale box to activate the center scale option. Scale the whole texture placement cube to about twice the original size (until the Scale attribute values are about 2). Now when you render, the bumps on the surface appear wider and smoother, like the bumps on an orange skin.
NOTE If you have tumbled the camera for a different view of the orange or the texture placement cube, ensure you reposition the camera so that the orange’s Mayakist logo is visible before rendering again. Otherwise, the rendered image will appear incorrect. In the rendered image, notice that the bumps still remain on the sphere. Objects do not need to be within the texture placement cube, because it represents an imaginary texture volume, which is infinite.
■ Textures can be applied to a shading material to enhance the realism of the final image. For example, logo graphics, bumps, and so on, can be added to enhance the detail on the surface. ■ Textures can be 2D or 3D in nature. Each has its unique techniques for application and placement. Placement of textures When you put the Mayakist logo on the surface, the letters appeared straight. The letters are actually skewed in the texture.
other textures and control how they blend together. For example, the bottom layer could be the logo image you used in the lesson, and a top layer could be an image of streaking lines that resemble scars. The combined logo and scars would give the orange the final aged look that you wanted. Shader Library As an option, you can install a Shader Library with Maya to help you quickly create common materials, such as bricks, fabrics, foods, and many other surface types.
Lighting and camera techniques are one of the most crucial aspects to consider when working with artificial characters and objects. The more realistic the lighting and shading appear, the more convincing the scene will appear to the viewer. A prerequisite to creating effective 3D rendered animation is to study the lighting and camera effects used in live-action film. Your goal is to create the desired scene ambience while keeping the lights and camera view as unobtrusive as possible.
When you open the scene, Maya lights the scene with default lighting provided by an imaginary light fixture. It emanates light infinitely from a point above and behind the active scene view camera. There is no icon that represents the default light in the scene view. Directional lights Maya has many types of lights that simulate natural and artificial lighting. In the next steps, you create a light for the scene using a directional light.
When you create a light, the scene view does not display its effect, by default. The scene view instead uses default lighting. 3 Select Lighting > Use All Lights (Hotkey: 7). This lights up the scene view only with lights you’ve created, not with default lighting. If you later want to see the scene view with default lighting again, select Lighting > Use Default Lighting (Hotkey: 6). When you render the scene, by default, Maya uses all lights you’ve created.
4 In the Attribute Editor, click the white Color box above the Intensity box. This displays the Color Chooser. 5 Click inside the color wheel (hexagon) and drag the pointer to a red color. The lighting imparts a red hue to the surfaces in the scene. 6 Change the color back to white and set the Intensity to 1.2 or so. You’ll use these settings for the basic lighting of the scene. Spotlights In the next steps, you light part of the desk by creating a spotlight and positioning it within the desk lamp.
If you look at the spotlight icon from several angles, you’ll notice that it is shaped like a cone with an arrow pointing out of it. The cone symbolizes that a spotlight emits a beam of light that gradually widens with distance. 4 Select Modify > Transformation Tools > Move Tool, Rotate Tool, Scale Tool, Show Manipulator Tool. With the spotlight selected, this tool provides two manipulators that you can move to position and aim the light precisely. The look-at point specifies where the light focuses.
You can also use the Rotate tool to center the eye-point more accurately in the lamp housing. An alternative way to position a spotlight is to select the light and then select Panels > Look Through Selected. You can then dolly and pan the view to focus on the desired surface. The area of focus is where the light strikes the surface. To return to the perspective view select Panels > Perspective > persp.
By turning on Use Depth Map Shadows, the spotlight’s lighting is blocked by the first surface it hits (the desk). The floor is in the shadow of the desk so it receives no light. You’ll learn more about Depth Map Shadows later in the lesson. If you were to render the scene with IPR rather than the software renderer, the image would not automatically remove the lighting of the spotlighting from the floor when you turn on Use Depth Map Shadows.
3 Set Dropoff to 10. This attribute sets how much the light intensity diminishes from the center of the circular region out to the edge. Finding the right value is a matter of experimentation. When you increase the Dropoff, the light’s intensity diminishes, so you need to increase the Intensity. For example, increase the Intensity to 1.6.
inward from the circle’s edge. The viewing angle of the camera influences the appearance of the fading at the edge. Rendering creates this result: 5 In the Light Effects section of the Attribute Editor, click the map button to the right of the Light Fog box. This gives the appearance of the light beams illuminating fog or dust in the air. Rendering creates this result: Fog is more noticeable when you view (render) the light beam from a side angle rather than from above the light fixture.
The icon displays the region of the potential illumination. You won’t see light fog under the table. The table blocks the light fog because you previously turned on spotlight’s Depth Map Shadows attribute. You can use the Scale tool on the icon to expand or contract the region of the illumination effect. Shadows Shadows are the darkened areas that appear on a surface when an object gets in the path of a light source. Shadows are cast onto the area of a surface that doesn’t directly receive light.
Depth Map Shadows refers to the algorithm Maya uses to produce shadows. For basic shadowing, you don’t need to know about the algorithm, but you do need to make sure you turn on Use Depth Map Shadows. 3 To sharpen the shadow’s edges, open the Attribute Editor’s Shadows section and then the Depth Map Shadow Attributes section. Set the Resolution to 1024. Rendering creates this result: Increasing the shadow’s resolution increases rendering time.
If you are intent on perfecting shadows in your future projects, try various combinations of values for Resolution and Filter Size. For this lesson, the default values are satisfactory because the shadow edge has minimal contrast. If you create shadows with sharp contrast at the edges, altering the default values will be more desirable.
With a camera selected, the Show Manipulator Tool provides the same two manipulators that you used to position the spotlight: eye point and look-at point. The look-at point sets where the camera aims. The eye point sets the position of the camera. You can select the current camera by selecting View > Select Camera. 4 Select Panels > Perspective > myCamera to view the scene from myCamera.
By displaying a small part of the scene that lies outside the rendered area, you can plan future camera movement more easily, especially if the scene has objects that move in and out of view. Animating camera moves In Maya, the camera can be animated. You can set keyframes for the camera moves the same as for other objects in your scene. In the next steps, you set keys to do a simple animation of the camera’s movement. To animate the camera 1 Go to the start of the playback range.
TIP You can undo and redo view changes such as dolly, track, and tumble by selecting either the [ or ] bracket respectively. You can press these keys repeatedly to undo or return to a particular view orientation. 4 Go to frame 150. 5 Dolly myCamera to create a view similar to this: 6 Set another key. 7 Play the animation to see the camera dolly toward the table for the first 150 frames. At this point, feel free to experiment with keying changes in the view resulting from tumbling and tracking the camera.
In addition to the light fog effect you created in this lesson, you can also create Glow, Halo, and Lens Flare light effects with a similar workflow. To see these effects, the light must point toward the camera view. In some situations, you might want to prevent a light from striking a surface in its path. For example, your scene shows a person leaning against a wall in an outdoor night setting.
Lesson 4: Global Illumination Introduction The mental ray® for Maya® renderer can render using a feature called Global Illumination. Global Illumination simulates the effect of all lighting and inter-reflection in the scene, whether the items are lit directly by a light source or indirectly illuminated by other objects (and diffuse sources of illumination in the scene).
The Global Illumination feature in the mental ray® for Maya® renderer simulates this effect and provides for a realistic illumination simulation in your Maya scenes. In this lesson you learn how to: ■ Differentiate between images made with Global Illumination compared to other lighting types. ■ Render an image using Global Illumination by performing repeated test renders to achieve a final result which includes: ■ ■ Lighting a scene using the mental ray Global Illumination attributes.
The scene contains a still life with a fruit bowl. Other surfaces act as the floor and walls for the scene. The primary light source is a spotlight. The spotlight casts light through a vertical opening in the wall. Some areas in the scene are directly lit and other areas are not. Shading materials have already been assigned to the bowl, fruit, and other surfaces. The apple and orange models are from the previous lessons.
To change the renderer to mental ray for Maya 1 In the main menu, select Window > Rendering Editors > Render Settings (or click the Render Settings icon on the Status Line) to display the Render Settings window. 2 In the Render Settings window, set the Render Using setting to mental ray. When you render an image it will now use the mental ray for Maya renderer.
The Draft setting ensures low anti-aliasing settings are used and reduces the rendering time compared to other preset settings. This is a good practice when evaluating the lighting and basic material properties in your test renderings. Setting the image size for rendering You set the size that an image is rendered in the Render Settings window. For this lesson, you render the image at a size that allows you to evaluate the Global Illumination effect.
Turning on shadows Shadows add realism to a scene, and in this lesson, help to demonstrate how a scene rendered using Global Illumination differs from a scene rendered using direct illumination. To turn on shadows for the spotlight 1 Open the Hypershade window (Window > Rendering Editors > Hypershade) and click on the Lights tab to display the lights in the scene. The scene is lit with one spotlight named spotLightShape1.
To render an image using mental ray for Maya 1 Click in the perspective window. This indicates which camera view you want Maya to render. 2 On the Status Line, click the Render Current Frame icon to launch the renderer to produce an image. The Render View window appears and the fruit bowl scene renders using the mental ray for Maya renderer. 3 Once the render is complete, click the Keep Image icon in the Render View window to save this image.
Render the scene using Global Illumination To render using Global Illumination you need to turn on specific settings or attributes. There are two areas that you must initially set. ■ Turn on the Global Illumination rendering attributes using the Render Settings Window. ■ Turn on the Global Illumination lighting attributes using the Attribute Editor.
To turn on Global Illumination lighting attributes 1 Open the Hypershade window (Window > Rendering Editors > Hypershade) and click on the Lights tab to display the lights in the scene. 2 In the Hypershade, double-click on the icon for spotLightShape1 to display the attributes for the spotlight. 3 In the Attribute Editor, click the spotLightShape1 tab to display the lighting attributes for the spotlight.
2 From the perspective view’s panel menu, select Panels > Saved Layouts > Hypershade/Render/Persp. The panel layouts update to display the Hypershade window, Render View window, and Perspective view simultaneously. This allows you to easily work with these windows without having to open and close them repeatedly. If the image in the Render View window appears pixelated as a result of the new panel layout, do the following: ■ In the Render View window menu, select View > Real Size.
3 Visually compare this rendered image with the previously rendered images. In this rendering, the shadow areas of the scene appear less dark as a result of Global Illumination. The bowl also appears more transparent than in the previous rendering. The effect you want to achieve is to have the shadow regions receive indirect light; that is, you want to be able to view more detail in the shadow areas as a result of the Global Illumination.
3 In the Caustic and Global Illumination attributes adjust the settings to the following: ■ Photon Intensity: 120000 Increasing the Photon Intensity increases the illumination in the areas affected by Global Illumination. To render the scene 1 In the Render View window, click the Redo Previous Render icon to render the image. 2 When the image has completed rendering, click the Keep Image icon to save the image. 3 Compare this rendered image with the previously rendered images.
In the next steps, you return to the Render Settings window and the Attribute Editor to increase the quality attributes that affect the Global Illumination effect. To increase the Global Illumination quality settings 1 In the Render Settings window, click on the Indirect Lighting tab and expand the Global Illumination section. Change the following Global Illumination attributes to: ■ Accuracy: 900 ■ Radius: 2.
When the Accuracy and Radius values are increased, the resulting rendered image shows the circular spots have almost fully disappeared and the Global Illumination is much more uniform when compared to the previous rendering. Increasing the number of Global Illumination photons should aid in making the Global Illumination more uniform. In the next steps, you increase the number of photons to provide a more uniform Global Illumination in the scene.
2 When the image has completed rendering, click the Keep Image icon to save the image and compare this rendered image with the previously rendered images. In this image, the circular spots that were seen in the previous renderings have disappeared.
■ Number of Samples - Max sample level: 1 Sampling is the process for determining the amount of anti-aliasing that occurs. The Sample Level attribute sets minimum and maximum limits for the amount of sampling that will occur for a given pixel area in the image. Modifying the anti-aliasing Sample Level settings will ensure that the surfaces in the rendered image appear smooth. A Max value of 1 should provide the correct amount of anti-aliasing sampling for this particular image at this image size.
Beyond the Lesson In this lesson you were introduced to the Global Illumination features provided by the mental ray® for Maya® renderer. You learned that: ■ The mental ray for Maya renderer provides a feature that simulates indirect illumination in the Maya scene called Global Illumination. ■ Global Illumination allows you to achieve realistic lighting effects for objects and areas of the scene that do not receive direct lighting.
Visualizing the photon mapping can aid in determining whether the coverage and density of photons for the scene is appropriate for the resulting final image. By default, the mental ray for Maya renderer rebuilds the photon map each time you render a scene using Global Illumination.
Lesson 5: Caustics Introduction Caustics are the light effects and specular patterns that are cast on surfaces as a result of focused light reflecting off highly reflective surfaces or refracting through translucent surfaces. The light patterns that occur on the bottom of a swimming pool on a sunny day, or the bright areas that occur in the shadow of a glass object as light shines through it are examples of caustics.
■ Adjust refraction level limits in order to achieve desired refractive effects with transparent objects. ■ Systematically perform test renders and adjust the render and caustic quality settings in order to achieve a high quality image. Open the scene for the lesson In this lesson, you work with a scene we created for your use. In the first steps of this lesson, you open the scene and view the various elements that have been preset for your use.
Render the scene using raytracing To better understand the differences between caustics versus other lighting, you begin by rendering the scene using the mental ray for Maya renderer without using Caustics. You start by preparing the scene and then rendering.
The panel layouts update to display the Hypershade window, Render View window, and Perspective view simultaneously. When you render an image, it appears in the Render View window. TIP You can resize the panels in a preset layout by dragging the border between neighboring panels using your left mouse button. Turning on shadows In this lesson, you learn how the bottle’s shadow can be made to appear more realistic as a result of the caustics.
3 In the Attribute Editor, click the spotLightShape1 tab to display the lighting attributes for the spotlight. 4 In the Shadows section, open the Raytrace Shadow Attributes and turn on Use RayTrace Shadows. When you render the scene, shadows are cast by the spotlight. 5 Hide the Attribute Editor by clicking the Show/Hide Attribute Editor icon on the Status Line. Using the mental ray for Maya renderer To use the Caustics feature in Maya you must render using the mental ray for Maya renderer.
Setting the image size for rendering You set the size that an image will be rendered in the Render Settings window. For this lesson, you render the image at a size that allows you to evaluate the caustic effect. To set the image size for rendering 1 At the top of the Render Settings window, select the Common tab and open the Image Size settings. 2 Choose the 640 X 480 preset from the Presets drop-down list.
Rendering the image When you render an image, all of the objects, lighting, shading materials, and image quality settings are used to calculate the image, from the camera’s view. To render an image using mental ray for Maya 1 Click in the perspective window to indicate which view you want to render. 2 In the Render View window, click the Render Current Frame icon. The bottle scene renders using the mental ray for Maya renderer and the image appears in the Render View window. .
The rendered image shows the following: ■ A translucent bottle with apples beside it casting shadows towards the rear of the scene. Notice how the shadows appear when raytrace rendered. ■ The distortion of the table surface in the translucent glass effect based on the refractions and reflections. ■ A dark region on the surface of the bottle. This results from the bottle reflecting the empty black area of the scene in front of it.
To turn on the caustics preset settings 1 In the Render Settings window, select the Quality tab and set the Quality presets setting to PreviewCaustics. This turns on the presets that control the quality of the caustics. 2 Close the Render Settings window. Mental ray for Maya uses photons to simulate the caustic effects in a scene. Photons are small packets of energy emitted from a light source into the scene.
■ Caustic Photons: 10000 4 Hide the Attribute Editor. Rendering the scene with caustics Now that the lights are set to emit caustic photons and the caustics preset is turned on, you’re ready to render an image using caustics. To render the scene using caustics 1 In the Render View window, click the Redo Previous Render icon. 2 When the image has completed rendering, click the Keep Image icon.
Level setting may need to be increased. When a different preset was selected (Production to Preview), the refraction levels changed. ■ There are spotted areas on the table surface directly in front of the bottle. This can be corrected by adjusting the photon quality settings. ■ The desired caustic effect in the shadow has appeared but is not very pronounced. You want to achieve an effect where the shadow has brighter regions as a result of light being refracted through the surfaces of the bottle.
matching the Caustic Photon refraction settings with the Raytracing refractions is a good practice. To increase the photon refraction settings 1 In the Render Settings window, select the Indirect Lighting tab. 2 In the Photon Tracing section set the following: ■ Max Photon Depth: 6 ■ Photon Refractions: 6 The Max Photon Depth setting limits the Refraction and Reflection calculations for the Caustic Photons to the limit set.
The translucency of the glass now appears more realistic. The caustic effect is more evident in the shadow of the bottle. However, the spotted effect, that appeared on the surface in front of the bottle, is more pronounced. These spots are the result of a low caustics quality setting. Adjusting the quality of caustics The quality of the caustic effects in a scene is primarily affected by the number of photons, the accuracy of sampling, and the radius surrounding the sampled area of illumination.
The Accuracy determines how many photons will be evaluated to determine the Caustic intensity at a given sampling point. Radius determines the size of the region surrounding the particular sampling point. The more photons that get sampled, the more realistic the caustic effect appears in the final image. 2 Close the Render Settings window. Increasing the number of caustic photons that get emitted into the scene also increases the quality of the caustic effect.
In this image the bright spots in front of the bottle should be reduced when compared to the previous images. The caustic in the bottle’s shadow should also appear more pronounced and more evenly illuminated. Beyond the Lesson In this lesson you were introduced to the caustic features provided by the mental ray® for Maya® renderer.
Light sources for caustics Point, spot, and mental ray area lights can be used as light types for caustics with the mental ray for Maya renderer. A Directional light does not work as a source for Caustics because this light type does not have a defined point of origin (that is, the rays emit in a parallel manner).
474
Dynamics 10 Introduction Dynamics is a branch of physics that describes how objects move using physical rules to simulate the natural forces that act upon them. Dynamic simulations are difficult to achieve with traditional keyframe animation techniques. Maya provides a means to do this type of computer animation where you set up the conditions that you want to occur, then let the software solve how to animate the objects in the scene.
Preparing for the lessons Do these steps to ensure the lessons in this chapter work as described: 1 Select File > New Scene to create a new scene before you start each lesson. 2 If you have not already done so, copy the GettingStarted folder from its installation location to your projects directory. Then, set the GettingStarted directory as your Maya project. For more information, see Copying and setting the Maya project on page 25. 3 Select Window > Settings/Preferences > Preferences.
In this lesson, you will be introduced to some of the basic concepts of particles and use particles, emitters, and volume fields to create a fountain-like effect. In this lesson, you learn how to: ■ Create a particle emitter in your scene. ■ Create a field to direct the movement of particles. ■ Use a volume shape to control the movement of particles. ■ Work with particle attributes. ■ Color particles. ■ Use a color ramp to add colors to the particles.
3 Select Create > NURBS Primitives > Circle > set the following options and click Create: ■ Radius: 4 ■ Number of Sections: 25 . In the options window, With Radius set to 4, the circle will be wide enough to see the particle emission clearly. With Number of Sections set to 25, the emission will be distributed evenly from points around the circle.
particle count of the connected particle object increases. When you go to the start of the animation, the particle count returns to 0. Note that if you had created the circle with a smaller Number of Sections, there would be fewer CVs for the circle and therefore bigger gaps between the emission points on the circles. 6 Display the Outliner (Window > Outliner). 7 In the Outliner, select particle1. This is the particle object. A particle object is a collection of particles that share the same attributes.
NOTE If any of these options are not visible, enlarge the Volume Axis Options window. This creates a conical Volume Axis field that affects the motion of particles that enter or exist within its volume. Particles move in relation to a central axis within the volume.
Note that you can use larger or smaller values for the Axis attributes to intensify or diminish movement. Magnitude specifies the strength of the volume axis field. The greater the value, the more force is exerted on the particles. You’ll typically need to experiment with various Volume Axis field attribute values to achieve a desirable motion for particles. Be aware that small arrow-shaped icons within the Axis Field icon show which direction the particles will go.
When the particles move out of the conical region, they continue in the same direction, mirroring the pattern of movement within the conical region. The volume axis field no longer controls the motion, but the particles continue with the same speed and direction they had at the moment they exit. To create a torus volume axis field 1 In the Outliner, select the particle object 2 From the main menu, select Fields > Volume Axis > .
Section Radius defines the thickness of the torus. A value of 2 for Around Axis causes the particles to swirl around the central axis. For a torus, the central axis is the ring in the center of the solid part of the torus. A value of -0.7 for Away From Axis causes the particles to move radially toward the central axis. When you later play the animation, the combination of these values cause the particles to loop up then down as if guided along the inner walls of a torus.
and other small icons within the axis volume field to help get the desired results. Note that the field’s effect is pervasive enough that all particles passing through the hole of the torus are influenced by the field. You can cause particles to pass through the hole by altering the Max Distance and Attenuation. 4 With the torus volume field still selected, enter the following values in the Channel Box: ■ TranslateY: 15 ■ ScaleX: 3.6 ■ ScaleY: 3.6 ■ ScaleZ: 3.
Adjusting the velocity of moving particles The torus volume axis field doesn’t guide the motion of the particles as expected because the initial emission velocity of the particles dominates the motion of the particles rather than the field. You can use a particle object’s Conserve attribute to scale down the emission velocity’s influence and increase the field’s influence. To adjust the velocity of moving particles 1 Select the particle object and set the Conserve attribute to 0.8 in the Channel Box.
the particle render type, you can add attributes specific to the render type to adjust the appearance. To set the particle render type 1 With the particle object still selected, display the Attribute Editor, and select the particleShape1 tab. 2 Scroll down to the Render Attributes section, and set the Particle Render Type to Streak. 3 Go to the start of the playback range and play the animation. The Streak render type displays moving particles with an elongated tail.
To add dynamic attributes 1 In the Attribute Editor, under the Render Attributes section, click the Current Render Type button next to Add Attributes. 2 Observe the attributes that are added. 3 Set the following attributes: Line Width 2 This sets the width of each streak. Tail Fade 0.5 This sets the opacity of the tail fade; it can range from 0 to 1. A value of 1 makes the tail completely opaque; a value of 0 makes the tail transparent. Tail Size 2 This scales the length of the tail.
Adding per particle attributes Particle objects have two different kinds of attributes: per object and per particle. A per object attribute lets you set the attribute value for all particles of the object collectively with a single value. For instance, the per object color attribute lets you set a single color for all the particles in the object. A per particle attribute lets you set the value of the attribute individually for each particle of the object.
Adding color to particles with a color ramp A ramp texture is a patterned 2D image in which the color blends from one shade to another. In the next steps, you use a color ramp to color the particles as they age. To add color to particles using a color ramp 1 In the Attribute Editor, right-click the rgbPP data box and select Create Ramp from the drop-down menu.
This is because the Lifespan is set to the default of 1, which is the number of seconds the particles exist in the animation. 4 In the Channel Box, set Lifespan to 3. Go to the start of the playback range and play the animation. Because the particles live longer, they pass all the way through the cone and part of the way through the torus. The particles change from red to green to blue and disappear as they are born, age, and die.
Hardware rendering particles In 3D animation, rendering typically refers to the act of creating a sequence of high-quality image snapshots for each frame of an animation sequence. After rendering the images, you play them in sequence to create a film or video clip. If the concept of 3D animation rendering is new to you, consider doing the lesson Lesson 1: Rendering a scene on page 377 before completing this section.
The streaks look smoother than they do in the scene view. You can improve the streaks even more as shown in the next steps. 4 In the Hardware Render Buffer window, select Render > Attributes. The Attribute Editor appears. 5 In the Attribute Editor, under the Render Modes section, turn on Line Smoothing. This softens jagged edges when you hardware render Streak or MultiStreak render types. 6 To see the softened edges, select Render > Test Render.
This creates a series of files named Emit.0001, Emit.0002, and so on, through Emit.0075. These files are the rendered frames 1 through 75. Maya puts the files in your current project’s images directory. 5 To play the hardware-rendered sequence, select Flipbooks > Emit.1-75. 6 Close the FCheck image viewing window when you are finished examining the animation. Beyond the lesson In this lesson you were introduced to a few of the basic concepts when using particles.
and once with software rendering. In such cases, you’ll need to composite the two sets of rendered images using a compositing software package. Lesson 2: Rigid bodies and constraints Introduction In Maya, a rigid body is a surface which has the attributes of an unyielding shape. Unlike conventional computer surfaces, rigid bodies collide rather than pass through each other during animation and are used for creating dynamic simulations.
Lesson setup You can create rigid bodies from NURBS surfaces and polygonal surfaces. In the following steps, you create some polygonal surfaces to be used for the rigid bodies. To create polygonal objects for the rigid body simulation 1 Make sure you’ve done the steps in Preparing for the lessons on page 476. 2 In the Time and Range Slider, set the start frame to 1 and end frame to 200. 3 Select Create > Polygon Primitives > Cube > .
To position the objects for the rigid body simulation 1 Position the objects as shown in the side view in the following illustration.
Creating hinge constraints A Hinge constraint constrains rigid bodies along a specified axis. You can use a Hinge constraint to create effects such as a door on a hinge, a link connecting train cars, or a pendulum of a clock. In this example, the Hinge constraint constrains the plank to a position in the scene view. In the following steps, you’ll add Hinge constraints to the center of the planks, which automatically turns the plank into a rigid body. You will do this for each plank.
Running a dynamics simulation In the next steps, you create a ball and add gravity to make the ball drop and hit the planks and then playback the simulation. To create a ball for the simulation 1 Select Create > Polygon Primitives > Sphere > . 2 Set Radius to 0.2 and click Create. 3 In the Channel Box, set the Sphere’s Translate Y value to 18. To add gravity attributes to the ball 1 With the sphere still selected, select Fields > Gravity.
To change an active rigid body to a passive rigid body 1 Select pCube1 and display the Attribute Editor. 2 Click the rigidBody1 tab to display the rigid body attributes. 3 In the Rigid Body Attributes section, turn off Active to make pCube1 a passive rigid body. Hide the Attribute Editor. 4 Go to the start of the playback range and play the animation. Observe how pCube1 no longer reacts to the impact of the ball, but the ball continues to bounce off it.
You can also create a hinge constraint between a passive rigid body and a position in the scene view, two rigid bodies, and an active and passive rigid body. Other types of constraints include pin, nail, spring and barrier constraints. For additional information on the types of constraints and their usage, please refer to the Maya Help.
Painting 11 Introduction Maya provides painting tools that go above and beyond what many 3D creative artists might normally envision. These tools allow you to accomplish a wide range of modeling, animation, texturing, and effects work. The painting tools are separated into three categories: Maya® Artisan™ brush tools, Maya® Paint Effects™ tools, and 3D Paint. If you completed the previous lessons in Getting Started with Maya, you already have experience with a few of these tools.
The Artisan brush tools have a variety of applications and allow you to directly modify attribute values interactively: ■ In the NURBS modeling lesson, you used the brush tools to sculpt a simple face from a sphere. ■ In the Character Setup chapter, you used Artisan brush tools to modify the skin weights on a surface mesh to ensure the character’s joint deformed properly.
Preparing for the lessons To ensure the lessons work as described, do the following: 1 Consider doing the lessons in the Rendering section of this guide. Familiarity with Maya rendering concepts is important to understanding the following lessons. 2 If you have not already done so, copy the GettingStarted folder from its installation location to your projects directory. Then, set the GettingStarted directory as your Maya project. For more information, see Copying and setting the Maya project on page 25.
■ Use the pre-defined Paint Effects brushes to paint flowers and foliage. ■ Save modified brush settings to the Shelf. ■ View the alpha channel for your 2D image. Painting strokes In the following steps, you display the 2D canvas and use preset brushes to paint a few strokes. Although not covered in this lesson, you can use a tablet and stylus to paint with pressure sensitivity. The harder you press down, the more paint is applied.
When you first display the Paint Effects panel, your strokes use the default brush—a solid black stroke similar to an airbrush. TIP You can dolly and track the canvas using Maya’s standard mouse and keyboard conventions. 6 Now paint with various preset brushes. To select a preset brush, select Brush > Get Brush or click the following button in the toolbar: The Visor window opens. The Visor organizes the hundreds of Paint Effects brushes into category folders.
Some brushes apply paint directly along the paint path, while others produce added effects. For example, the pens folder includes brushes such as ballpointRed.mel that work like pens, while the flowers folder includes brushes such as dahliaPink.mel that grow flowers as you drag the mouse. Brushes like dahliaPink.mel use Paint Effects tubes. 1 Select the dahliaPink.mel brush and drag the mouse slowly for one stroke, then quickly for the next stroke.
2 Select Brush > Edit Template Brush or click the following button in the toolbar: You can edit various brush settings, for example, the brush width, in the window that appears. 3 To resize the brush, change the Global Scale value. Alternatively, you can move the brush over the canvas, press and hold the b Hotkey and drag left or right. The circle on the canvas represents the size of your brush. 4 Paint on the canvas to try out a new size. 5 Close the Paint Effects Brush Settings window.
NOTE The Toolbar color boxes, for example, C and T, are also available in the Paint Effects Brush Settings window. (Select Brush > Edit Template Brush > Shading.) Modifying the canvas In the next steps you change a few canvas options, including color and size. To modify canvas settings 1 Clear the canvas (Canvas > Clear). 2 Select Canvas > Set Size and set the canvas size to 512 x 512—the width and height in pixels. When you are prompted to save, click No, then close the Set Canvas size window.
The strokes wrap around to the opposing side. This feature is useful for creating patterned texture images to be applied to surfaces. When you tile or repeat the image on the surface, the wrapped strokes help make the borders between the images unnoticeable. If you want to display the area of the canvas where the edges join, you can do this using the roll feature (Canvas > Roll). . In the options window, slide the Clear Color 5 Select Canvas > Clear > slider all the way to the left. Click Apply.
6 Click the B color box (Bud Color) and select a shade of yellow from the Color Chooser. B sets the color of the flower buds. 7 Paint on the canvas and observe how the changes you’ve made to the settings affect the final paint effect. TIP You can change the path width of fern.mel without changing the width of the leaves and stems. Select Brush > Edit Template Brush to display the Brush Settings window, then in the Brush Profile section, change the value of Brush Width.
By default, only Leaves and Buds are created as you paint. You can also create Branches, Twigs, and Flowers to simulate a fern in various stages of its natural life cycle. 3 Turn on Flowers. Paint on the canvas to see the result. 4 Open the Leaves section, change Leaves in Cluster to 4, then paint on the canvas. Leaves are created in radial clusters around a branch or twig. This setting defines how many leaves are in each cluster. The higher the number, the denser the foliage.
To save a brush to the Shelf 1 On the main menu bar, select Paint Effects > Save Brush Preset. This is the menu item you use to save the template brush as a preset brush. 2 Type the name blueFern in the Label box as well as the Overlay Label box. This name appears in icons on the Shelf or Visor after you save the brush. 3 For the Save Preset option, turn on To Shelf. This means you’ll put the brush on the Shelf but not in the Visor.
When you select the next brush (gold.mel), Maya uses 80% of its shading and 0% of its shape. Conversely, the stroke uses 20% of the grassOrnament.mel brush’s shading and 100% of its shape. 4 To confirm the effect, select gold.mel (in the metal folder), then paint on the canvas. 5 Repeat the preceding steps, experimenting with different preset brushes, Shading, and Shape values. As a first try, blend flameCoarse.mel from the fire folder with the existing template brush. Set Shading to 60 and Shape to 30.
To smear, blur, and erase paint 1 Select Brush > Reset Template Brush to select the default brush. 2 On the Brush menu, try the Smear, Blur, and Erase menu items and paint on the strokes already on the canvas. You can also change these settings using the Brush Type setting in the Paint Effects Brush Settings window (Brush > Edit Template Brush). 3 If you need to perform compositing work, you can view the image’s alpha channel by clicking this button: . White regions represent full opacity.
8 Select Paint Effects > Preset Blending to turn off Preset Blending before you proceed to the next lesson. Beyond the lesson In this lesson, you learned how to: ■ Use Paint Effects to paint on the 2D canvas. ■ Use the preset Paint Effects brushes from the Visor. ■ Edit, blend, and save preset brushes for later use. Painting on the 2D canvas is useful when you need to create a texture to be applied to a surface.
Lesson 2: Painting in 3D using Paint Effects Introduction The Paint Effects Tool goes beyond traditional paint software by allowing you to paint directly in 3D space, either on the ground plane or on an object’s surface. When you use Paint Effects for 3D work, the paint strokes are three-dimensional and editable.
In this lesson, you begin to explore what is possible with painting in 3D using the Paint Effects Tool by learning how to: ■ Paint directly in the 3D scene view. ■ Choose brushes from the Visor and the Shelf and modify their brush attributes. ■ Paint in 3D using the Paint Effects panel. ■ Differentiate between paint brushes and paint strokes. ■ Make surfaces paintable so paint strokes can be applied to them. ■ Select brush strokes and modify their attributes.
Regardless of your operating system, the Paint Effects preset brushes are accessible from the Visor panel. (From a view panel, select Panels > Panel > Visor.) Brushes and strokes Like a traditional paint program, Paint Effects allows you to use a brush and paint strokes. In Paint Effects, the brush and stroke have unique qualities and characteristics. A brush contains the various attributes that define the appearance and behavior of the paint.
In the scene view, the cursor changes to a red circle with a vertical line indicating it is set to paint a stroke. The circle indicates the width of the brush path. With some types of strokes, this path will appear as the width of the actual paint; with other stroke types, it indicates the width of the tube seeding path, for example, plants, trees, etc. The settings of the preset brush you select are copied to the template brush. The template brush settings are used when a paint stroke is drawn.
■ Drag the mouse while pressing the left mouse button. One or more wireframe daisy stalks appear in the scene view along the path of the paint stroke. When you paint a stroke in the scene view it initially appears as a wireframe. Paint is not applied to the stroke until it is rendered. The stalks that extend out of the curve or stroke are called tubes. In Paint Effects, strokes are either simple strokes or strokes with tubes.
4 In the scene view, drag any of the Move Tool manipulator arrows to reposition the stroke. Each time you paint a stroke, Paint Effects creates a new brush and stroke node and attaches them to the stroke that is created. You can modify these brush and stroke nodes once they’ve been created. To edit these brush or stroke attributes, you use the Attribute Editor. To modify the attributes of an existing paint stroke 1 To view the Attribute Editor, click the Show/Hide icon on the Status Line.
3 Click on the strokeDaisyLarge1 tab to see its attributes. This tab contains information related to the transform node, because the most important attributes on this tab control the stroke’s curve transformation. 4 Under Transform Attributes, set Rotate to be 0, 90, 0. The stroke is rotated 90 degrees about the Y axis.
5 Click the strokeShapeDaisyLarge1 tab to see its attributes. This tab is called the stroke attribute node because the attributes establish the paint stroke’s properties when the stroke is first created. 6 Expand the End Bounds section by clicking the arrow to see the Min and Max Clip attributes. Min Clip specifies the start of the stroke along the path. Max Clip specifies the end of the stroke along the path. 7 Drag the Max Clip slider from its present value of 1.0 to a value of 0.1.
11 In the daisyLarge1 node, expand the Tubes attributes, then Behavior and Forces. 12 Drag the Gravity slider to the right so that the value of gravity increases to a value of 1.0. The daisies lay on the ground plane, as if wilting, with the increased gravity.
Drag the Gravity slider back to its original position approximately so that the stalks appear upright. The last tab in the Attribute Editor is the time node. The time node is used for animation and dynamics. You do not use this node in this lesson. Rendering Paint Effects strokes The paint strokes display in wireframe mode when you paint in the scene view. Working in wireframe mode is very efficient in terms of interactive performance but you don’t see how the paint actually appears.
The Render View window opens, renders the image, and then displays it. The daisies may initially appear a bit dark in the image. The Maya renderer creates a temporary light with a default brightness level in order to render the image when no lights are present in the scene. This ensures that you don’t produce an image that is totally black; however it may not produce the correct illumination for your scene.
The Attribute Editor updates to display the attributes for the active directional light. 4 In the Attribute Editor, set the Intensity for the directional light to be 1.5. 5 From the Status Line, click the Render Current Frame button to render the scene again. The image renders and the Render View window image is refreshed. The daisies appear brighter in this version of the rendered image. 6 Close the Render View window. Sometimes you may want to view your painted strokes as you paint.
The scene painting view is a snapshot of the modeling view. In this view you can both paint and view your strokes in a rendered fashion to see what they will really look like as you work. You can dolly, track, and tumble in the scene painting view. You can select objects by pressing the Ctrl key and clicking on them. If you want to move, or otherwise manipulate 3D objects in the scene view, you must exit the Paint Effects panel by pressing the 8 key again.
Now you must manually refresh the Paint Effects rendered view using the Redraw Paint Effects view button in order to see the paint strokes rendered. 5 Dolly the view to obtain a closer view of the daisies. 6 Manually refresh the rendering of the daisies by clicking the Redraw Paint Effects view button. 7 Exit the scene painting view mode by pressing the 8 key. Paint Effects on 3D objects With Paint Effects, you can paint 3D strokes directly on 3D objects in a Maya scene.
In this section, you create a surface for an underwater terrain and sculpt it to the desired form using the Sculpt Geometry tool. You use the underwater preset Paint Effects brushes found in the Visor to begin the underwater scene. Creating a surface to paint on In Paint Effects, NURBS surfaces are the only surface type you can paint on. You will create a NURBS plane, and sculpt it to make its surface appear like an underwater terrain.
This surface will become the seabed terrain for your scene. To sculpt a terrain using the Sculpt Geometry Tool 1 Select the plane surface. 2 On the Status line, select Surfaces from the drop-down menu. The Main Menu changes to display Surfaces menu set. 3 From the Main menu, select Edit NURBS > Sculpt Geometry Tool. The cursor display changes to the brush cursor for the Sculpt Geometry tool.
6 Drag the cursor along the back right edge of the plane to pull it upwards as shown. 7 Drag the cursor along the back left edge of the plane to pull it upwards. 8 Dolly and track the view as required so you can easily view the areas you need to sculpt. 9 Sculpt along the front and middle of the plane to make some bumpy areas. 10 Repeat steps 7 through 10 until you have your 3D terrain looking roughly as shown in the image below.
11 When you complete your terrain, return to the Rendering Menu set by selecting Rendering from the drop-down menu on the Status Line. 12 Hide the Sculpt Geometry Tool settings window before proceeding. To select preset brushes from the Visor 1 From the main menu, select Paint Effects > Get Brush. The Visor panel appears. 2 In the Visor, click the Paint Effects tab to display the various brush folders. 3 Scroll down the brush folders list to the underwater folder, and click it to view its contents.
If you make an object paintable and then try to paint on one that is not paintable, no stroke occurs. If you don’t make any objects in your scene paintable, your strokes are placed on the ground plane. To paint on a 3D object 1 With the terrain surface selected, select Paint Effects > Make Paintable. 2 From the Visor, select the brush named kelp.mel. 3 Paint a short stroke onto your 3D terrain surface.
Using turbulence with brush stroke tubes In the ocean, kelp would react to the turbulence created by ocean currents. The tube attributes associated with many preset brushes have turbulence attributes turned on for interesting visual effects. Turbulence attributes can be increased from their default settings to make the kelp sway back and forth, providing additional realism when used in an animation. To increase the turbulence on the kelp brush tube 1 In the scene view, select the kelp stroke.
You can adjust the turbulence settings while viewing the playback. If the frame range is too short, you can modify it to suit your needs. Using additional preset brushes 1 From the Visor, select the brush named fanCoral.mel. 2 Paint a few fan coral strokes in your scene near the back edges of the plane. TIP If you paint a stroke in your scene and want to delete it you can do so by one of the following methods: ■ Press Ctrl + z to immediately undo the stroke.
5 From the Status Line, click the Render Current Frame button. 6 The renderer executes, renders the image, and then displays it in the Render View window. You can create a seabed texture for the plane primitive, a few rocks, and some animated fish swimming to complete your scene. You can spend additional time to further refine this scene, but this example gives you an idea of how a scene with various 3D props can be quickly established using Paint Effects and the various preset brushes found in the Visor.
Mesh brushes Mesh brushes are a brush type that provide special features not available with other Paint Effect brush types. Mesh brushes render using polygonal triangles rather than brush stamps. As a result, mesh strokes can be more accurately texture-mapped for realistic results. They also appear more realistic compared to other brush types whether they are viewed close-up or from a distance. The mesh brush stroke can also be converted to a polygonal surface in the Maya scene.
3 From the Shelf, select the Paint Effects tab to display the Paint Effects preset brushes. 4 From the Paint Effects shelf, select the Teapot Brush. In the scene view, the cursor changes to a sphere icon indicating it is set to paint a stroke. The Teapot Brush is a mesh brush type. 5 In the scene view, drag your mouse or stylus along the ground plane to create one short stroke. 6 Dolly and tumble the view to see the wireframe version of the stroke.
To render the paint effects stroke 1 From the Status Line, click the Render Current Frame button. The renderer executes, renders the paint stroke, and then displays the image in a Render View window. 2 Close the Render View window. Mesh brush types are useful for representing hard surfaces compared to other brush types (the teapot is one example). Converting mesh strokes to polygons Mesh strokes can be converted to polygons.
2 Select the teapot stroke, if it is not already selected. 3 Select Modify > Convert > Paint Effects to Polygons > . 4 In the Convert Paint Effects to Polygons Options window, ensure that the Hide Strokes option is set to On. Setting the Hide Strokes option to On ensures that after the conversion, only the converted polygon mesh will be displayed. 5 In the Convert Paint Effects to Polygons Options window, click Convert. The mesh brush stroke is converted to a polygonal surface.
Modifying a converted polygonal mesh By default the original brush stroke is linked to the new polygonal surface via construction history. If you modify the original brush stroke attributes, the polygonal surface will update so long as the construction history link exists. This construction history link allows you to easily modify the polygonal mesh surfaces in a variety of ways. You modify the brush stroke attributes using the attribute editor.
4 In the Attribute Editor, expand the Mesh attributes section to display its attributes. 5 In the Mesh attributes, drag the Tubes Sections slider to the left to a value of 3. The body, spout, and handle of the teapot update to display as 3 sided surfaces.
Tube Sections defines the number of sides around the width of the tubes in a mesh stroke. Changing the Tubes Sections gives a range of results depending on the brush type you choose. 6 Set the Tubes Sections to a value of 18. 7 In the Attribute Editor, close the Mesh attributes, and then expand the Tubes attributes, then the Creation attributes. The Creation attributes control the main body of the teapot; the “trunk” or “stalk” of your paint effect mesh type. 8 Scroll down to the Width Scale attributes.
The Width Scale graph allows you to control the width of a tube by interpolating the shape between the index points. (If you look closely at the graph, you’ll see the profile of the teapot laying on its side.) 10 Drag the index marker back to its original position. 11 Close the Creation attribute section in the Attribute Editor, and open the Growth attributes, followed by the Leaves attributes.
If you want to adjust the attributes of the teapot handle, you can edit the Flower attributes. Using this converted poly mesh is one example of how the attributes of the paint stroke can be modified to affect the shape of another object through construction history. If you delete the paint stroke, the construction history between the stroke and the polygonal teapot will be removed. If you then want to make further changes to the teapot, you must use the Edit Polygon tools.
■ Paint directly in 3D space onto the ground plane or onto 3D objects. ■ Select and move strokes in the scene. ■ Edit brush and stroke attributes using the Attribute Editor. ■ Render paint strokes. ■ Use the Paint Effects Panel to paint fully-rendered paint strokes. ■ Create a terrain to paint on using the Sculpt Geometry tool. ■ Understand the structure and archetype for strokes with tubes. ■ Use mesh brush types to paint hard-surface objects.
■ Paint using a Thin Line brush type which allows you to render large numbers of fine tubes much more quickly than the Paint Brush type. This brush type is useful for painting hair. Lesson 3: Painting textures on surfaces Introduction The 3D Paint Tool allows you to paint textures directly onto a model’s surface. In this lesson, you paint colors, patterns, and textures on a dinosaur model. In this lesson you learn how to: ■ Prepare a surface model for painting.
The scene contains a model named Dino. Although Dino is a polygonal model, the 3D Paint Tool works on all surface types: polygonal, NURBS, and subdivision surfaces. To prepare for this lesson, we assigned a Blinn material named DinoSkin to the model. In Maya, you can paint a surface only if it has a material assigned to it. We also gave the Blinn material a green color. A color is optional, but it provides a base color for the texture you will paint.
The 3D Paint Tool requires that the material assigned to your model has a file texture applied to it. Because there is no file texture yet assigned, the warning appears. When you move the cursor over Dino, you see a circle-X icon that indicates you cannot paint on the model. 3 To make sure you have the default settings for the 3D Paint Tool, click Reset Tool at the top of the 3D Paint Tool settings panel.
Painting with an Artisan brush In the following steps, you paint various colors on the texture you just assigned. You also change the size of the brush strokes. There are two types of brushes you can use. The default is the Artisan brush, which you’ll use in the next steps. (Artisan refers to a group of painting tools in Maya that share common tool settings.) The other brush is based on the Paint Effects brushes; you’ll use it later in the lesson.
6 Experiment with different colors and brush sizes on Dino. To undo a brush stroke, choose Edit > Undo, Redo, Repeat. The number of strokes you can undo is specified by the Queue Size in the Undo category of the Preferences window (Window > Settings/Preferences > Preferences). 7 To remove paint, turn on Erase in the Paint Operations section and stroke the desired region.
As you paint, the strokes are reflected along the axis and appear on the other side of Dino. Tumble to see the reflected stroke on Dino’s other side. Using Flood All to apply a single color You can apply a single color to the entire texture without painting individual strokes. To use Flood All to apply a single color 1 In the Flood settings of the 3D Paint Tool settings, click the Color box and select a pale green color from the Color Chooser.
3 In the Brush settings, click the following icon and paint a stroke: By changing to the square brush shape, your brush stroke has a straight edge. Along with the shapes available from the icons, you can choose from many other unusual brush shapes that are based on image files. You’ll do this in the next step. Before you do the next step, undo the brush stroke you just made so it doesn’t distract from the next paint strokes. 4 In the 3D Paint Tool Brush settings, click the Browse button.
The brush shape pattern overlaps itself as you paint, resulting in a striped pattern. Undo the stroke. 8 To avoid the overlapping pattern of the prior step, increase the Stamp Spacing (in the Stroke section) to 50. Paint on Dino with a continuous stroke and you’ll see the brush pattern without it overlapping. The Stamp Spacing setting defines how paint is applied when you stroke the surface. If you set Stamp Spacing to 1, the edges of the brush shape pattern just touch each other.
The Visor window opens. The Visor organizes the hundreds of Paint Effects brushes into category folders. 2 Scroll to the watercolor folder and click it. To the right, swatch pictures of the Paint Effects brushes appear for this category. 3 Select the spatterLight.mel brush. (To see the names of the swatches, drag the pointer over them.) Leave the Visor window open, but move it so you can see Dino again.
6 Open the Shading section in the Paint Effects Brush Settings window. For the Incandescence1 setting, move the slider to the right and stop midway. 7 Close the Paint Effects Brush Settings window and paint on Dino. Now the paint has an incandescent glow. Smearing and blurring In the next steps you’ll smear and blur the paint on Dino. Smearing with a Paint Effects brush blends adjacent colors together along the stroke path. Blurring softens the edges of adjacent colors by averaging their color values.
4 In the Paint Operations section of the 3D Paint Tool settings, select Paint Effects Blur. This selects the default Paint Effects Blur brush. 5 Paint across the side of Dino to see the effect of Blur. Painting a bump map texture Next, you’ll paint a bump pattern on Dino. In Maya, a bump texture creates the illusion of surface relief. It does this by perturbing the surface normals to make the surface appear bumpy. This is useful for making Dino’s skin appear more “reptile-like”.
Earlier in the lesson, your painting affected only the Color attribute. To paint bumps, it’s necessary to select a BumpMap as the new attribute you want to paint, and then assign a new texture for the bumps you’ll create. 4 In the Assign/Edit Textures window, set both Size X and Size Y to 512 and then click Assign/Edit Textures. Maya creates a file texture and applies it to the Bump Map attribute of the DinoSkin material. In the scene view, Dino’s color changes to white.
This region will update when you paint. For the IPR renderer to render bumps as you paint, you must update the bump map texture after each stroke. You can set this to occur automatically. 10 In the File Textures section of the 3D Paint Tool settings, turn on Update on Stroke. For a grooved bump effect, you need to change the brush shape. 11 In the Brush section of the 3D Paint Tool settings, click the Browse button. 12 Select the hatch.jpg brush and click Open. 13 Paint on Dino’s side.
15 Select Display > UI Elements > Channel Box/Layer Editor. Beyond the lesson In this lesson you were introduced to a few basic techniques related to the 3D Paint Tool. You learned how to: ■ Paint textures directly onto surfaces using the 3D Paint Tool. ■ Paint symmetrically onto surfaces. ■ Paint grey scale attributes to create bump texture effects. There are several other capabilities in the Paint Operations section, such as the Clone option for Artisan brushes.
in the Maya Help by referring to the sections on Polygonal and Subdivisions surfaces. If you already have experience with editing UVs, remember these two requirements for 3D painting: ■ UVs must not overlap. ■ UVs must fit with the 0 to 1 texture coordinates. This illustration shows the UV Texture Editor with the UVs for the Dino model used in this lesson. These UVs meet the above two requirements. Notice that the UVs form several meshes; they do not need to be one solid mesh.
Beyond the lesson | 563
564
Expressions 12 Introduction Expressions are program-like instructions you create to control keyable attributes over time. Expressions can be comprised of mathematical equations, conditional statements, or MEL™ commands. Expressions offer an alternative to difficult keyframing tasks similar to Set Driven Key. With Set Driven Key, attribute relationships can be set up and are defined using animation curves.
This chapter contains the following lessons: ■ Lesson 1 Creating a simple expression: Introduction on page 567 ■ Lesson 2 Conditional expressions: Introduction on page 574 ■ Lesson 3 Controlling particle attributes: Introduction on page 584 Preparing for the lessons To ensure the lessons work as described, do these steps before beginning: 1 Select File > New Scene to create a new scene.
4 With the pointer in the perspective view, press 5 (for Shading > Smooth Shade All). It’s easier to see the expression effects on shaded objects than wireframe objects in the following lessons. Lesson 1: Creating a simple expression Introduction This lesson introduces you to some basic concepts regarding the creation and editing of expressions. You learn how to: ■ Use the expression editor to create and edit expressions. ■ Control both single and multiple attributes of objects in your scene.
4 In the Expression Name box, you can optionally enter an expression name, for instance, ScaleBallHeight. If you write several expressions in the same scene, giving each a name might make it easier to find the desired expression if you decide to alter it later. If you don’t provide a name, the expression receives a default name, for instance, expression1. Note that the Attributes list displays Ball’s keyable, unlocked attributes—the attributes you’ll most likely want to animate with an expression.
At the default animation playback rate of 24 frames per second, time has these values (rounded to four decimal places): Frame Time (seconds) 0 0 1 0.0417 2 0.0833 3 0.125 24 1.0 240 10.0 You can find the time elapsed in the animation at any frame by calculating this formula with a desktop calculator: For example, if the frame rate is 24 frames/second and the animation is at frame 1, the elapsed time is 1 divided by 24, or 0.0417. At frame 6, the elapsed time is 6 divided by 24, which equals 0.
Maya executes the expression each frame. This causes the object size to scale along its Y-axis, stretching its height during playback. To see the value of Ball’s scaleY attribute at any particular frame, select Ball, display the Channel Box, and stop the animation at the desired frame. The Channel Box updates its values after you stop the animation. The scaling is smooth because the geometry stretches in synch with the small time increments of the animation playback. 8 Close the Expression Editor window.
Ball.scaleY = time + 1; 3 Change the expression to this: Ball.scaleY = time/5 + 1; By dividing time by 5, you’ll make the Y scaling increase one-fifth as fast as with the previous version of the expression. Note that you can use the keyboard commands Ctrl-c (Windows and Linux) or Control-c (Mac OS X), Ctrl-x or Control-x, and Ctrl-v or Control-v to copy, cut, and paste text in the Expression Editor and elsewhere in Maya. 4 Click Edit to update the modified expression.
Ball.scaleX = time + 1; Ball.scaleY = Ball.scaleX; Ball.scaleZ = Ball.scaleX; The second statement sets Ball.scaleY to the value of Ball.scaleX. Because you’ve set Ball.scaleX to the value of time + 1, Ball.scaleY also has the value of time + 1. You’re linking one attribute’s value to another. The third statement also sets Ball.scaleZ to the value of the attribute Ball.scaleX. The advantage of this expression is that if you assign a different value to Ball.
Beyond the lesson In this lesson you learned how to: ■ Create and edit simple expressions using the Expression Editor. ■ Use variables, for example time, to control the specific attributes within expressions. When you write expressions, it is common to assign the built-in time variable to an attribute so the attribute value predictably increases as the animation plays.
This discrepancy means the Ball scaleY is larger than its scaleX and scaleZ attributes in the first frame of the animation. Although the difference is minor in this example, other cases might be more significant. To start your animation at frame 1 and get the same result as the example, you can subtract 0.0417 from the attribute: Ball.scaleY = (time - 0.0417) + 1; When you go to the start time, the expression sets Ball’s scaleY value to (0.0417 - 0.0417) + 1. This equals 1, its original scaleY value.
4 Go to the start time. 5 With Balloon selected, choose Window > Animation Editors > Expression Editor. 6 Enter this expression: if (time < 2) Balloon.scaleY = time; This expression is an if statement. The if keyword causes the expression to make a decision based on a comparison of two or more items. In this case, the expression compares the value of time to the value 2. The expression checks whether the value of time is less than two seconds. If so, it does the assignment Balloon.scaleY = time.
The flattened Balloon’s scale increases along its Y-axis. It inflates as the animation plays. At 2 seconds and thereafter, Balloon no longer inflates. When time equals 2 or more, the if condition is no longer true. The statement that follows it, Balloon.scaleY = time, no longer executes. The value of the scaleY attribute stays at the last value it had before time became 2, specifically, 1.9583. Recall that this example uses a frame rate of 24 frames per second. The time and Balloon.
The < in the condition is a relational operator. A relational operator tests how one value relates to another. In the example, the < tested whether time is less than 2. Besides the < operator shown in this example, there are several other relational operators such as >, >=, ==, and so on. See the Maya Help for more details. 9 Stop the animation and go to the start time. Balloon flattens again because the scaleY attribute becomes 0 when you go to the start time. Time is 0, so scaleY is 0.
NOTE Always examine the Script Editor for error messages after you edit an expression and click the Create button. If you alter a previously successful expression and a syntax error occurs, Maya executes the previous successful expression when you play the animation. This might make you believe your changes took effect. Error messages are preceded by the text // Error:. 4 Stop the animation and go to the start time. Balloon flattens but doesn’t return to the origin.
The flattened Balloon returns to its correct position at the origin. 8 Play the animation. Balloon inflates for two seconds, then rises. As it rises, it jumps slightly higher at approximately frame 48. Fixing a problem in an expression As mentioned before, Balloon skips from Y-axis position 0 to 2 after two seconds of animation play. You can eliminate the skipping and make Balloon rise smoothly from the origin. To fix the skipping in the animation 1 Stop the animation and go to the start time.
When time is greater than or equal to 2, the translateY position of Balloon becomes 2 minus 2, which is 0. As time increases beyond 2 seconds, the translateY position increases in the same increments that time increases. 4 Stop the animation and go to the start time. Using else statements The expression achieved the desired result, but with unnecessary complexity. You can use an if-else statement to make the statement more compact and easier to read. 1 Change the expression to this: if (time < 2) Balloon.
the expression. This improves your animation’s playback and rendering speed. Either expression is valid. If using the if-else construction seems confusing, stick with multiple if statements. You can accomplish most expression animation tasks with several if statements strung after one another. 4 Stop the animation and go to the start time. Simplifying expressions You can simplify the expression to make it easier to read. 1 Change the expression to this: if (time < 2) { Balloon.translateY = 0; Balloon.
Editing expressions to refine an animation You can further refine the animation by expanding Balloon more slowly. To edit the expression to scale the balloon more slowly 1 Change the expression to this: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; } else Balloon.translateY = time - 2; (The asterisk (*) multiplies time by 0.6.) 2 Click Edit. 3 Play the animation. The scaleY attribute increases at 60% of the value of time, so Balloon expands slower during playback. (The number 0.
To edit the expression to change the balloon’s initial scale 1 Change the expression to this: if (time < 2) { Balloon.translateY = 0; Balloon.scaleY = time * 0.6; Balloon.scaleX = time * 0.5; Balloon.scaleZ = time * 0.5; } else Balloon.translateY = time - 2; 2 Click Edit. At frame 0, Balloon disappears from view because its scale attributes are 0. The scaleX, scaleY, and scaleZ attributes are 0 at frame 0 because time is 0. Any number multiplied by 0 is 0. 3 Play the animation.
Beyond the lesson In this lesson you learned how to: ■ Use conditional statements to control an expression. You can accomplish many expression tasks with several if statements strung after one another. However, using else statements instead of multiple if statements makes an expression simpler to read. If statements and else statements are two of the most common programming features available in expressions.
attribute to the particles. To color particles with an expression, Maya requires you to dynamically add the appropriate attribute. To create a particle object 1 Make sure you’ve done the steps in Preparing for the lessons on page 566. 2 From the Dynamics menu set, select Particles > Particle Tool > .
8 Turn on Add Per Particle Attribute, then click the Add Attribute button. This adds an rgbPP attribute to the particle shape node for Bubbles. Because you’re adding this attribute as a per particle attribute, you can give each particle a different color. Using creation expressions to set a constant color To set an attribute that doesn’t change during the animation (the particle color), you’ll use a creation expression. A creation expression executes when you go to the start time.
Using runtime expressions There is one other type of expression you can create for a particle object (shape node)—a runtime expression. By default, a runtime expression executes each frame during playback. A runtime expression does not execute when you go to the start time (or at the time in which a particle is emitted).
region of radius 1. The left, middle, and right rgbPP color components get a value no less than -1 and no greater than 1. (R, G, and B values less than 0 are treated as 0—a black color). The sphrand function returns a different random vector each execution, so each particle receives a different random rgbPP value, and therefore, a different color. The color changes each frame. 5 Rewind and play the animation again. The particles become red when you go to the start time, and random colors during playback.
returns the remainder after division. For example, 24 divided by 24 returns 0, but 25 divided by 24 returns 1. (Dividing 25 by 24 equals 1 with a remainder of 1.) If the value of frame divided by 24 is equal to any number with a remainder of 0, the assignment to BubblesShape.rgbPP occurs. In other words, the assignment occurs when frame equals 24, 48, 72, and so on. At an animation rate of 24 frames/second, the assignment happens once each second. The == symbols mean is equal to.
For a particle object, you typically create two expressions—a creation expression that initializes an attribute value in the first frame, and a runtime expression that controls the attribute value in subsequent frames. (Creation and runtime expressions exist only for particle objects, not for other types of objects.) This lesson described how to color stationary particles as a simple way to describe creation and runtime expressions.
Scripting in Maya 13 Introduction Scripting languages in Maya allow you to: ■ Automate repetitive or frequently performed tasks. You can write scripts to execute operations that would normally be selected from the user interface or performed using tools and user manipulation. ■ Change Maya’s user interface. You can create windows and controls that affect objects in the scene. ■ Establish development standards. You can enforce naming conventions, workflows and model scales.
Some basic concepts The following section introduces some basic concepts that help you understand what’s going on when you use scripting in Maya. The command architecture Maya has a command-based architecture for handling all of its operations. The commands for all of Maya’s functionality are accessed through scripting language commands tied to the Maya user interface—menus, tools, dialog boxes; in fact, just about anything you interact with in Maya.
Entering commands in Maya There are several ways to explicitly enter scripting commands in Maya. ■ To enter single line MEL and Python commands, use the Command Line. To show the Command Line if it is hidden, select Display > UI Elements. The Command Line is located near the bottom edge of the Maya interface. ■ To enter multi-line MEL and Python commands, use the Script Editor. The Script Editor displays a history of executed commands, as well as the results and outputs of commands.
NOTE MEL also has an alternate syntax, which implements commands and flags in a method similar to the C programming language. For more information, see MEL for programmers in the MEL and Expressions guide. Getting help on MEL You can get help with MEL in three ways: ■ To access help on a particular MEL command, open the MEL Command Reference by selecting Help > MEL Command Reference. ■ Help can also be accessed from within the Script Editor by using the Maya Command help.
All Python commands are case-sensitive; maya.cmds.SPHERE is not the same as maya.cmds.sphere (and returns an error message). Getting help on Python You can get help with Python in several different ways: ■ To access help on a particular Maya (Python) command, open the Python Command Reference by selecting Help > Python Command Reference. ■ You can also access help on Maya Python commands from within the Script Editor by using the Maya Command help(). For example: typing maya.cmds.
3 Make sure the Construction History icon (below the menu bar) is on. (If it is turned off, it has a large X across it.) 4 Ensure that the interactive creation option for primitives is turned off by selecting Create > Polygon Primitives > Interactive Creation. The option is off when a check mark does not display beside the item’s name in the menu. 5 Ensure that the interactive creation option for surfaces is turned off by selecting Create > NURBS Primitives > Interactive Creation.
■ Enter MEL commands in the Script Editor ■ Create geometry with MEL commands ■ Modify attributes of objects with MEL commands ■ Interpret Script Editor history Entering MEL commands You can enter MEL commands in the Command Line or the Script Editor. The Command Line can only accept single line MEL commands, while the Script Editor provides a method to input multiple MEL commands and view the results. To use the Command Line to input MEL commands 1 Select Display > UI Elements.
In the Script Editor, the Enter (Windows and Linux) or Return (Mac OS X) key above the Shift key does not execute a command. It starts a new line so you can type several commands before executing them. Observing script history The Script Editor displays a running history of executed commands and the results of commands that Maya executes. You can copy most commands from the history section of the Script Editor and paste them in the input section to execute them.
you become more experienced in MEL, the extra lines of history can be useful for debugging a MEL script. 1 In the Script Editor window, ensure that there is not a check mark beside History > Echo All Commands. To observe script history 1 In the Script Editor, click the Clear History button. You can more easily isolate the command history created by the commands you perform when there is no other history in the Script Editor.
Blank spaces and returns make scripts easier to read. Flags cannot be separated from the hyphen character by extra spaces or returns. TIP For more details on these flags, see sphere in the MEL Command Reference. The MEL Command Reference gives a complete listing of the functionality of all MEL commands and flags. NOTE You can copy commands from the Script Editor history section and paste them in the input section to execute them. 1 Delete the NURBS sphere by pressing the delete key on your keyboard.
A polygonal cube is created at the origin. The command is removed from the input section of the Script Editor after execution. The command and the result of the command is output to the history section of the Script Editor: polyCube; // Result: pCube1 polyCube1 // NOTE In future lessons, when a series of MEL or Python commands creates output, only the output created by the commands will be referred to as output to the Script Editor.
The polygonal cube is moved to the XYZ co-ordinates 3,2,1. The move command has set the translate attributes to the specified arguments of the command. These arguments are called command arguments as they are not used with flags. When a command is typed into the Script Editor, it acts on the current selection, unless an object name is provided as an argument to the command.
The radius flag allows you to specify a value for the radius of the sphere. The value 2 is associated with the radius flag, and is not a command argument. This is equivalent to specifying values within the Polygon Sphere Options dialog in the Maya interface. NOTE Flags have short and long names. Commands execute the same way whether or not you use long or short flag names.
This is equivalent to renaming an object with the Attribute Editor or the Channel Box in the Maya interface. Editing Objects Some MEL commands can take an edit flag that allows you to make changes to the attributes of an object. The edit flag is used in conjunction with other flags specifying which attributes to change.
Commands can operate on objects other than what is currently selected by specifying an object name as an argument. The name must be the last argument in the command. 4 Select the cube and the sphere simultaneously by holding down shift and clicking the sphere. 5 Delete the objects by typing the following in the Script Editor delete; NOTE A list of all flags available for a specific command can be displayed in the Script Editor by typing help command;.
■ Observe the history created in the Script Editor and then copy and paste it into the Script Editor to create your own scripts. Before proceeding with the next lesson you may want to review the material presented in this lesson so you are familiar with the concepts and skills. Some suggested tasks you can try on your own include: ■ Practice using creation commands through the user interface and observing the resulting Script Editor history.
■ A rim light so the object stands out against the background Three-point lighting is used extensively in film, photography and computer graphics. Setting up the scene Here, you create some primitive objects to display lighting and shading . 1 Select File > New Scene to create a new scene. 2 Select Window > General Editors > Script Editor to open the Script Editor. 3 Create a ground plane by typing the following: polyPlane -height 40 -width 40; A plane appears at the origin.
8 Save the rendered image by clicking the Keep image button . This lets you compare your rendered image with future rendered images. A scroll bar at the bottom of the Render View lets you scroll through your saved rendered images. In the next steps, you type commands to create three-point lighting in the scene and record them as script history for later use. Recording the script history In order to make a shelf button, you need to create Script Editor history to copy to the shelf.
directionalLight -intensity 1; Certain commands require that you to refer to the light by name. 3 Rename the selected light to “main_light” by typing the following: rename main_light; 4 Enable the main light to cast shadows by typing the following: setAttr "main_lightShape.useDepthMapShadows" 1; The setAttr command allows you to set attributes of a node. In the above command, you are enabling depth map shadows on the main light.
To create the fill lighting 1 Create a point light with an intensity of 0.5 by typing the following: pointLight -intensity 0.
When creating three-point lighting in a scene with multiple objects, typically there is a main light that provides the main lighting for the scene, and each object in the scene has a linked fill and rim light. Your three-point lighting script only works for objects of medium scale located at the origin, but once the lights are created, you can tweak them to better suit your scene. Saving the history as a button You can save Script Editor history as a Shelf button.
4 Click the MEL button on the pop-up window. A Shelf button is created that executes the scripting commands you dragged to the shelf setting up three-point lighting for a scene. To test the Shelf button 1 Open the scene named Mel_Cone.ma. This file can be found in the GettingStarted directory that you set as your Maya project: GettingStarted/scenes/Mel_Cone.ma 2 Render the scene in the perspective view by selecting the render scene button on the Status Line.
To delete the Shelf button 1 Middle-drag the Shelf button you want deleted to the trash can icon on the far right of the Shelf. NOTE The pointer icon changes to a button. icon when you are dragging a Shelf Beyond the Lesson In this lesson, you learned how to copy history from the Script Editor history section to create Shelf buttons so that you can quickly execute a series of commands. You can: ■ Save multiple MEL script commands as a Shelf button.
■ You can add custom images to a shelf button, change the name of a shelf button, or change the commands associated with a shelf button by selecting Window > Settings/Preferences > Shelf Editor. For more information, see ■ You can also create custom icons for your Shelf buttons in your favorite image editing program. Icons must be 32X32 pixels and in bitmap format. Lesson 3: Using Variables in MEL Introduction In this lesson, you learn how to store data in MEL variables.
Setting up the scene To import and position the barrel 1 Open the scene named mel_lesson3_Barrel.ma This file can be found in the GettingStarted\MEL directory that you set as your Maya project, in the scenes sub-directory. 2 Open the Script Editor by selecting Window > General Editors > Script Editor. 3 Select the barrel with the select tool. 4 In the Script Editor, type the following: Type exactly as below: rotate -r 0 0 90; The barrel is rotated 90 degrees about the Z axis.
is always prefixed by the “$” symbol, indicating to the scripting language that the following characters name a variable. The scope of the variable determines where the variable can be accessed from. If a variable is declared within a block of code, it cannot be accessed from outside the block of code. Name and type cannot change after creation. The value of a variable can change, but the value must be of the earlier defined type. NOTE Variables in MEL should always have their type explicitly defined.
The string data type is used to store multiple characters. The print command outputs the value of a variable to the Script Editor. NOTE Variables can be declared and assigned a value in the same statement. To declare an int variable 1 Type the following in the Script Editor int $testInt = 5; print ($testInt/2); The following is output to the Script Editor: 2 The int data type is used to store integer values. Integers are positive and negative whole numbers.
2 Duplicate the barrel by typing the following: duplicate; You have a duplicate of the first barrel, and it is the currently selected object. 3 Align the duplicate barrel with the original by moving the duplicate in Z by a value equal to its diameter by typing the following: move -r 0 0 $diameter_barrel; A duplicate of the original barrel is created and aligned to the first barrel.
Using basic trigonometry, you can calculate the unknown height offset. MEL has a library of built-in functions that include trigonometry functions, to handle these calculations. NOTE Trigonometry functions are ratios that relate two sides of a right angled triangle dependant on one of the angles of the triangle. Trigonometry functions are often used for animation, as trigonometric functions are periodic. Periodic functions cycle their output values after a certain period.
convert from degrees to radians when using the sine function to calculate the Y offset. NOTE Radians are a method of measuring sections of a circle. There are 360 degrees in a circle, which is equivalent to 2pi radians. To calculate the offset in Y 1 Declare a new variable to store the value of the Y offset by typing the following: float $Y_offset; 2 Calculate the value of the Y-offset using the sine ratio. You must convert the value of the angle to degrees with the degree to radian conversion function.
duplicate; move -r 0 $Y_offset ($diameter_barrel/2.0); 3 Using the Lasso tool, select the extra barrels. 4 Delete the extra barrels to obtain a pyramid shape. Creating dynamics with MEL commands Maya lets you easily add dynamic properties to the objects in your scenes. All attributes that can be modified by selecting menu items, can be accessed by setting the arguments of a Maya command.
2 Move the stack of barrels upwards along Y (by half the height of a barrel) so they are not intersecting the ground plane. move -r 0 (0.5*$diameter_barrel) 0; 3 Add a gravity field to the selected geometry by entering the following in the Script Editor. performDynamics 1 Gravity 0; When a gravity field is added to the geometry, rigid body nodes are automatically added to the geometry.
To view the simulation 1 Click the play button on the time slider to view the dynamics simulation. Beyond the lesson In this lesson, you were introduced to how to use variables in MEL with Maya. You can: ■ Declare, set and use variables.
■ Perform mathematical operations to modify the value of a variable. ■ Implement dynamics using MEL commands. Before proceeding with the next lesson you may want to review the material presented in this lesson so you are familiar with the concepts and skills associated with them. Some suggested tasks you can try on your own include: ■ Practice creating, modifying and performing operations with variables. In the next lesson, you use variables extensively to create a user interface.
The -resizeToFitChildren flag on the window command specifies that the window automatically resizes to fit all of the elements within the window. This flag must have a value: a value of 1 turns on the flag, a value of 0 turns it off. When you create a window, it is not visible until you use the showWindow command. The showWindow command without any arguments makes the last window created visible. 2 Close the window clicking the X in the upper right hand corner.
Discussion: creating a simple window In your window, you created elements for your user interface, called controls. All user interface controls must be created within a layout. Layouts instruct Maya how to arrange the user interface elements in the window. There are many different types of layouts—for example, formLayout and rowLayout—but the simplest and easiest to use is the columnLayout. The columnLayout lays out your controls in a column, one underneath the other.
Window naming As user interface scripts get more complex, it is possible that you may make a syntax error. If a user interface script partially executes and halts on an error, the window still exists, but the window is not visible. If you fix the problem and would like to execute the script again, you must either give the window a new name, or delete the hidden window. Resolving naming conflicts In the next section, you use conditional statements to resolve window naming conflicts.
The exists flag of the window command changes the command so that it either returns a one or zero depending on whether or not the window exists. 3 Type the following in the Script Editor: deleteUI non_existing_window; sphere; An error is output to the Script Editor. // Error: line 1: Object not found: non_existing_window The sphere command does not execute as the script has halted on the scripting error.
Together, the if statement and the evaluation mean that only if the result of the window existence query is “1” (the window exists) is the window deleted. Otherwise, the section of code within the curly braces is skipped. Storing control names If you refer to a control in your user interface, it must have a name. Instead of manually specifying the name for each user interface element, you can allow the command to generate unique default names and then you can store the name as a variable.
multiple copies of the same user interface could interfere with each other or slow down Maya. NOTE You can view the full name and path of a user interface elements by using the print command to output the variable. print $button_one; The following is output to the Script Editor: pick_me_window|columnLayout2|button1 This is the full path of the user interface control.
makeRoll roll_Cube 0 1 1.0; The makeRoll procedure requires the following arguments: the name of the object to act on, the height of the ground plane, the type of simulation, and the diameter of the object. The type of simulation is either box or sphere simulation. Rolling simulation is determined using a bounding sphere when simulation type is set to 0, or a bounding box when simulation type is set to 1. 3 Set the current frame to two by selecting the current frame box and typing a two.
When Show Line Numbers is on, line numbers appear beside the commands in the Script Editor. The lesson occasionally refers to line numbers to tell you where to make a modification to the script. When line numbers are referred to in the lesson, they are always the line numbers of the original script. 2 Create a new tab in the Script Editor by selecting Command > New Tab. A pop-up window asks you in which language should the commands entered in this tab execute in.
The contents of the MEL file are displayed in the Script Editor. 4 Load the same MEL script into the MEL2 tab by repeating the above procedure. 5 In the MEL tab, highlight the script by selecting Edit > Select All from the Script Editor menu bar. 6 Execute the script by pressing Ctrl+Enter. A user interface is created for the makeRoll procedure. There is a control in the user interface for each argument of the makeRoll procedure.
The window command creates a user interface window to contain the controls. For more information, see Creating a window on page 624. Column layout columnLayout; The columnLayout command creates a layout that arranges the controls within it in a column. For more information, see Referencing controls on page 625. Text field commands $obj_name_text = name_Of_Object`; `textField -editable 0 -width 400 -text The command textField creates an editable text field. The text field command has multiple flags.
■ The fieldMaxValue and fieldMinValue flags set the minimum and maximum values for the field beside the slider. ■ The label flag sets the text that appears to the left of the slider. Separator commands separator -height 20 -width 120; The command separator creates a horizontal line. It is used to space the controls vertically in the window. The separator command has multiple flags. ■ The width flag sets the visible width of the separator.
Linking the user interface Currently the user interface in the window doesn’t do anything: moving the sliders and clicking the check boxes has no effect. In this section you learn how to link the user interface to the makeRoll procedure you used earlier: ■ The textField in the user interface will display the currently selected object. ■ The check boxes in the window will be linked so that only one check box can be selected at once.
To store the names of the currently selected objects as a variable 1 Create a new MEL tab (Command > New Tab in the Script Editor). 2 Rename it tempMEL (Command > Rename Tab in the Script Editor) 3 Type the following in the tempMEL tab: select -allDagObjects; This command selects all scene objects. 4 Type the following in the tempMEL tab: $all_selected_objects =`ls -selection`; This command lists currently-selected objects and outputs their names to a variable.
Elements of an array are accessed using square brackets containing the index number of the element you want to extract from the array. The index number of arrays start counting from zero. 2 Add the following commands to the top of your user interface script in the MEL2 tab: $all_selected_objects=`ls -selection`; $first_selected_object=$all_selected_objects[0]; select $first_selected_object; These commands change your selection to the object you selected first.
You can use the checkBox command with an edit flag to change the state of a check box in the user interface. To change the values of elements in the user interface 1 In the tempMEL tab, change the state of the make roll window’s check box by executing the following: checkBox -edit -value 0 $box_sim_checkbox; The Box Simulation check box, which was turned on, is now turned off. You can repeat this command with a value of 1 to turn the check box back on.
Executing the procedure The makeRoll procedure requires arguments to execute. To link it to the window, you must get the values for the arguments from the controls in the user interface, and execute the makeRoll procedure with these arguments. To get the values of the controls, you must use the query flag. The query flag allows commands to return values of attributes in the scene. To query a value in the user interface 1 Change the value of the diameter slider to 10.
Every argument of the user interface is defined by querying the user interface elements. The backslash at the end of a line allows the command flag argument to span multiple lines. Your user interface is now fully functional! A completed version of the user interface script named Mel_UI_Final.mel is available in the GettingStarted project directory (GettingStarted/mel). Saving the script To use your script in other scenes, you must save it.
NOTE When saving a script, you must have the .mel extension appended to the script file name in the Save Script dialogue box. Using the saved script file You can apply the makeRoll procedure to any geometry quickly by selecting the object to apply makeRoll to, and executing the makeRoll_create_UI global procedure. Before using a script in your scene, you must source it. Sourcing executes all the commands within a script file.
5 Set the frame to greater than one to view the effects of the makeRoll procedure. 6 Set the following values in the makeRoll user interface: ■ Ground Plane = 0 ■ Diameter = 1.0 ■ Box Simulation = checked ■ Sphere Simulation = unchecked 7 Click the “Execute” button to setup the makeRoll expressions. 8 Move the pyramid in X and Z to view the results of the makeRoll procedure. Explore different results that occur when you apply the makeRoll procedure with different user interface control values.
You can create fully customized user interfaces with MEL scripting. There are additional user interface elements not covered in this lesson. For a full list of user interface elements, look in the MEL Command Reference. You can open the MEL command reference by selecting Help > MEL Command Reference from the menu bar. User interface commands are in the Windows category of the MEL Command Reference. Lesson 5: Using Python in Maya Introduction Python scripting in Maya is very similar to MEL scripting.
■ Call MEL scripts from Python Entering Python commands Just like MEL, you can enter Python commands in the Command Line or the Script Editor. The Command Line can only accept single line Python commands, while the Script Editor provides a method to input multiple Python commands and view the results. The Script Editor displays a running history of executed commands and the results of commands that Maya executes.
In the Script Editor, the Enter (Windows) or Return (Mac OS X) key above the Shift key does not execute a command. It starts a new line so you can type several commands before executing them. TIP You can import maya.cmds automatically at startup by creating a file called userSetup.py in your Maya scripts directory. The userSetup.py file can contain any Python commands you want to execute at startup. For more information, see Initializing the Maya Environment in and for Python.
To use a Maya command with positional arguments 1 Move the polygonal cube that you created with the following Python command: cmds.move(1,2,3) The polygonal cube moves to the XYZ co-ordinates 1,2,3. The move command accepts XYZ co-ordinates as its commands arguments. 2 Scale the polygonal cube with the following command: cmds.scale(2,2,2) 3 Re-scale the polygonal cube with the following command: cmds.
When a command is not provided with enough command arguments, the command uses the default arguments. The polygonal cube X scale is set to three, but the Y and Z scale values are set to their default argument one. 4 Delete the selected polygonal cube. cmds.delete() Using flags in Python Flags are used with commands to modify their execution. Python implements flags as named arguments. Some flags in MEL do not require values.
The width flag allows you to set the width of a cube at creation time. 2 Create a polygonal sphere with the radius and subdivisions in X and name defined at creation time. cmds.polySphere(radius=1, subdivisionsX=4, name="testSphere") You can use multiple flags to modify the execution of a command by separating the flag-value pairs with a comma. The radius flag sets the radius of the created sphere. The subdivisionsX flag sets the number of subdivisions in X for the sphere.
4 Move the polygonal cube relative to its current position by typing the following: cmds.move(-1,0,-2,relative=True) The polygonal cube moves relative to its current position. The relative flag must be placed after the command arguments, as in Python, when passing arguments, named arguments must appear after positional arguments. The command arguments must always be the first arguments of the command. 5 Move the polygonal sphere without selecting it by typing the following: cmds.
To use flags with multiple arguments in Python 1 Create a yellow tinted point light by typing the following: cmds.pointLight(rgb=(1,1,0.5)) The point light command creates a point light at the origin. The rgb flag specifies the color of the light. The rgb flag require three values; red, green and blue. When flags require multiple values, the values must be packed within Python’s tuple or list data types.
8 Select all objects in the scene and delete them by typing the following cmds.select(allDagObjects=True) cmds.delete() Using the Maya command select with the allDagObjects flag selects objects that exist physically in the scene such as geometry, IK chains and measure tools. These appear on an internal Maya representation called the DAG. For more information, see DAG.
The axis flag specifies the initial orientation of the torus. Geometry creation commands return the name of the created object, so you can easily refer to the object by storing the name of the object as a variable. NOTE Most creation commands return the name of the created object as a return value. This value can be stored as a variable to refer to the object at a later time. This is especially useful when referring to controls within a user interface. 2 Deselect the torus using a Python command. cmds.
Communicating between Python and MEL MEL and Python in Maya each have built in commands to communicate with each other. MEL and Python communicate by calling commands in the other language and evaluating the results of the last executed command. Python communicates with MEL using the eval() command. Unlike the other Python commands in this lesson, the eval() function does not belong to the Maya commands module (maya.cmds). The eval() function belongs to the maya.mel module.
6 Select a Python tab. 7 Transfer the MEL variable’s value to Python by typing the following: TransferMELvar = maya.mel.eval("$temp=$MyMELVariable") When transferring variables between MEL and Python, the functions return the value of the statement. MEL syntax does not allow you to return the value of a variable by using the variable as a command string. In MEL, when a variable is assigned a value, the value is returned to the Script Editor.
TIP Transferring values between Python and Maya can also be accomplished by using invisible user interface elements. You can edit and query the contents of user interface elements with both scripting languages. Beyond the lesson In this lesson, you learned how to access Maya’s functionality through Python scripting commands. You can: ■ Type basic Python commands in the Script Editor to access Maya Commands. ■ Use named arguments as flags at object creation time to specify the attributes for the objects.
Index { } in expressions % in expressions 3D Paint Tool 581 588 550 A Accuracy 471 active rigid body 498 Add Attribute button 586 Add Attributes 488 for Current Render Type 487 Add Dynamic Attributes 488, 585 Add Influence 328 Add Keys Tool 198 Add Per Particle Attribute 488, 586 age, particles 489 Along Axis 480 Alpha Gain 80 animation curves 192 planning, storyboarding 294 Animation Preferences 188 Annotation creating 279 description 279 anti-aliasing 397, 454 Append to Polygon Tool 108 arms joint chai
Break Tangents Graph Editor 194 Bridge 105 Browse button 554, 560 brush profile 555 brushes 3D Paint, Paint Effects description 518 Kelp 534 Mesh 538 Teapot 539 Thin Line 548 bump, painting 558 555 C camera applications 435 create 435 Camera Attribute Editor 390 camera tools Dolly Tool 44 overview 43 Track Tool 46 Tumble Tool 45 cameras animating 437, 439 Film Gate 439 undoing changes 438 Canvas Clear 509 Set Size 508 Canvas Clear 506 Caustic Photons 471 Caustics Caustic Photons 467 description 458 Emit P
giving object constant color 586 giving particles randomly changing color 586 particles 488 ramp 489 Color 551 color bleeding 454 Color Chooser 69, 392 Combine 105 components description 63 conditional statements if 576 Conserve attribute 485 constraints 494 description 277 orient 282 parent 291 point 280 rigid bodies 494 construction history 120, 140, 165 control object (IK) 276 control vertices (CVs) 138 description 64 converting a UV selection 370 Crease Proxy Edge Tool 130 creasing subdivision surface 1
termination 118 edges border 86 creasing 126 hardening 126 selecting subdivision surface 179 Edit button expressions 571 Edit Deformers > Blend Shape > Add 343 Edit Ramp 493 elbow influence object 327 electronic tablet sculpting surfaces 150 else keyword expressions 580 Emit from Object 478 emitters 476 creating 477 Omni 478 End Bounds 523 End Time 188 equal to (==) operator 589 errors syntax 578 Essential Skills Movies 5 closing the movie window 6 playing 6 exiting Maya 27 Expression Editor 568 expressions
Set Driven Key 205 tangent modification Gravity 498, 524 ground plane 519 group nodes animating 200 Group Under 332 grouping objects description 52 Growth attributes 545 rename operation 416 214 H Harden Edge 128 hardware render 491 Hardware Render Buffer 491 Hardware renderer description 389 Help Find Menu 10 launching 7 Help resources 5 Hide Selection 165 hierarchy about 264 collapse 280, 290 description 52 grouping 52 skeleton 305 viewing in hypergraph 265 Hinge constraint 497 hole creating subdivisi
J jaw joint 309 joint chains 305 Joint Size 306, 321 Joint Tool 306 joints 305 influence on skin moving 311 321 K Keep Aspect Ratio 550 Keep Hard Edge 129 Keep Image 446, 464 keyframes (keys) adding 198 deleting 197 description 186 setting 189 keying into a clip 261 keys delete redundant 198 Key Selected 300 moving 193 setting 298 L Lambert shading material 379–380 layouts changing panel layout 32 four view layout 39 shortcuts 32 Leaf Width Scale attributes 544 Leaves attributes 545 legs joint chains 305
popup help 8 Tutorials 3 using 7 using Help index 7 using Help Line 10 using Search 8 Maya Software renderer description 388 Maya Unlimited 2 Maya Vector renderer description 389 mental ray for Maya renderer 376, 462 description 389 menu sets 20 description 20 Polygons 74 selection 20 Mesh brushes applications 538 attributes 543 description 538 meteors 486 Mirror Across 308 Mirror Geometry 122 modeling description 73 polygons 74 shaded mode 83 symmetry 84 types 73 modules 20 modulus operator (%) 588 morphin
offset 280 Opacity 551 Paint Cluster Weights Tool 336 Sculpt Geometry Tool 149 operators assigning values to 589 equal to 589 less than 577 order of statements 578 orient constraint creating 283 description 282 origin 18 orthographic view 43 Outliner 230, 234, 261 description 140, 164 parenting objects 164 placing clips from 240 Output window 396 P paint brushes blending 512 Paint Effects 3D objects 529, 533 applications 547 Brush Settings window 557 brushes, 3D Paint 555 making surfaces paintable 534 pane
playback animation 299 controls 188 quickening 199 speed 188 Playblast 191, 199 description 223 point constraint description 280 pole surface 148 Pole Vector Constraint 317 Pole Vector XY Z 317 polygon count 132 Polygon Proxy Mode 171 polygonal cylinder creating 31 options 31 polygons component types 74 display settings 76 extruding 100 four-sided quads 81 selection settings 76 smoothing 81, 124 Polygons to Subdiv 170 preferences modeling 76 primitives applications 29–30 creating 21, 80 interactive creation
panel layout 448, 461 raytracing 442 render settings 443 sampling 455 shading surfaces 405 shadows 445 software 376, 388 view region to be rendered 390 rendering particles 493 Replace Paint Cluster Weights Tool 336 Retain component spacing 87 return to start time 188 reusing clips 239 Revolve Tool 137 creating surfaces 139 editing surfaces 140 rewind 188 rgbPP attribute 488 use in expressions 586 ribs joints 311–312 ridges subdivision surface 181 rigid bodies 494 active 498 applications 475 collisions 494 c
shading networks description 383 shading surfaces 405 shadows 445, 462 description 433 Shelf 22 preset brushes 518 saving preset brushes 512 Show Region Marquee 393 Show/Hide Editor 22 Size X, Size Y 550, 559 skeletons 304 creating 268 hierarchy 267 moving group node 317 parenting models 271 posing and animating 315 root 313 skin 319 skin weights 321, 323 modify 324 Smear 557 Smear, 3D Paint 557 Smooth Paint Skin Weights Tool 325 Smooth Bind 321 Smooth Shade All 83, 379 smooth skin 321 influence object 326
Split Polygon Tool summary track description 241 surface material 68 normals 146 pole 148 symmetry 84 syntax, errors 578 171 T Tail Fade 487 Tail Size 487 Tangent Graph Editor 200 handles in Graph Editor 194 target blend shape 338 template brush description 506, 519 modifying settings 507 resizing 507 template display 61, 305 applications 61 description 61 untemplating objects 66 Test Render 491 texture map applications 347 assigning 352 description 347 procedural 380 UVs 349 textures cloth 384–385 intera
Turbulence options 535 Twist 317 Twist attribute 216 Two Panes Stacked 559 U UI Elements 549 undo 37, 532 Update on Stroke 560 Use Depth Map Shadows 430, 434 user interface 15–16 user preferences restoring 12 saving 11 UV Texture Editor applications 357 converting a selection 370 description 357 Dim Image 363 Display Image 365, 370 Display Unfiltered 373 Move and Sew UVs 368 Rotate UVs 371 Toggle Texture Borders 369 viewing UVs 359 UVs Automatic Mapping 362 description 349 image range 359–360 mapping 361 m
670