Mastering Autodesk Maya 2011 phần 4 potx

105 283 0
Mastering Autodesk Maya 2011 phần 4 potx

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

286 | CHAPTER 5 anIMatIon teChnIques 7. Move the bodyCtrl curve back and forth on the z-axis, and you’ll see that the front left leg now walks with the bug. 8. Save the scene as mechBugWalk_v03.ma. To see a version of the scene to this point, open the mechBugWalk_v03.ma scene from the chapter5\scenes directory on the DVD. Copying and Pasting Driven Keys The trick at this point is to create the same driven key arrangement for the other five legs in the easiest way possible. You can achieve this using Copy and Paste. The important thing to remem- ber is that to paste driven keys from a channel on one object to another, you should have one driven key already created for the target objects. 1. Continue with the scene from the previous section, or open the mechBug_v03.ma scene from the chapter5\scenes directory on the DVD. 2. From the Animation menu set, choose Animate  Set Driven Key  Set to open the Set Driven Key window. 3. Select the bodyCtrl curve, and load it as the driver. 4. Select all the leg control curves except the frontLeftLegCtrl. 5. Click the Load Driven button. 6. Make sure the Translate Z channel of the bodyCtrl curve is at 0. Set the Translate Z of the five leg control curves to -1. 7. Select the Translate Z channel in the upper right of the Set Driven Key window. In the lower left, make sure all the leg control curves are selected. 8. Select the Translate Y and Translate Z channels in the lower right (see Figure 5.49). Figure 5.48 The Pre- and Post- Infinity values of the Translate Z channel are set to Cycle With Offset so it continually steps as the bug is moved back and forth. drIVen keys | 287 9. Click the Key button to create an initial key for the five legs. You can close the Set Driven Key window. 10. Make sure the bodyCtrl curve’s Translate Z channel is at 0. Select the frontLeftFootCtrl curve. In the Channel Box, highlight the Translate Y and Translate Z channels. Right- click, and choose Copy Selected. 11. Deselect frontLeftFootCtrl curve. Shift+click the five other leg control curves. 12. Highlight the Translate Y and Translate Z channels, right-click, and choose Paste Selected. When you move the bodyCtrl curve back and forth, the other legs take one step. You need to loop the driven keys of the other legs in the Graph Editor. 13. Select the leg control circles for the five remaining legs, and open the Graph Editor. 14. Ctrl+click the Translate Y channels of all the leg controls in the left column of the editor. 15. Drag a selection over the keys on the graph, and choose Curves  Pre Infinity  Cycle and then Curves  Post Infinity  Cycle. 16. Ctrl+click the Translate Z channel for each of the leg controls in the Graph Editor. 17. Drag a selection around the keys on the graph, and choose Curves  Pre Infinity  Cycle With Offset and then Curves  Post Infinity  Cycle With Offset. 18. Drag the bodyCtrl curve back and forth on the Graph Editor. All the legs take a step; however, they all do so at the same time, which looks a little silly. 19. To create a more convincing walk cycle for the bug, select each leg control, and open the Graph Editor. 20. Select the keys on the graph and use the Move tool to slide them a little backward or for- ward in time so each leg has its own timing. See Figure 5.50. Figure 5.49 Set an initial driven key on the Translate Y and Translate Z chan- nels of the five remaining legs. 288 | CHAPTER 5 anIMatIon teChnIques As you change the position of the Translate Z keys on the Graph Editor, you may need to also slide the curves up or down a little to make sure that they remain within the proper leg length range as they step. You can generally figure out the proper setting through experimentation. 21. Save the scene as mechBugWalk_v04.ma. Creating a walk cycle this way is a little tricky and will take some practice. You can set key- frames on the Translate Z channel of the bodyCtrl curve so the bug walks forward and then adjust the position of the legCtrl curves as the animation plays. You can also change the position for the keyframes on the Graph Editor for pairs of legs so the midLeftLegCtrl, frontRightLegCtrl, and rearRightLegCtrl all move together, alternating with the remaining leg controls. Study the mechBugWalk_v04.ma scene in the chapter5\scenes directory on the DVD to see how this walk cycle was accomplished. To see a finished version of the walking bug, open the mechBugWalk_v04.ma scene from the chapter5\scenes directory on the DVD. Animation Using Expressions Mathematical expressions can be used to automate animation of an object’s attributes. Expressions can be very simple or quite complex. There is almost an infinite variety of expression types and applications. In this section, you’ll see how to add a few simple and common expressions to ani- mate the bug’s antennae. 1. Open the mechBugExpressions_v01.ma scene from the chapter5\scenes directory on the DVD. This scene has an animation of the mechanical bug walking. 2. Select the yellow circle in front of the bug. This is the antennaCtrl, which controls the rotation of the antenna control group. 3. In the menu above the Channel Box, select the Rotate Y channel so that it is highlighted. 4. Choose Edit  Expressions. This opens the Expression Editor. Figure 5.50 Add variation to the movement of the legs by sliding the keys for each leg control on the Graph Editor. anIMatIon usIng exPressIons | 289 5. In the Expression section, type rotateY=sin(time);. 6. Click the Create button to add the expression to the antennaCtrl object (see Figure 5.51). This expression creates a relationship where the rotation of the antennaCtrl group moves back and forth over time. The sin function creates a smooth curve using time as the input. The value of sin moves between -1 and 1. The value of the Rotate Y channel is expressed in degrees, so this expression does not create a very visible motion. It oscillates between -1 and 1 degrees. To fix this, you can add a multiplier to the expression. When you click the Create button, Maya fills in the detailed path to the antennaCtrl chan- nel. The original expression is replaced with antennaCtrl.rotateY=sin(time). As long as an object is selected when you open the Expression Editor, you can type the name of the channel, and Maya will understand that the channel is connected to the selected object. Otherwise, you must specify the path to the channel by typing objectName.channelName. Each statement in the expression should end with a semicolon. 7. In the Expression Editor, change the expression to read antennaCtrl. rotateY=30*(sin(time));. 8. Click the Edit button to change the expression. 9. Rewind and play the animation. The antennae swing back and forth. If you want the motion to move faster, create a multiplier for time. Change the expression so that it reads antennaCtrl.rotateY=30*(sin(time*2));. This makes the rotation occur twice as fast. If you want to slow down the motion, multiply the time by a fraction. time*0.5 makes the rotation move at half the original speed. Figure 5.51 Enter an expres- sion for the antennaCtrl curve in the Expression Editor. 290 | CHAPTER 5 anIMatIon teChnIques You can add an expression to the Translate Y of the antennaCtrl group to make the antenna move up and down: 1. Select the antennaCtrl, and open the Expression Editor (if it’s not still open). 2. In the Expression section, type translateY=cos(time); below the first expression (see Figure 5.52). 3. Click the Edit button to create the expression. This moves the antennaCtrl group up and down, making the antennae rotate upward and downward (recall that the locators in the antennaCtrl group are aim locators for the antennae geometry). The cos function (cosine) works like the sin function (sine) except the cosine is the opposite of sine, so when sine is at -1, cosine is at 1, and vice versa. To make the motion more interesting, you can add a noise function to each of the locators in the antenna control group. The noise function creates a continuous random pattern that moves between -1 and 1 (as opposed to the rand function, which creates a discon- tinuous random motion between -1 and 1). 4. Select one of the yellow locators in the perspective view. 5. In the Channel Box, highlight the Translate Y channel, and choose Edit  Expressions to open the Expression Editor for the locator. 6. In the Expression section, type translateY=noise(time*4);. Then click the Create but- ton to make the expression. 7. Play the animation; you’ll see the antenna move somewhat randomly. 8. Add a similar expression to the Translate Y of the other yellow locator. To make the motion slightly different, try translate=noise(time*5);. 9. Save the scene as mechBugExpressions_v02.ma. To see a version of the scene, open the mechBugExpressions_v02.ma scene from the chapter5\ scenes directory on the DVD. Conditional Statements in Expressions You can make expressions even more sophisticated by adding variables and conditional state- ments. A simple conditional statement looks like this in the Expression Editor: if (x is true){ Perform action; } else { Perform a different action; } Figure 5.52 Add the expression for the Y transla- tion as a second line in the Expres- sion Editor. anIMatIon usIng exPressIons | 291 There are other ways to state conditionals, but this is the most common and simplest way to do it. To make the motion of the antennae more interesting, you’ll make the antennae move faster when they are closer to the ground. 1. Continue with the scene from the previous section, or open the mechBugExpressions_ v02.ma scene from the chapter5\scenes directory on the DVD. 2. Select one of the yellow locators in front of the bug, and open the Expression Editor using the Edit menu in the Channel Box. To create a condition, you’ll make a variable that can hold a value. The value will be dif- ferent depending on the outcome of the test performed by the conditional statement. In this case, the variable can hold a value, which will be a multiplier for time in the noise(time) statement applied to the locator’s Translate Y channel. Before you can use the variable, you should declare it at the start of the expression. This lets Maya know what type of data the variable will hold. In this case, the variable can be an integer (a number without a decimal). The variable you will create is called $antSpeed, for antenna speed. All variables must be preceded by a dollar sign. 3. In the Expression Editor, select the text, and press the Backspace or Delete key to clear the Expression field. Type int $antSpeed; in the field. 4. Press the Return key (the Return key on the keyboard, not the Enter key on the numeric keypad), and enter the following lines: if (antennaCtrl.translateY<0){ $antSpeed = 10; } else { $antSpeed=2; } translateY = noise(time*$antSpeed); Since the expression is testing to see the height of the antennaCtrl group, you need to specify the path to the antennaCtrl group’s Translate Y channel. Expressions for channels are self-contained, so unless you specify the path to another object’s channel, Maya won’t understand what you’re talking about. Figure 5.53 shows the expression in the Expression Editor. 5. Add the same expression to the other locator in the group. Use different values for the $antSpeed variable so that the two antennae move in different ways. 6. Save the scene as mechBugExpressions_v03.ma. To see a finished version of the scene, open the mechBugExpressions_v03.ma scene from the chapter5\scenes directory on the DVD. 292 | CHAPTER 5 anIMatIon teChnIques Motion Path Animation You can animate the movement of an object by attaching the object to a curve and then slid- ing down the length of the curve over time. This is known as motion path animation. To create a Motion Path, perform the following steps: 1. Open the mechBugPath_v01.ma scene from the chapter5\scenes directory on the DVD. 2. Turn on the grid display, and choose Create  CV Curve Tool  Options. 3. In the options, make sure Curve Degree is set to Cubic. 4. Draw a curve on the grid using any number of points; make sure the curve has some nice twisty bends in it. 5. Right-click the curve, and choose Control Vertex. 6. Use the Move tool to move the CVs of the curve up and down so the curve is three- dimensional (see Figure 5.54). 7. In the Outliner, select the mechanicalBug group, and Ctrl+click the curve. 8. From the Animation menu set, choose Animate  Motion Paths  Attach To Motion Path  Options. Figure 5.53 Create a condi- tional statement as an expression to make the antenna move faster when it’s closer to the ground. MotIon Path anIMatIon | 293 9. In the options, choose Edit  Reset to reset the options. Enter the following: Set Front Axis to Z. Turn on Follow. Enable Bank. Set Bank Limit to 30. 10. Click Attach to attach the bug to the curve (see Figure 5.55). Figure 5.54 Draw and shape a curve in the scene. Figure 5.55 The options for Attach To Motion Path 294 | CHAPTER 5 anIMatIon teChnIques The default Time Range is set to Time Slider so the bug will travel the length of the curve based on the current length of the time slider (200 frames in this scene). You can change this after the motion path is created. The Follow option orients the animated object so the front axis follows the bends in the curve. The Bank option adds a rotation on the z-axis around bends in the curve to simu- late banking. 11. Play the animation. The bug follows the path (see Figure 5.56). At this point, the animation looks a little silly; the other parts of the bug need to be animated, which you can do using the techniques described in the chapter. By attaching the mechanical- Bug group as opposed to the bodyCtrl group, you now have the option of adding animation to the bodyCtrl curve to provide variation in the movement of the bug as it flies along the curve. You can change the rate at which the bug flies along the curve by editing the motionPath1 node’s U Value attribute on the Graph Editor: 1. In the Outliner, select the mechanicalBug group. 2. In the Channel Box under Inputs, select motionPath1. 3. Choose Window  Animation Editors  Graph Editor to open the Graph Editor. 4. In the left column, select the motionPath1 U Value attribute, and press the f hot key to focus the graph on its animation curve. 5. Use the graph-editing tools to edit the curve. 6. Save the scene as mechBugPath_v02.ma. To see a version of the scene to this point, open the mechBug_v02.ma scene in the chapter5\ scenes directory on the DVD. Figure 5.56 The bug is attached to the motion path curve. As the ani- mation plays, the bug travels along the length of the curve. anIMatIng ConstraInts | 295 Animating Constraints You can constrain an object to more than one node. The weighting of the constraint strength can be blended between the two nodes and even animated. This is a great technique for solving dif- ficult animation problems, such as a character picking up and putting down an object. Dynamic Parenting Dynamic parenting refers to a technique in which the parenting of an object is keyframed. In this exercise, you’ll animate the mechanical bug sitting on a moving object for a few moments before flying off along a motion path. This scene has the bug rigged and sitting at the origin of the grid. A cattail is bobbing up and down in the breeze. Above the cattail, a curve defines a motion path (see Figure 5.57). A locator named bugLanded is constrained to one of the joints of the cattail using a parent constraint. On the motion path is another locator named bugFly. To make the bug sit on the moving cattail, you’ll create a parent constraint between the bug and the bugLanded locator. 1. Open the mechBugConstrain_v01.ma scene from the chapter5\scenes directory on the DVD. 2. In the Outliner, select the bugLanded locator, and Ctrl+click the mechanicalBug group. 3. From the Animation menu set, choose Constrain  Parent  Options. 4. In the options, turn off Maintain Offset. Leave Translate and Rotate set to All. 5. Click Add to make the constraint (see Figure 5.58). Figure 5.57 The scene con- tains an animated cattail and a motion path. Figure 5.58 The options for the parent constraint [...]... curve in the Graph Editor (see Figure€5.70) 10 Save the scene as mechBugLayers_v 04. ma To see a version of the scene, open the mechBugLayers_v 04. ma scene in the chapter5\scenes folder on the DVD | The Bottom Line â•… 307 Figure€5.70 The merged animation curve is displayed in the Graph Editor Camera Sequencing Maya 2011 introduces the Camera Sequencer, which gives you the ability to plan and test... Set the timeline to 347 20 Reverse the values of the two weights so Bug Landed W0 is at 1 and Bug Fly W1 is at 0 21 Set another keyframe 22 Rewind and play the animation You’ll see the bug sitting on the cattail as it bobs up and down At frame 347 , the bug switches to the motion path and flies off 23 With the mechanicalBug parentConstraint1 node selected, open the Graph Editor 24 Select the Bug Landed... applied Point Order Changes on Import It is a fairly common practice to export a polygon model from Maya as an obj format file for editing in another 3D program such as Mudbox or ZBrush When the edited object is imported back into Maya, the vertex order can change if the options are not set correctly in Maya s Import Options box The model may have exactly the same number of points as the original, but... working on shapes for the brow 2 Select the nancy model, and duplicate it (Ctrl+d) Move the duplicate to the side, as shown in Figure€6 .4 Name the duplicate mouthWide Figure€6 .4 A duplicate of the original head model is created | Chapter 6â•…Animating with Deformers 3 14 •… By default, blend shape deformers calculate only shape node–level changes In other words, only changes made on the vertex level... blend shape targets have been created using the Paint Blend Shape Weights tool 14 Name the two new targets mouthRightNarrow and mouthLeftNarrow At this point, you should have a total of six blend shape targets (see Figure€6.16) 15 Save the scene as nancy_v 04. ma To see a version of the scene to this point, open the nancy_v 04. ma scene from the chapter6\ scenes directory on the DVD Figure€6.16 The scene... to 1 3 Select the blue bodyCtrl curve above the bug, and set its Translate Y channel to -0.5 4 Create a keyframe for this channel 5 Set the current frame to 20, set Translate Y to 0.5, and create another keyframe | Animation Layers â•… 299 6 Create three more keyframes for the bodyCtrl curve: Frame 40 Translate Y: -0.5 Frame 60 Translate Y: 0.5 Frame 80 Translate Y: -0.5 When you play the animation,... tool for viewing the animation as a ╇╉ flip book without having to actually render the animation FCheck is a utility program that is included with Maya Playblasts can be viewed in FCheck Master it╇╉ Create a playblast of the mechBugLayers_v 04. ma scene ╇╉ Animate with expressions╇╉ Expressions are a powerful way to automate the movement of ╇╉ an object Using conditional statements,... button temporarily disables the layer; when you click Play, you’ll see the bug move up and down again 4 Turn the Mute Layer button off, and then play the animation The bug should stop moving 5 Select the bounce layer, and drag the Weight slider slowly to the left as the animation plays (see Figure€5. 64) As you drag the Weight slider down, the influence of the overriding layer decreases, and you can... method used in Maya If the combination of rotation animation on two different layers leads to an unexpected result, try switching to quanternion in the Layer Accumulation settings Euler vs Quanternion Rotation Euler rotation is calculated based on three angle values (X, Y, and Z) plus the order in which the angles are calculated This is the standard method for calculating rotation in Maya, and it works... Figure€6. 14) Employing the Use Color Ramp Option You can receive even more detailed visual feedback by activating the Use Color Ramp option This assigns a gradient of colors to the values painted on the vertices You can customize these colors by changing the colors in the Weight Color option, or you can use one of the preset gradients | Chapter 6â•…Animating with Deformers 320â•… Figure€6. 14 As the . selected. 8. Select the Translate Y and Translate Z channels in the lower right (see Figure 5 .49 ). Figure 5 .48 The Pre- and Post- Infinity values of the Translate Z channel are set to Cycle With. mechBugWalk_v 04. ma scene in the chapter5scenes directory on the DVD to see how this walk cycle was accomplished. To see a finished version of the walking bug, open the mechBugWalk_v 04. ma scene. the bug to the curve (see Figure 5.55). Figure 5. 54 Draw and shape a curve in the scene. Figure 5.55 The options for Attach To Motion Path 2 94 | CHAPTER 5 anIMatIon teChnIques The default

Ngày đăng: 09/08/2014, 11:21

Từ khóa liên quan

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan