you first maya

Upload: devsad

Post on 03-Jun-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 You First Maya

    1/24

    Your First Maya AnimationOnce you have an overview of how Maya works, from Chapter 1 of the book, you can putthis knowledge to practical use. In this bonus chapter, youll get to try out modeling, keyframing,

    texturing, and using Mayas built-in dynamics, all in one animation that shows off the power

    of Mayas interface and renderer. Youll also get a chance to practice the basics of maneuver-

    ing around a Maya scene, and youll start to see how adjusting various options can lead to dif-

    ferent results.

    Although we wont deal with theory or do a lot of explaining in this bonus chapter (thats

    what the book is for!), you should get a good idea about many of the major parts of Maya if

    you follow along.

    If you are familiar with other 3D animation packages, going through this tutorial should

    get you ready to use Maya proficiently. If you are new to the whole world of 3D animation,

    the animation here will be challenging yet rewarding. Dont get discouraged if things dont

    turn out perfectly the first time you try. Just remember to save your project often, and under

    different names, and you can always go back a step or two and try again.

    But enough talklets do some animating!

    Setting the scene: modeling

    Texturing your models using the Hypershade

    Lighting the scene

    Animating the rocket

    Creating a follow camera

    Rendering the animation

    Advanced topic: adding exhaust

    B O N U S

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    2/24

  • 8/12/2019 You First Maya

    3/24

    The first step to almost any animation in Maya is to build your scene elements; therefore,

    well build the rocket (and ground) as our first step. To build our little ship, well use just a

    couple of the many modeling techniques Maya has available.

    1. First, we need to create a project and save our file in this project so that it has a home.

    Open Maya by double-clicking its desktop icon. Now, from the File menu, choose File

    Project New. In the New Project option window, click the Use Defaults button, type a

    name for your project (something such as rocketProject ) in the Name text box, and

    click Accept to accept these choices. You now have your project saved in your default

    directory on your hard drive. You also need to save your scene. To do that, choose File

    Save Scene As, and then choose an appropriate name for the file (such as rocket1 ).

    2. After you save your project and file, change your scene window from the default perspec-

    tive view to a four view of the scene by first clicking in the scene (large) window and

    then pressing and releasing the spacebar quickly. (You can also simply LM click the Four

    View Quick Layout button in the Tool Box.) Your scene window should change to four

    smaller panes, each labeled for its view (top, side, front, and perspperspective). Select

    the side view by clicking your mouse inside this pane; then press and release the space-bar quickly again so that the side view fills the entire viewing pane (see Figure BC2).

    To create the body of the rocket, well use an EP (Edit Point) curve tool to define four

    points that make up the rockets outline and then revolve this curve into a surface.

    3. Select the EP Curve tool (choose Create EP Curve Tool); your cursor should turn into a

    cross, indicating that youre now using the EP Curve tool. Because we want the first (top)

    point of the curve to lie directly on the X axis (the thick vertical line at the center of thepane), we need to turn on the Snap To Grids feature before we create the first point on

    the curve. Click the Snap To Grids button on the Status line (the topmost toolbar).

    Figure BC1

    The rocket taking off

    S E T T I N G T H E S C E N E : M O D E L I N G 3

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    4/24

    4. A little below the top of the window, where the Y axis meets one of the other grid lines,

    click once (with your left mouse button) to create your first point. Now turn off the

    Snap To Grids feature (click it again), and create three more points, approximately like

    Figure BC3. If you hold down the mouse button when you click to create a point, you

    can move that point around until you like its positioning; you can also press the back-space key to remove the last point you made. When you are satisfied with the shape of

    the ship, press the Enter key to save the points (the line will turn green).

    5. The next step is to create a surface from our outline. Be sure Modeling is showing on the

    Status line (at the far left top of the screen). If it is not, choose Modeling from the pop-

    up menu there. Now revolve the curve by choosing Surfaces Revolve .

    Selecting the option box with your mouse opens a window in which you can change the

    options of your commandin this case, the Revolve command.

    You can also use a keyboard shortcut to enable grid snapping: hold down the X key on the

    keyboard while clicking, and each point you click will snap to the nearest grid intersection.

    Figure BC2

    The side view pane

    4 B O N U S C H A P T E R : Y O U R F I R S T M A Y A A N I M AT I O N

    Figure BC3

    An outline of therocket ship

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    5/24

    6. In the Revolve option window, choose Edit Reset Settings and then set the segments

    to 16 (instead of the default 8). Click the Revolve button. You should now see your

    curve transformed into a squat rocket ship body! To shade your rocket ship, pressthe 3 key (on the main keyboard, not the numeric key-

    pad) and the 6 keythe 3 key changes your view to high-

    resolution, while the 6 key turns on smooth shading mode

    (instead of wireframe). Figure BC4 shows the revolved

    rocket in high-resolution, smooth shading mode.

    Most option windows close when you click the item-name

    button (in this case, Revolve). To keep the window open (to

    create other objects, for instance), click the Apply button

    instead of the Revolve (or other) button.

    7. Rename your object (shown in the Channel Box, at the

    right of the main window) from revolvedSurface1 to

    something more appropriate, such as body: click once on

    the objects name (revolvedSurface1) at the top of theChannel Box and type your new name, replacing the old

    one. Press Enter and save your work now.

    If you dont see the object name listed (and a Channels menu directly above it), click the

    Show The Channel Box button (above where the Channel Box would be). This should

    change your view to the Channel Box view. If you still dont see the object name, make sure

    your object is selected.

    8. Now we need to build our rocket engine exhaust nozzle. Well create this from a

    revolved curve that well drag up into the rocket, leaving only its broad base visible.

    Well use the same method we learned to create the rocket itself: choose the EP Curvetool (or press the Y key, which will reselect the last used tool), and then click several

    points to form the outline curve (see Figure BC5) that youll revolve into an exhaust

    nozzle shape. To make the size (scale) of the curve easier to see, try creating the

    exhaust nozzle directly below the rocket body.

    9. When you are satisfied with the look of your curve, press the Enter key and, while the

    curve is still selected (green), choose Surfaces Revolve to revolve it into a nozzle. (Note

    that we dont have to use the options this time; this revolve operation will use the same

    If something goes wrong on this or any step in the project, remember that you can always

    press the Z (undo) key to move back one or more steps in your work.

    S E T T I N G T H E S C E N E : M O D E L I N G 5

    Figure BC4

    The revolved rocket

    Figure BC5

    The curve for theexhaust cone

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    6/24

    options you set for the rocket body last time.) Press the 3 key to smooth out the view of

    the engine nozzle; then rename the object (in the Channel Box) from revolvedSurface2

    to nozzle and save your work.

    10. We now need to move the nozzle into the base of the rocket. Choose the nozzle (if its

    not green, click or drag a selection marquee on the nozzlebe sure not to highlight the

    rocket body or the original curve you used to revolve the nozzle); then press the W key

    to enter Move mode. You should see several colored arrows (above the nozzle) around a

    yellow box. Click and drag up on the green arrow until the nozzle is where you want it ,

    as shown in Figure BC6.

    11. Now lets create a cockpit for our ship from a default sphere. Click the sphere (ball) but-

    ton on your tool shelf, or choose Create NURBS Primitives Sphere (remember to

    press the 3 key to display the sphere in hi-res mode). You wont be able to see the sphere,

    because it is currently inside the rocket body, so change to Move mode (press the W key)

    and move the sphere to the right of the rocket body. Now change to Scale mode (press

    the R key) and stretch the sphere up until it is about twice as tall as it is thick. Finally,

    change back to Move mode (press the W key) and move the sphere into position near thefront end of the rocket body (see Figure BC7). Be sure to change the name of the object

    (in the Channel Box) from nurbsSphere1 to cockpit, and save your work.

    12. No 1950s-era space ship would be complete without some fancy fins. Well create one fin

    using a default cone and then adjust its points to make it look more like a fin. Choose

    Create Polygon Primitives Cone , choose Edit Reset Settings, set the Subdivisions

    Along Height option to 5 (instead of 1), and click Create; then name the cone fin1. Set

    Maya to Move mode, and then move the cone out so it is below the cockpit. Now change

    to Rotate mode (press the E key) and rotate the cone so it points away from the side of

    the ship. To do this, grab the outermost (yellow) ring of the Rotate tool and MM drag to

    the right, as illustrated in Figure BC8.

    13. The fin is almost correctly placed, but its currently much too small. Change to Scale mode

    (press the R key), and scale the whole cone out (click the yellow box in the center, and

    then MM drag to the right) until it is the right size. Were getting closer, but now the conehas been scaled out in all directions. To fix this, change to four-view mode (press the

    spacebar quickly), and, in front or top view, click the red (X axis) scale box at the end of

    the scale manipulator and scale the fin so it is thin in that dimension (see Figure BC9).

    14. Now that the cone/fin is thin, return to the side view (click in the side view, and then

    press and release the spacebar). Highlight the fin so it is green; then press the F8 key to

    go into Component mode. Drag a selection marquee around the point at the tip (it will

    turn yellow), press W (Move mode), and then move that point down so it is about as low

    as the exhaust nozzledont worry that it looks very angular right now. Next, draw a

    6 B O N U S C H A P T E R : Y O U R F I R S T M A Y A A N I M AT I O N

    Figure BC6

    Move the nozzleup to the bottom

    edge of the rocket.

    Figure BC7

    Putting the cockpit

    in place

    Figure BC8

    The cone, movedand rotated

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    7/24

    selection marquee around the second row of points in from the tip (be sure to select

    only this row), and move them down some as well. Finally, choose the bottom set of

    points on the next three rows in (toward the body), and move them up a bit. You shouldnow have a curved fin, as in Figure BC10. Save your work.

    15. When you like the shape of the fin, press the F8 key again to return to Object mode.

    Although the fin is nice, it could use some smoothing. Be sure the fin is still selected

    (green), and then choose Polygons Smooth to smooth out the angles between polygon

    facets. At this point, you might want to move the fin in toward the body more so that the

    fin sticks partway into the body.

    We have one fin; now we need to make two more. Rather than model these new fins, lets

    make Maya do the work. First, we need to move the pivot point of the fin (the point around

    which it rotates) to 0 on the X and Z axes, and then well just tell Maya to make two dupli-

    cates and rotate them.

    16. Click the fin to highlight it and make sure you are in Move mode (click the Move tool in

    the Tool Box or press W on your keyboard). Now, press the Insert key on your key-

    board. The arrows of the manipulator handles will disappear, and you will see the pivot

    point in the center yellow box. Click the blue handle (it may be difficult to see), and

    drag it to the center line. To more accurately center the pivot point, hold down the

    X key while dragging, forcing the pivot point to snap to the grid.

    When the pivot point has been moved, press the Insert key again

    to return to normal Move mode. You may find it easier to move the

    cones pivot point if you shift to wireframe display mode momen-

    tarily. To do so, just press the 4 key on your keyboard (not on the

    numeric keypad).

    17. Now choose Edit Duplicate . In the option window, set Rotate Y

    (the middle box) to 120 (120 degrees, or one-third of a circle), set

    Number Of Copies to 2, and click Duplicate. You will now have

    three fins spaced evenly around the body of the shipMaya even

    names the other fins fin2 and fin3 for you!18. As a last step, we need to make some ground for our rocket to take

    off from. Choose Create NURBS Primitives Plane , choose

    Edit Reset Settings, and then set the Width and Length to 100

    (so the ground is very big). Click Create, and then rename the

    plane ground. Youll notice that the plane is right in the middle of

    the rocket. Using the Move tool, move the plane down until it is a

    significant distance below the ship (as in Figure BC11)dont let

    the rocket body, fins, or nozzle touch the plane, or you will have big

    problems later in this tutorial!

    S E T T I N G T H E S C E N E : M O D E L I N G 7

    Figure BC9

    The cone, scaled

    Figure BC10

    A curved fin inComponent mode

    Figure BC11

    Moving the groundunderneath the rocket

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    8/24

    M AYA S H O RT C U T K E Y S

    The QWERTY keys (across the top left of your keyboard) are shortcut keys. Memorize these

    keys nowusing shortcut keys is one secret to getting work done in Maya quickly! (If you

    tend to share your computer, such as in a school lab environment, the default Maya Hotkeys

    may have been altered. To restore them to their defaults, choose Window Settings/Prefer-

    ences Hotkeys and press the Restore Defaults button.) The function for the QWERTY keys is

    as follows:

    Q Places Maya into Select mode (in which you can only select, not modify, scene ele-

    ments). (Ctrl+Q places Maya into Lasso Select mode (also for selection only).

    W Places Maya in Move mode.

    E Places Maya in Rotate mode.

    R Places Maya in Scale mode (not Rotate mode!).

    T Places Maya in Manipulator mode. (We wont deal with this tool in this bonus

    chapter.)Y Places Maya in whatever modebesides Move, Scale, and Rotatewas last chosen

    (the EP Curve tool, in our work).

    You can also adjust the display of objects in the scene using the 17 keys on your alpha

    keyboard (not the numeric keypad).

    1 Changes the display of any selected object into low-resolution display (which

    increases interactivity with the program, but the objects look blocky).

    2 Changes the display of any selected object into medium-resolution display.

    3 Changes the display of any selected object into high-resolution display (which looks

    much better, but can slow response).

    4 Changes the display of all objects in the scene (not just selected objects) to wireframe

    display (faster interactivity and the ability to see through objects).

    5Changes the display of all objects in the scene to smooth-shaded display (basic color-

    ing is visible).

    6 Changes the display of all objects in the scene to texture-shaded display (the basic

    look of a texture is visible on objects).

    7 Changes the display of all objects in the scene to textured-shaded and lit display (so

    the basic effect of lights can be seen).

    8 B O N U S C H A P T E R : Y O U R F I R S T M A Y A A N I M AT I O N

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    9/24

    19. Now that we have all our pieces, we need to get rid of the construction history for each

    of them and then erase the curves that generated them (otherwise well have problems

    later in the animation process). First, select everything in the scene (or RM choose

    Select All in the scene window); then choose Edit Delete By Type History. Now find

    the curves you used to build the body and nozzle of the rocket. (You can choose any

    component of the rocket and then use the Right and Left arrow keys to scroll throughall the componentsor you can use the Outliner or Hypergraph to find the curves.)

    When you each curve is selected, press the Backspace or Delete key to delete them all.

    As a last step, we need to make all our rocket components into one object (well call it

    rocket) and move the pivot point of our rocket down to the ground plane (the reason for this

    will be apparent as we animate the ship).

    20. Drag a selection marquee around the ship and all its components (be sure not to include

    the ground, though!); then hold down the Ctrl key and press G. This creates a new group

    (called group1) that contains all the pieces of the rocket we have modeled. Rename this

    group to rocket. If you accidentally highlight the ground plane with the rocket compo-

    nents, hold down the Shift key and click anywhere on the plane to deselect it.

    21. Be sure the rocket group is still selected (check to see that its name is

    showing in the Channel Box); then press the Insert key. Move the pivot

    point down (using the green handle) until it is below the bottom of the

    nozzle (see Figure BC12). Moving the pivot point will be important when

    we animate the scale of the ship (otherwise, the ship will scale around its

    middle, instead of its bottom). Be sure to press the Insert key again after

    you move the pivot point. Save your work.

    22. Lets take a look at our handiwork. Change to perspective view in the

    scene panel (remember the spacebar trick), change to Shaded mode

    (press the 6 key), and then rotate around your ship by holding down the

    Alt key and the left mouse (LM) button and dragging around the scene

    window. Your rocket should look like that in Figure BC13.

    In the future, if you click any component of the rocket (the body, say) and press the Up arrow

    key, Maya automatically chooses the rocket group for you. This technique is known as pick walking.

    To alter the size of the plane, you can either scale it using the Scale tool or click the mak-

    eNurbsPlane text in the Channel Box and change the width setting.

    S E T T I N G T H E S C E N E : M O D E L I N G 9

    Figure BC12

    Moving the rocketpivot point down

    Figure BC13

    Perspective viewof the rocket

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    10/24

    If your results are different from those you see in the book, you might want to return to

    the area that is different and rework it until you are satisfied with the results.

    Save your work and take a breakgood job so far!

    Texturing Your Models Using the HypershadeYou might find the model youve created so far a bit well gray. Lets remedy that situa-

    tion now by adding materials to the model elements, giving them a bit more color and inter-

    est. Materials in Maya are the general container for a shading network, which gives an object

    its color, transparency, reflectivity, and so forth. Normally, you create a material and then

    edit the materials settings or add textures (images or procedural textures) to get the look

    you want. Think of materials in Maya as your own virtual paint can.

    To create these materials, well use the Hypershade. Follow these steps:

    1. Select the cockpit and then choose Window Rendering Editors Hypershade to open

    the Hypershade window.

    2. To the left of the Hypershade is the Create Bar panel. (If you dont see it, click the

    checker icon in the upper-left corner of the screen, or choose Options Create BarShow Create Bar.) To create a new material, click the button at the top of the panel and

    choose Create Materials. Simply click the Phong material, and a new material will appear

    in the window on the right called the Hypershade panel.

    Name the new material cockpitPhong by holding down

    the Ctrl key, double-clicking the default name (Phong1),

    and then typing the new name, as in Figure BC14.

    3. To assign this new material to the cockpit, just MM

    drag the material ball onto the cockpit in the scene

    window. Because the Phong material is still gray,

    you wont see much difference yet.

    4. To adjust the color of the new material, double-click

    it in the Hypershade. This opens the Attribute Edi-

    tor (shown in Figure BC15) with several options youcan control for color and other attributes.

    5. All were interested in for the cockpit is its color.

    Click the gray rectangle next to the word color , and,

    in the color picker that pops up, choose a very dark

    blue (almost black) color. You can watch the cock-

    pit itself change as you adjust the color. When you

    get a color you like, click the Accept button.

    10 B O N U S C H A P T E R : Y O U R F I R S T M A Y A A N I M AT I O N

    Figure BC14

    Creating a new materialfor the cockpit

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    11/24

    6. Lets make another Phong material for the body of the rocket. Once again, click the

    Phong icon in the Create Bar panel on the left side of the Hypershade window, and then

    rename this new material bodyPhong. Now MM drag the material ball onto the body of the rocket.

    7. In the Attribute Editor, adjust the color of the new material to a very pale blue-gray (the

    color of brushed aluminum). To make this work right, youll need to set the saturation of

    your color very low (we set it to 0.075).

    8. When you accept the color, youll probably notice that the specular highlights (the shiny

    areas) on the rocket body are big and ugly. Fortunately, we can compensate for this. Inthe Specular Shading area of the Attribute Editor, set the Cosine Power (the size of the

    highlight) to a large number, such as 75, and set the Specular color to a darker gray

    (drag the slider to the left). When you finish, you should have a more pleasing highlight.

    9. To create the ground shade (we dont want a specular highlight on the ground!), lets use

    the Lambert shader, which does not create highlights. Create a new Lambert material by

    clicking the Lambert icon in the Create Bar panel and renaming it groundLambert. Then

    MM drag the new material onto the ground plane,assigning it to the plane. (You may need to go into

    perspective view to see the ground plane.)

    10. In the Attribute Editor, set the color of the ground

    plane to a dusty orange-yellow (a desert dirt color).

    11. The last two materials well make will be a bit more

    interesting. First, lets create a material with a proce-dural texture for the nozzle. Create a new Phong

    shader, name it nozzlePhong, and assign it to the

    nozzle.

    12. Instead of assigning a color to the new material, click

    the little checkerboard next to it (to the right of the

    slider) to open the Create Render Node window. Click

    the Checker button to apply a checkered pattern to

    your material, as shown in Figure BC16.

    13. Although this texture as it currently is might be all

    right for playing checkers, its not what were after. In

    the Attribute Editor, make both of the colors in the

    checker pattern a shade of gray (drag the sliders next

    to the color swatches). Finally, decrease the Contrast

    setting to about 0.7. These changes will make the pat-

    tern much subtler.

    T E X T U R I N G Y O U R M O D E L S U S I N G T H E H Y P E R S H A D E 11

    Figure BC15

    Attributes for thePhong shader

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    12/24

    14. Now click the place2Dtexture1 tab (at the top of the Attribute Editor) and set the

    Repeat UV to 16 and 0.5, respectively. This will give the nozzle the ringed appearance

    (seen in Figure BC17) common to rocket nozzles.

    15. Finally, lets create the fin material, using a ramp to get our

    effect. First, create a new Phong material (called finPhong),

    and assign it to all three finsyou will probably have to

    rotate the scene panel in order to see all three fins so you

    can do this.

    16. In the Attribute Editor, click the checkered box next to

    Color again to open the Create Render Node window.

    Choose Ramp from the list of 2D textures. You should see a

    Ramp Attributes window with a default ramp, and all the

    fins should have the colors applied to them.

    17. Although the smooth transitions of the default ramp are

    nice, theyre not what we need for our fins. From the Inter-

    polation pop-up menu, choose None. This turns off thesmooth interpolation of the colors, making the ramp a series

    of color bars.

    18. To change the ramp colors, select the ramp node (the circle to the left of the color bar)

    and then click the Selected Color swatch to open the color picker. To create a new color

    node, just click in the color swatch where you want that new node. To move a color up

    or down, drag the circle on the left of the color bar. Finally, to remove a color, click the

    box to the right of the color bar. You can use whatever colors you like for the ramp, but

    when you are finished, you should have something like Figure BC18, which is also on the

    CD in a color version.

    Figure BC17

    A ringed nozzle

    12 B O N U S C H A P T E R : Y O U R F I R S T M A Y A A N I M AT I O N

    Figure BC16

    Giving the object acheckered material

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    13/24

    We now have a fully textured ship and ground plane. Although none of

    these materials is terribly complex, they give the ship some color and add to

    the cartoonish feel of the world were creating. To be able to see our shipwhen we render it, well next need to add some lights to the scene.

    Lighting the SceneTo light this scene, well add four lights: one ambient light to shade the whole

    scene and three spotlights. This lighting setup will give the scene a night-time

    quality, which is a bit more fun than one big light for the sun. Additionally,

    well make two of the lights track (or aim toward) the ship at all times. Fol-

    low these steps:

    1. First, lets create our ambient light. Choose Create Lights Ambient

    Light . In the option window, set the intensity to 0.2, click the color

    swatch and set the color to a pale blue, and then click Create.

    2. To see how the scene is lit so far, press the 7 key on your keyboard to go into Lighted mode

    (the scene should be almost dark). Press the 5 key to return to Smooth-Shaded mode.3. Now lets create our spotlights. Choose Create Lights Spot Light . In the option

    window, choose Edit Reset Settings, and then set the penumbra angle to 10 (this fades

    the edge of the spotlight); then click Create. Rename this light frontSpot (if the Channel

    Box isnt open, click the Show The Channel Box button at the far right of the Status line

    to toggle it back on). Press the W key to get into Move mode, and then move the light up

    and away from the ship, toward the camera. Be sure the light is above the rocket by a

    significant amount; otherwise, it wont light the ground below the ship (which gives

    depth and solidity to the scene).

    4. Because we want this spotlight to aim at the ship at all times, lets add an Aim constraint

    to it. First, click any part of the ship; then press the Up arrow key (be sure the Channel

    Box says rocket in its title area). Then, holding down the Shift key, click (or drag around)

    the light, highlighting it as well. Finally, from the Animation menu set (choose Animation

    from the top-left pop-up menu), choose Constrain Aim . Choose Edit Reset Settings,

    and then change the three aim vector text boxes to read 0, 0, and 1. Click the Apply

    button and verify that the spotlight is pointing toward the rocket (the cone should opentoward the rocket body). If the spotlight is looking in another direction, try the follow-

    ing settings until one works: 0,0,1; 1,0,0; or 1,0,0. (The aim vector of a spotlightlike

    To move your lights, you will need to use the top and side views (press the spacebar to see

    these views) and scale these views out by holding down the Alt key, along with the left and

    middle mouse buttons, and dragging to the left in each window pane.

    L I G H T I N G T H E S C E N E 13

    Figure BC18

    The finished ramp

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    14/24

  • 8/12/2019 You First Maya

    15/24

  • 8/12/2019 You First Maya

    16/24

    anticipation and overshootyoull recognize the effect from any old Tex Avery cartoons

    you run across. Follow these steps:

    1. To create our first keyframe, first be sure youre on the first frame of the animation (usethe VCR-like controls at the bottom-right of the screen to rewind, and check to see that

    the Timeline marker is at 1).

    2. Next, select the rocket (be sure its the whole rocket group, and not just the body);

    then, in the Channel Box, drag your mouse over the text of the three scale channels

    (scales X, Y, and Z), highlighting them. Then, with the mouse over the selected chan-

    nels, use the right mouse button to choose (RM choose) Key Selected from the pop-up

    menu (see Figure BC22). The channels for scale should turn orange (green on Irix),

    indicating that theyre now keyframed.

    3. After you create your first keyframe manually, Maya can automatically keyframe your

    channels. Check to be sure the auto-keyframe option is on by verifying that the Auto

    Keyframe Toggle icon at the bottom-right of the screen (below the VCR-like time con-

    trols) is red. If its not, simply click it to turn it red.

    4. By default, our animation runs for 24 frames, or one second. (Maya defaults to 24 frames

    per secondfilm speed.) So we need to lengthen our animation. In the number field for

    the end time (to the right of the Range Slider), set the frame range to 100 framesa bit

    over four seconds.

    5. Move the time marker (the gray bar in the Time Slider) out to 48 frames (2 seconds) by

    dragging it across the Time Slideror just click about where the 48th frame would be.

    Be sure your rocket is still selected, and then enter Scale mode (press the R key) andscale down the Y (green) axis so that the rocket becomes shorter (a scale of about 0.7

    on the Y axis channel should do). You may notice that this simply shrinks the rocket; we

    also need to scale out the X and Z axes to make the rocket appear to maintain a consis-

    tent volume as it squashes. Although we could do this via the X and Z scale handles, it is

    easier to do so in the Channel Box itself. Click in the scale X text box, and then enter a

    value of 1.4. Do the same in the scale Z box. Your rocket should now look squashed, as

    in Figure BC23, rather than simply shrunk.6. We now need to hold this squashed look for some frames (a hold keyframe ). Move the

    time marker to frame 60, select the scale X, Y, and Z channels again, and RM choose Key

    Selected. (Alternatively, you could reenter the numbers you had before, forcing Maya to

    create a new keyframe via the auto-keyframe option.)

    7. At this point, its a good idea to play back your animation to see how it looks so far. Click

    the Rewind button on the VCR-like controls (or press Alt+Shift+V); then click the Play

    button (or press Alt+V) to play the animation. The rocket should squash down and then

    hold its appearanceand then the animation loops and repeats itself.

    16 B O N U S C H A P T E R : Y O U R F I R S T M A Y A A N I M AT I O N

    Figure BC22Choose Key Selected

    from the pop-up menu.

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    17/24

    8. Now lets make the rocket stretch out, as if stretching to take off from the ground (dont

    worry for now that its not moving up). Move to frame 70 and set the X, Y, and Z scales

    to 0.7, 1.4, and 0.7, respectively. (The rocketshould look stretched out now.)

    9. We need another hold keyframe (with the

    rocket stretched out), so move to frame 78,

    choose the scale channels, and RM choose Key

    Selected once again.

    10. Now move to frame 90 (close to four seconds),

    and reset all the scale channels to 1the ship

    will now return to its original shape at 90

    frames. When you play back the animation, you

    should see the rocket squash, preparing for

    takeoff, then stretch up (as it takes offdont

    worry, well take care of that next!), and finally

    return to its original shape. If you dont likehow the animation runs, you can Shift+click

    any keyframe in the Timeline (highlighting it in

    red), and then drag that keyframe left or right

    on the Timeline, thereby adjusting the speed of

    the animation between each keyframe.

    Using Dynamics for AnimationWeve completed the keyframing for this animation project. Now lets make Maya do the rest

    of the work. Well make the ship rise into the air by giving it a force (or impulse) and then

    drag it back down using gravity. Finally, well make the ground and rocket collide. To do all

    this, well use what is known as rigid body dynamics to tell Maya what forces act on our

    object (the rocket). As explained in Chapter 13 of the book, Rigid Body Animation, Maya

    (specifically, its dynamics engine ) will use our input to do all the calculations necessary for

    realistic movement. Follow these steps:

    1. First, we need to make both the rocket and ground rigid bodies, so theyll react to each

    other and forces we apply to them. Select the ground plane, and then change to the

    Dynamics menu set (from the pop-up menu at the top left of your screen). Choose

    Soft/Rigid Bodies Create Passive Rigid Body . (Be sure not to select Active!) In the

    option window, set the Static and Dynamic Friction to 0.5, and set the Bounciness to

    0.2. Click Create to create the rigid body.

    A N I M A T I N G T H E S C E N E 17

    Figure BC23

    Squash your rocket ship.

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    18/24

    2. Now lets make the rocket a rigid body. Select any of the rockets body parts and press

    the Up arrow key (be sure rocket is the name selected in the Channel Box). Choose

    Soft/Rigid Bodies Create Passive Rigid Body . In the Rigid Options window, as in Fig-ure BC24, set the rockets mass to 1000, set the Impulse Y to 5000, and set the Impulse

    Position Y to 12 (this forces the impulse to be above the rockets body, so it wont spin

    around when you launch the rocket). Click Create.

    3. With the rocket still selected, choose Fields Gravity . In the option window, set the

    magnitude of gravity to 25 (this setting is far heavier than Earths gravity, but it makes

    the animation look better!), check to be sure the Y direction of gravity is set to 1 and

    that X and Z are 0, and then click Create. Because the rocket was selected when you

    created the gravity field, it will be attached to gravity (that is, affected by it).

    4. If you play back the animation now, you will see that it looks just the same as before.

    Thats because our rocket is still a passive rigid body (meaning that nothing can affect

    it). What we have to do is keyframe the rocket to be an active rigid body just at the

    frame where it should take off. Select the rocket, and then move to frame 62. Under the

    Shapes/RigidBody2 node (in the Channel Box), you should see a channel called Active

    (toward the bottom) that is set to off. Click once on the text (the word Active), and

    then RM choose Key Selected to set a keyframe. Now move to frame 63, click in the Off text box, and type the word on . This will set a keyframe, setting

    the active state of the rockets rigid body to on, so it can now be

    affected by forces.

    5. Before you play back the animation, youll want it to run

    longer. Set the playback length to 1000 instead of 100. (Type1000 in the Playback End Time box, just to the right of the

    Range Slider.) The frame range should now go from 1 to

    1000. Rewind and play back the animation (which is

    extremely important; otherwise Maya will become confused

    about its calculations and you will see some very strange

    results). You should now see the rocket zoom off into parts

    unknown. If the rocket gets stuck in the ground, youve got a

    rigid body interpenetration error , a problem youll learn

    more about in Chapter 13. To fix it, move the ground down a

    bit and run the animation again. (Dont forget to rewind!)

    If you get an error message when you try to create the rockets rigid body, check (using the

    Hypergraph or the Outliner) to be sure you have erased the two curves for the nozzle and

    body of the rocket. If you havent, do sothis should take care of any error messages.

    18 B O N U S C H A P T E R : Y O U R F I R S T M A Y A A N I M AT I O N

    Figure BC24

    The Rigid Optionswindow

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

  • 8/12/2019 You First Maya

    19/24

    20 Y F M A

  • 8/12/2019 You First Maya

    20/24

    viewing pane (press the spacebar), and then play back the animation. You should see

    the camera follow the rocket up into the air and then back down again.

    4. Save your work.

    Rendering the Animation Although watching the animation play in your scene window is great, its probably a bit

    bumpy (especially if you have a slower machine). You can render a cleaner view of your ani-

    mation in two ways: playblasting and final rendering (batch rendering). Although a final ren-

    dering gives high-quality results, it takes a great deal of time to produce these results.

    Playblasting, on the other hand, produces a rougher (smooth-shaded) look, but goes as fast

    as your video card can spit out images. Thus, for a quick look at the animation, playblasting is

    a far better choice than a final rendering.

    Playblasting the animation is one step: choose Window Playblast and watch as Maya cre-

    ates an animation for you, using the basic shading mode of your computer. Once the anima-

    tion is complete, you can view it in its own little movie window, as in Figure BC25. Youll

    learn more about playblasting in Chapter 8 of the book, Basic Animation.

    Rendering the final product is a bit more complex and takes much longer. Essentially, a

    final (batch) rendering creates a high-quality snapshot of each frame of the animation,

    using all the lighting, material, and animation information your scene can provide. Theresults of a final rendering can be excellent, but it is a fairly slow process, because your com-

    puter has to do many calculations for every pixel of every image. Thus, you will only want to

    proceed with these steps when youre sure youre happy with your animation.

    1. Choose Window Rendering Editors Render Globals or click the Render Globals but-

    ton in the Status line to open the Render Globals option window. In the Image File Out-

    put section, type a name (such as rocketRender ) in the File Name Prefix File box. Set

    the Frame/Animation Extension to name.#.ext, set the end frame to about 700 (you

    want to be sure its a large enough number that the rocket has come to rest first), set

    the Frame Padding to 4 (this adds zeros before your frame number, so the frame will be

    numbered render.0001, render.0002, and so forth, instead of render.1, render.2, and so

    on), and set the active Camera to followCamera (otherwise Maya will use the default

    persp camera, and you will waste your rendering time).

    2. Twirl down the Resolution arrow, and set the Render Resolution to 320 240.

    If the camera is too close to the action or too far away, just zoom your view (Alt+LM and RM

    buttons and drag) to get a better view.

    20 B O N U S C H A P T E R : Y O U R F I R S T M A Y A A N I M AT I O N

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

    A D V A N CE D T O P I C : A D DI N G E X H A U ST 21

  • 8/12/2019 You First Maya

    21/24

    3. Twirl down the Anti-aliasing Quality arrow, and set the Presets field to Intermediate

    Quality (this makes for a fairly fast render time, but with decent quality).

    4. After you change your settings, close the Render Globals window, and open the Render-ing menu set (the top-left pop-up menu). Choose Render Batch Render.

    5. Maya will render out all 700 frames of the animation (which will take some time). You

    can view the progress of each frame in the Feedback line (at the bottom-right of the

    screen), or, to view the current frame that is rendering, choose Render Show Batch

    Render. To cancel the render at any time, choose Render Cancel Batch Render.

    6. When the rendering job is finished, you can view it using the FCheck utility. In Irix,type fcheck in a shell window; in Windows, choose Run (from the Start menu), and typefcheck in the text field or select fcheck from the Maya folder by browsing the Programs

    folder in the Start menu. A window will open, letting you navigate to your images folder

    (it should find this for you automatically). Choose the first frame of your animation and

    click OK. FCheck cycles all frames into memory and then plays back the animation at

    full speed.

    Congratulations! You have modeled, textured, lit, animated, and rendered an animation in

    Maya. If patting yourself on the back isnt your style, you can move on to the next section,

    where you will learn how to create a particle exhaust trail for the rocket. If this was enough

    practice for a start, you can re-enter the book at Chapter 2 and save particles until the end of

    your study.

    Advanced Topic: Adding ExhaustIf youve worked extensively with other animation packages, what weve done so far may seem

    fairly straightforward. In that case, youre probably ready to explore another area of Maya

    dynamics, namely particles. Well use a particle emitter to create a

    shower of particles and then texture them to look like smoke and flames.

    To make it appear that the exhaust is powering the rocket, well turn

    the emitter on and off (via keyframes) at the appropriate moments.

    1. First, we need to create our emitter. In the Dynamics menuset (top-left pop-up menu), choose Particles Create Emitter .

    In the option window, name the emitter exhaustEmitter, set the

    emitter type to Directional, set Rate to 0, and, under the Distance/

    Direction section, set Spread to 0.3 and DirectionY to 1 (so the

    emitter points downward). Twirl down the Basic Emission Speed

    Attributes arrow and set the Speed to 60. Finally, click Create.

    You now have a particle emitter, which needs to be attached tothe nozzle of the rocket.

    A D V A N CE D T O P I C : A D DI N G E X H A U ST 21

    Figure BC25

    The playblasted anima-tion in its own window

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

    22 B O N U S C H A P T E R : Y O U R F I R S T M A Y A A N I M AT I O N

  • 8/12/2019 You First Maya

    22/24

    2. To attach the emitter to the nozzle, first move the emitter (which should still be

    selected) down into the base of the nozzle. With the emitter still selected, Shift-select

    the nozzle and press the P key, making the nozzle the parent of the emitter (so that theemitter will travel along with the rocket as it moves).

    3. If you play back the animation right now, the particle emitter will shoot out no particles,

    because its rate is set to 0 particles per second. Just before the rocket takes off (frame

    63), we need to turn on the engineour particles. Go to frame 59, select the Rate

    channel for the emitter, and RM choose Key Selected to set a keyframe at 0 for this

    frame.

    4. Now go to frame 60 and set a rate of 500 so there are suddenly many particles shooting

    out from the ship. If you play back the animation now, a shower of particles (points by

    default; well fix that in a moment) will shoot out from the exhaust nozzle, as shown in

    Figure BC26.

    5. Now we need to turn off our rocket. Go to frame 104 and set a keyframe for the Rate at

    200 (select the Rate text, and type 200 ). Now, at frame 105 (where the impulse turns off

    as well), set a new keyframe for Rate at 0. When you now play back the animation, theparticles will stop coming out of the rocket at frame 105however, the particles hang

    around forever (they never die). We need to give our particles a life span so they will die

    off like good flames should.

    6. With the emitter still selected, press Ctrl+A to open the Attribute Editor. Once in the

    Attribute Editor, click the particleShape1 tab at the top; then, in the Lifespan Attributes

    section, choose Random Range for the Lifespan Mode. Leave the Lifespan at 1 (second),

    but change the Lifespan Random to about 0.3. Setting these two attributes this way

    makes each particle live 1 second, plus or minus 0.3 seconds (or in a range from 0.7 to

    1.3 seconds). When you now play back the animation, you should see the particles die

    out approximately a second after they are created (thus the trail of particles follows the

    rocket up as it takes off). Save your work.

    7. Now that we have a good trail of particles to work with, lets change the rendering type

    from points to something more interesting. In the Attribute Editor (with the particle-

    Shape1 node still selected), under the Render Attributes section, set the Render Type

    to Cloud (s/wfor software rendered). Next, click the Current Render Type button to

    add the attributes that belong with the cloud render type.

    For more on controlling how particles live and die, see Chapters 14, 15, and 16.

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

    S U M M A R Y 23

  • 8/12/2019 You First Maya

    23/24

    8. In the new fields, make the radius 1.5, the Surface Shading 1, and the Threshold 0.5.

    When you play back the animation (which will now run significantly slower), you should

    see that the exhaust particles are now spheres. To see what they would look likein a real rendering, click the Render The Current Frame button in the Status line

    or choose Render Render Current Frame (from the Rendering menu set).

    9. Now were closing in on a good exhaust cloud. The last piece of the puzzle is to cre-

    ate a texture for the particles. Play the animation to a frame where the particles

    are showing; then open the Hypershade (choose Window Rendering Editors

    Hypershade). To create a cloud texture, we need to create a volumetric texture.

    To do so, click the arrow next to Volumetric in the Create Bar panel to open the

    volume materials. Click the particleCloud material (the light blue ball), which will

    then appear in the right-hand window of the Hypershade (Figure BC27), and then

    rename the material exhaustVM.

    10. Select the exhaust particles, right-click the material (in the Hypershade), and RM

    choose Assign Material To Selection. Move over to the Attribute Editor, and set the

    color of the material to a bright yellow. Set the Transparency to a light gray (by movingthe slider to the right), and set the Glow Intensity to 0.5. Test render your current

    framethe exhaust should now glow a bright yellow as it is emitted from the nozzle. If

    youre not satisfied with the look of the exhaust, try adjusting some of the material set-

    tings or the render attributes of the particleShape1 node. Save your work again.

    When you are satisfied with the look of your exhaust, you can

    render out the entire animation sequence (see the Rendering

    the Animation section earlier) to see how things look with yourexhaust plume. To compare your work with ours, you can take a

    look at rocket.mov also provided on this companion CD.

    SummaryCongratulations! You have completed a real-world animation

    project your first time out. If your work does not look the way

    you would like it, thats all right: it can take quite a while to get

    an animation package producing just what you had in mind. No

    matter how you did, you can always return to this project as you

    continue through this book.

    You may find that after reading a few chapters of Maya 5

    Savvy , youd like to give this project another try. In that case,

    use this bonus chapter as a reference, not a guide. In other

    Figure BC26

    Particles being emittedfrom the nozzle

    Figure BC27

    A new particle cloudshader

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com

    24 B O N U S C H A P T E R : Y O U R F I R S T M A Y A A N I M AT I O N

  • 8/12/2019 You First Maya

    24/24

    words, try to do the work by yourself, and read the directions here only when you get stuck.

    In this way, youll make the project your own, and youll learn even more from it.

    Whether you tried this rocket animation with years of digital 3D experience under yourbelt or it was your first foray into the wonderful world of 3D, you should be able to see how

    powerful the Maya environment can be.

    Copyright 2004 SYBEX Inc., 1151 Marina Village Parkway, Alameda, CA 94501. www.sybex.com