For newer tutorials, go here. Even better, order one of my books!


3D Studio MAX 3.1 tutorials
© 2000 Aaron F. Ross. Unauthorized duplication or publication is a violation of international copyright laws.

Tutorial 6: Function Curves (Bouncing Ball part 2)

1. Open your bouncing ball assignment from the previous tutorial.

2. Begin by editing the existing keyframes for the sphere. Select the sphere, then right-click the sphere to get the context-sensitive pop-up menu. Select Track View Selected from the bottom of the pop-up menu, and the Track View window opens. Next to the Transform controller label, click the box with the plus sign in it. A tree expands, allowing you to see the Position, Rotation, and Scale keys for the sphere.

You should see something like this:

You should be in Edit Keys mode    with the Move Keys button    highlighted.

3. If there are any Rotation or Scale keys present, you must delete them. Click and drag to draw a selection window around the Rotation and Scale keys. They turn white to indicate they are selected.


drawing a selection window

With only the Rotation and Scale keys highlighted, click the Delete Keys icon in the Track View toolbar; the selected keys are erased.


Delete Keys icon

4. Now you must delete some, but not all, of the Position keys. Keep the keys at frames 0, 50, and 100, and delete all others. To establish which key is at frame 50, look at the Time Ruler. This is a movable bar which measures time. You can also select a key and look in the Status Bar area of Track View to read the key's frame number.

Once you have established which is frame 50, draw a window to enclose all Position keyframes between 0 and 50, not including 0 or 50. The selected frames become highlighted in white.

Hold down the Control key and draw another selection window around the keyframes between 50 and 100, not including 50 or 100. These keyframes are added to the selection.

Click the Delete Keys icon, or press the delete button on the computer keyboard, to delete the selected keyframes.

5. The sphere should now be animated as a simple arc through space, instead of a bounce. Minimize the Track View window, and play the animation to verify that this is true.


minimize Track View window

You might look at the sphere's Trajectory in the Motion panel. After playing the animation, restore the Track View window.


restore Track View window

6. In Track View, select the Position track by clicking its label; it highlights to show that it is selected. Then activate Function Curves mode by clicking the icon.

7. Expand the Track View window by dragging its corners, or maximize the window to full-screen by using the maximize button.


maximizing a window to full-screen

The function curves expand to fill the available area.

The red line shows the world X coordinates for the sphere. It should be a straight line, from lower left to upper right, indicating a constant speed of motion.

The green line shows the Y coordinates; it should also be a straight line. The Y graph, however, should remain at or near the zero point throughout the animation, since the sphere is traveling parallel to the Y axis. The green line may be difficult to see if it is exactly at the zero mark.

The blue line indicates the Z position of the sphere. The arc you see should closely resemble the Trajectory of the sphere in the Front and Perspective viewports. In most cases there will not be such an obvious resemblance; this assignment is designed to make the relationship between function curves and position coordinates self-evident.

8. We are only concerned with the Z curve for the sphere's position. Use the Zoom Region tool to draw a selection window around the blue curve.

9. Select the Move Keys tool.

Right-click the key at the low point of the arc to get the Key Info pop-up dialog box. These are the parameters for that keyframe. Here, you can change the type of interpolation between keyframes.

Convert the incoming and outgoing key tangent types to Bezier by click-dragging the tangent flyout. Note that both In and Out types are converted simultaneously; this is unique to the Bezier tangent type. See the illustration below.


click and drag to convert the key to a Bezier tangent

If you don't see tangent handle lines on the key, make sure Show Tangents is enabled in the Track View toolbar.


show tangents toggle

10. In the key Key Info dialog box, click the left arrow to jump to the previous key, at frame 0. Convert this key to a Bezier tangent also. Use the arrow keys to jump to the last key at the end of the animation, and convert it to a Bezier tangent. When all three keys have been converted, close the dialog box.


previous key

11. Using the tangent handles, adjust the curve so it resembles a bouncing ball. The tangents at keyframe 50 are locked so that they always move together, meaning you can't get a sharp angle resembling a bounce. Hold the Shift key down and drag the tangent handle for keyframe 50. This unlocks the tangents so you can adjust either side of the keyframe separately. You only need to unlock the tangents once; after that you don't need to use the Shift key.


shift-drag to break tangents

12. Play the animation, perhaps in Trajectories mode. Go back to the Track View and make adjustments if necessary. Add a keyframe or two if you like, using the Add Keys button. However, if you add too many keys, the movement will not be as smooth.


activate Add Keys mode in Track View toolbar

13. Now we will squash the ball as it impacts the ground. Add an Xform modifier to the ball. (Xform can be found at the bottom of pop-up list which is launched when you click the More button above the list of modifiers.)

Turn on the Animate Button. Go to frame 0, the first frame of the animation. Under the Xform modifier, select Sub-object Center. In the Front viewport, move the Center of the Xform effect to the bottom of the ball, where it will touch the ground plane. See the illustration below.

This is so that when the ball is Squashed, its surface will still touch the ground plane. If the Center of the Xform Squash were in the center of the ball, there would be a gap between the ball and the ground. In this case, you won't have to adjust the position of the ball.

14. In the animation transport toolbox, click the icon that looks like a key.

This is called Key Mode, and when it is highlighted you can skip forward and back to keyframes using the Previous and Next Buttons. Press the Next button     to skip to the next keyframe of the currently selected object. Use it to advance to the frame in which the ball touches the ground.

Under the Xform modifier, select Sub-object Gizmo. In the Main Toolbar, click and drag the Scale icon to select Squash from the flyout.

Squash scales an object while maintaining the overall volume, just as with a real object. With Squash the active transform, select the World coordinate system. Squash the ball in the Z axis by using the Transform Gizmo. Make sure you don't accidentally select the YZ axes, which are represented by the blue and green corner of the Transform Gizmo. The ball should still be touching the ground plane. Check your work in the Front viewport. See below.

15. Advance the Time Slider a few frames. Create another Squash key, making the ball look as if it is bouncing back after being squashed.

16. Play the animation. You will see that the first half of the animation is wrong, due to a phenomenon called "overshooting." The default smooth interpolation between keys has resulted in a distortion. We can fix that by changing the keyframe type of the Xform Scale key at frame zero to Hold. The parameter value of the key is held until another keyframe is reached. Then the parameter instantly jumps to the value of the following key.

In the Track View, open up the hierarchy to Objects | Sphere01 | Modified Object | Xform | Gizmo. Find the Scale keys and right-click on the first keyframe, at frame 0. See below.

A Hold interpolation type maintains a constant, unchanging value between keyframes. Converting the first keyframe's Outgoing interpolation to Hold will fix the overshooting problem. Right-click on the first Scale key for the Xform modifier.

Click the big button under Out, and drag it to the Hold type, which looks like a square graph.

17. Playing the animation should show that the problem is fixed. The Squash remains at its initial default value until the ball touches the ground at frame 50. If the problem persists, check all keyframes between zero and 50. There should be no Scale information in those keys.

18. Add a few more Xform Squash keys so, that the ball squashes and stretches a few times more. Alternate positive and negative squashes with each key. On the last Squash key, try to restore the ball to normal. You cannot get the ball precisely spherical in the viewport, so you have to adjust the data in the Track View.

19. In Track View, select Objects | Sphere01 | Modified Object | Xform | Gizmo. Activate Function Curves mode.

To restore the ball to its original shape, the last Scale key must end with all values at 100%. Zoom in on the important area of the graph by using the Zoom Region tool.

20. On the Track View toolbar, click the Move Keys icon. Then right-click on one of the last Scale keys. The Key Info dialog pops up. Now you can enter 100 for all X, Y, and Z values.

     

21. To ease the transition at this point, convert the incoming tangent type to Slow. This is a classic ease-in keyframe.


convert In tangent to Slow

22. It is possible to edit these Function Curves just like any other. But be aware that the Squash Transform works by automatically scaling two axes in inverse proportion to the scale applied by the user in one axis. Adjusting raw scale values in the Function Curves will not automatically maintain the same amount of overall volume in the object as you would observe by manipulating the object directly in the viewport. So if you make any modifications, the curves must be perfectly symmetrical, as seen in the illustration, and the X and Y curves must be identical.

23. Play the animation and make any tweaks you wish. Now is a good time to save your work to the temporary file on your local disk.

24. Turn off the Animate button while working with materials. Open up the Material Editor by pressing the M key. Select an empty material and rename it "Checkered Ball." Scroll down to the Maps rollout. Next to the Diffuse Color map, click the button that says None. The Material/Map browser comes up. Double-click the word Checker. The Checker map is assigned to the material.

25. To make the checkers repeat more on the surface of the ball, go to the Coordinates rollout for the checker map. Change the U Tiling value to 5, and the V Tiling to 3. Drag the material's sample sphere to the ball in the Perspective viewport. Then click the Show Map in Viewport button to see the texture on the ball.

26. Play the animation. With the texture, it becomes clear that there should be some amount of spin on the ball. Merely rotating the ball will not work, because standard Transforms are always applied after all modifiers. We need to rotate the ball before it is Squashed, so that the Squash is always perpendicular to the ground plane _ regardless of the ball rotation.

In the Modifier Stack, de-select Sub-object mode, and go back down to the level of the Sphere object.


select the Sphere object in the stack, prior to adding another Xform

Now add another Xform modifier. This will be the Rotation node, placed above the Sphere object type in the stack, and below the existing Squash Xform modifier. Therefore, the ball will be rotated before it is Squashed.

27. Turn the Animate button back on. Using the Sub-object Gizmo of this new rotate Xform modifier, create some rotate keys. Note that no matter how you orient the ball, it will always Squash perpendicular to the ground plane.

28. Play the animation and make any final adjustments to it. If the ball's rotation isn't right, make sure there are no rotation keys in the ball's Squash Xform, or in its standard Transforms. Your Track View should look something like the illustration below.

Note that through the use of the Xform modifier, you can perform transform functions in any order you choose.

All Rotate keys are in the lowest Xform modifier, which means they are performed first.

All Scale keys are in the next highest Xform modifier, so they are performed after the Rotate keys.

All Position keys are in the standard Transforms, so they are performed last.

If you had used the standard Transforms, you would not be able to achieve this effect. The order of standard Transforms is unchangeable in MAX, and is always Scale, Rotation, Position.

29. Turn off the Animate button. Activate the Top viewport, and go to the Create panel. Click the Cameras icon and select Target. Now click and drag anywhere in the Top viewport to create the camera and its target.

With the camera still selected, right-click the Perspective viewport. In the Menu Bar, click on the Views menu, and select Match Camera to View. The camera and target now snap to the new position. Right-click the Perspective viewport label and drag the mouse to Views, then Camera01. The Perspective viewport changes to the Camera view.

30. Maximize the Camera viewport. Use the Dolly and Truck controls in the viewport toolbox to frame the shot. The shot should be tight enough so that the animation begins and ends with the ball at off-screen positions.

     
use Dolly and Truck to adjust the camera view

31. Minimize the Camera viewport and switch to Top view. Click Zoom Extents All to see all of the objects. From the Create panel, click the Lights icon. Select Target Spot. Create a spotlight in Top view by click-dragging to establish the position of the light, and then its target. Position the light to the left of the camera, and place the spotlight's target near the World origin.

32. In Front view, move the light up in its local Y axis, so that it can shine down on the scene. Right-click on the Left viewport label, and select Views, Spot01. From the spotlight's point of view, you can adjust where it shines using buttons in the viewport toolbox. These tools are similar to camera adjustments.

33. With the light selected, go to the Modify panel and expand the Shadow Parameters rollout. Turn Object Shadows on. Advance the Time Slider to about frame 40. Right-click the Camera viewport to select it, and then click the Render Scene icon.

34. In the Render Scene dialog, Time Output should be Single. Change the Output Size to 320 x 240 and click Render. You should see the shadow of the Ball on the ground. See the illustration of the Render Scene dialog below.

35. If the rendering looks good, click Render Scene again. Change Time Output to Active Time Segment. Under Render Output, click on the Files button. You will get the Render Output dialog. Browse to, or create, a local folder to keep your animation. Make it an AVI file by typing in the filename with a .avi extension. Use Indeo compression, with quality set to 100%. Click OK to get out of the Video Compression setup, then Save to get out of the Render Output dialog. Then click Render in the Render Scene dialog, and your animation begins rendering.

36. When it is finished, view it with RAM player. Select Rendering tab in the Tab Palette, then click RAM Player. Within RAM Player, click Open Channel A and browse to open your AVI animation.


Return to 3D Studio MAX 3 tutorials


CGLearn.com home page