- •Preface
- •About This Book
- •Acknowledgments
- •Contents at a Glance
- •Contents
- •Relaxing at the Beach
- •Dressing the Scene
- •Animating Motion
- •Rendering the Final Animation
- •Summary
- •The Interface Elements
- •Using the Menus
- •Using the Toolbars
- •Using the Viewports
- •Using the Command Panel
- •Using the Lower Interface Bar Controls
- •Interacting with the Interface
- •Getting Help
- •Summary
- •Understanding 3D Space
- •Using the Viewport Navigation Controls
- •Configuring the Viewports
- •Working with Viewport Backgrounds
- •Summary
- •Working with Max Scene Files
- •Setting File Preferences
- •Importing and Exporting
- •Referencing External Objects
- •Using the File Utilities
- •Accessing File Information
- •Summary
- •Customizing Modify and Utility Panel Buttons
- •Working with Custom Interfaces
- •Configuring Paths
- •Selecting System Units
- •Setting Preferences
- •Summary
- •Creating Primitive Objects
- •Exploring the Primitive Object Types
- •Summary
- •Selecting Objects
- •Setting Object Properties
- •Hiding and Freezing Objects
- •Using Layers
- •Summary
- •Cloning Objects
- •Understanding Cloning Options
- •Mirroring Objects
- •Cloning over Time
- •Spacing Cloned Objects
- •Creating Arrays of Objects
- •Summary
- •Working with Groups
- •Building Assemblies
- •Building Links between Objects
- •Displaying Links and Hierarchies
- •Working with Linked Objects
- •Summary
- •Using the Schematic View Window
- •Working with Hierarchies
- •Setting Schematic View Preferences
- •Using List Views
- •Summary
- •Working with the Transformation Tools
- •Using Pivot Points
- •Using the Align Commands
- •Using Grids
- •Using Snap Options
- •Summary
- •Exploring the Modifier Stack
- •Exploring Modifier Types
- •Summary
- •Exploring the Modeling Types
- •Working with Subobjects
- •Modeling Helpers
- •Summary
- •Drawing in 2D
- •Editing Splines
- •Using Spline Modifiers
- •Summary
- •Creating Editable Mesh and Poly Objects
- •Editing Mesh Objects
- •Editing Poly Objects
- •Using Mesh Editing Modifiers
- •Summary
- •Introducing Patch Grids
- •Editing Patches
- •Using Modifiers on Patch Objects
- •Summary
- •Creating NURBS Curves and Surfaces
- •Editing NURBS
- •Working with NURBS
- •Summary
- •Morphing Objects
- •Creating Conform Objects
- •Creating a ShapeMerge Object
- •Creating a Terrain Object
- •Using the Mesher Object
- •Working with BlobMesh Objects
- •Creating a Scatter Object
- •Creating Connect Objects
- •Modeling with Boolean Objects
- •Creating a Loft Object
- •Summary
- •Understanding the Various Particle Systems
- •Creating a Particle System
- •Using the Spray and Snow Particle Systems
- •Using the Super Spray Particle System
- •Using the Blizzard Particle System
- •Using the PArray Particle System
- •Using the PCloud Particle System
- •Using Particle System Maps
- •Controlling Particles with Particle Flow
- •Summary
- •Understanding Material Properties
- •Working with the Material Editor
- •Using the Material/Map Browser
- •Using the Material/Map Navigator
- •Summary
- •Using the Standard Material
- •Using Shading Types
- •Accessing Other Parameters
- •Using External Tools
- •Summary
- •Using Compound Materials
- •Using Raytrace Materials
- •Using the Matte/Shadow Material
- •Using the DirectX 9 Shader
- •Applying Multiple Materials
- •Material Modifiers
- •Summary
- •Understanding Maps
- •Understanding Material Map Types
- •Using the Maps Rollout
- •Using the Map Path Utility
- •Using Map Instances
- •Summary
- •Mapping Modifiers
- •Using the Unwrap UVW modifier
- •Summary
- •Working with Cameras
- •Setting Camera Parameters
- •Summary
- •Using the Camera Tracker Utility
- •Summary
- •Using Multi-Pass Cameras
- •Creating Multi-Pass Camera Effects
- •Summary
- •Understanding the Basics of Lighting
- •Getting to Know the Light Types
- •Creating and Positioning Light Objects
- •Viewing a Scene from a Light
- •Altering Light Parameters
- •Working with Photometric Lights
- •Using the Sunlight and Daylight Systems
- •Using Volume Lights
- •Summary
- •Selecting Advanced Lighting
- •Using Local Advanced Lighting Settings
- •Tutorial: Excluding objects from light tracing
- •Summary
- •Understanding Radiosity
- •Using Local and Global Advanced Lighting Settings
- •Working with Advanced Lighting Materials
- •Using Lighting Analysis
- •Summary
- •Using the Time Controls
- •Working with Keys
- •Using the Track Bar
- •Viewing and Editing Key Values
- •Using the Motion Panel
- •Using Ghosting
- •Animating Objects
- •Working with Previews
- •Wiring Parameters
- •Animation Modifiers
- •Summary
- •Understanding Controller Types
- •Assigning Controllers
- •Setting Default Controllers
- •Examining the Various Controllers
- •Summary
- •Working with Expressions in Spinners
- •Understanding the Expression Controller Interface
- •Understanding Expression Elements
- •Using Expression Controllers
- •Summary
- •Learning the Track View Interface
- •Working with Keys
- •Editing Time
- •Editing Curves
- •Filtering Tracks
- •Working with Controllers
- •Synchronizing to a Sound Track
- •Summary
- •Understanding Your Character
- •Building Bodies
- •Summary
- •Building a Bones System
- •Using the Bone Tools
- •Using the Skin Modifier
- •Summary
- •Creating Characters
- •Working with Characters
- •Using Character Animation Techniques
- •Summary
- •Forward versus Inverse Kinematics
- •Creating an Inverse Kinematics System
- •Using the Various Inverse Kinematics Methods
- •Summary
- •Creating and Binding Space Warps
- •Understanding Space Warp Types
- •Combining Particle Systems with Space Warps
- •Summary
- •Understanding Dynamics
- •Using Dynamic Objects
- •Defining Dynamic Material Properties
- •Using Dynamic Space Warps
- •Using the Dynamics Utility
- •Using the Flex Modifier
- •Summary
- •Using reactor
- •Using reactor Collections
- •Creating reactor Objects
- •Calculating and Previewing a Simulation
- •Constraining Objects
- •reactor Troubleshooting
- •Summary
- •Understanding the Max Renderers
- •Previewing with ActiveShade
- •Render Parameters
- •Rendering Preferences
- •Creating VUE Files
- •Using the Rendered Frame Window
- •Using the RAM Player
- •Reviewing the Render Types
- •Using Command-Line Rendering
- •Creating Panoramic Images
- •Getting Printer Help
- •Creating an Environment
- •Summary
- •Creating Atmospheric Effects
- •Using the Fire Effect
- •Using the Fog Effect
- •Summary
- •Using Render Elements
- •Adding Render Effects
- •Creating Lens Effects
- •Using Other Render Effects
- •Summary
- •Using Raytrace Materials
- •Using a Raytrace Map
- •Enabling mental ray
- •Summary
- •Understanding Network Rendering
- •Network Requirements
- •Setting up a Network Rendering System
- •Starting the Network Rendering System
- •Configuring the Network Manager and Servers
- •Logging Errors
- •Using the Monitor
- •Setting up Batch Rendering
- •Summary
- •Compositing with Photoshop
- •Video Editing with Premiere
- •Video Compositing with After Effects
- •Introducing Combustion
- •Using Other Compositing Solutions
- •Summary
- •Completing Post-Production with the Video Post Interface
- •Working with Sequences
- •Adding and Editing Events
- •Working with Ranges
- •Working with Lens Effects Filters
- •Summary
- •What Is MAXScript?
- •MAXScript Tools
- •Setting MAXScript Preferences
- •Types of Scripts
- •Writing Your Own MAXScripts
- •Learning the Visual MAXScript Editor Interface
- •Laying Out a Rollout
- •Summary
- •Working with Plug-Ins
- •Locating Plug-Ins
- •Summary
- •Low-Res Modeling
- •Using Channels
- •Using Vertex Colors
- •Rendering to a Texture
- •Summary
- •Max and Architecture
- •Using AEC Objects
- •Using Architectural materials
- •Summary
- •Tutorial: Creating Icy Geometry with BlobMesh
- •Tutorial: Using Caustic Photons to Create a Disco Ball
- •Summary
- •mental ray Rendering System
- •Particle Flow
- •reactor 2.0
- •Schematic View
- •BlobMesh
- •Spline and Patch Features
- •Import and Export
- •Shell Modifier
- •Vertex Paint and Channel Info
- •Architectural Primitives and Materials
- •Minor Improvements
- •Choosing an Operating System
- •Hardware Requirements
- •Installing 3ds max 6
- •Authorizing the Software
- •Setting the Display Driver
- •Updating Max
- •Moving Max to Another Computer
- •Using Keyboard Shortcuts
- •Using the Hotkey Map
- •Main Interface Shortcuts
- •Dialog Box Shortcuts
- •Miscellaneous Shortcuts
- •System Requirements
- •Using the CDs with Windows
- •What’s on the CDs
- •Troubleshooting
- •Index
Chapter 31 Animating with Constraints and Controllers |
801 |
Figure 31-34: The Master Point controller defines tracks for each subobject element that is animated.
Summary
Using the Animation Constraints menu, you can apply constraints to objects. This menu also lets you select a target object. You can use the various constraints to limit the motion of objects, which is helpful as you begin to animate. If you’re an animator, you should thank your lucky stars for controllers. Controllers offer power flexibility for animating objects — and just think of all those keys that you don’t have to set by hand.
In this chapter, you
Learned to constrain an object to the surface of another object using the Attachment and Surface constraints
Forced an object to travel along a path with the Path constraint
Controlled the position and orientation of objects with weighted Position and Orientation constraints
Shifted between two different controlling objects using the Link constraint
Followed objects with the LookAt constraint
Learned about the various controller types
Discovered how to assign controllers using the Motion panel and the Track View
Set default controllers in the Preference Settings dialog box
Examined the various controllers in several different categories
Saw a few examples of using controllers
In the next chapter, we focus on one particularly useful controller — the Expression controller. This controller enables you to animate objects by defining a mathematical expression.
|
|
|
Using the
Expression
Controller
The term expressions refers to mathematical expressions or simple formulas that compute a value based on other values. These
expressions can be simple, as with moving a bicycle based on the rotation of the pedals; or complex, as with computing the sinusoidal translation of a boat on the sea as a function of the waves beneath it.
You can use almost any value as a variable in an expression, from object coordinates and modifier parameters, to light and material settings. The results of the expression are computed for every frame and used to affect various parameters in the scene. You can include the number of frames and time variables in the expression to cause the animation results to repeat for the entire sequence.
Of all the controllers that are available, the Expression controller has limitless possibilities that could fill an entire book. This short chapter covers the basics of building expressions along with several examples.
Working with Expressions in Spinners
Although much of this chapter focuses on using the Expression controller, the Expression Controller Interface isn’t the only place where you can play with expressions. Expressions can also be entered into spinner controls using the Numerical Expression Evaluator, shown in Figure 32-1. This simple dialog box is accessed by selecting a spinner and pressing Ctrl+N.
Cross- Another common place that uses expressions is the Parameter Reference Wiring dialog box. This dialog box is covered in Chapter 30,
“Animation Basics.”
32C H A P T E R
In This Chapter
Using the Numerical
Expression Evaluator
Understanding the Expression controller interface
Learning about operators, variables, and functions
Controlling object transformations
Controlling parameters
804 Part VII Animation
Figure 32-1: The Numerical Expression Evaluator dialog box lets you enter expressions for a spinner.
|
To use this evaluator, just type the expression in the field; the result is displayed in the result |
|
field. The result field is updated as you type the expression. If you make a mistake, the Result |
|
is blanked out. The Paste button places the result value in the spinner, and the Cancel button |
|
closes the dialog box without a change. |
Tip |
You can enter a relative value in a spinner by typing the letter R and a value. For example, if the |
|
Segments value of a sphere object is 32, then typing R20 changes the value to 52 and R-20 |
|
changes the value to 12. |
Understanding the Expression Controller Interface
The Expression controller is just one of the many controllers that are available for automating animations. This controller enables you to define how the object is transformed by means of a mathematical formula or expression, which you can apply to any of the object’s tracks. It shows up in the controller list, based on the type of track to which it is assigned, as a Position Expression, Rotation Expression, Scale Expression, Float Expression, or Point3 Expression controller.
Before you can use the Expression controller on a track, you must assign it to a track. You can assign controllers using the Motion panel or the Track View. After you assign a controller, the Expression Controller dialog box immediately opens, or you can access this dialog box at any time by right-clicking the track and selecting Properties from the pop-up menu. For example, select an object in your scene, open the Motion panel, and select the Position track. Then click on the Assign Controller button at the top of the Assign Controller rollout, and select Position Expression from the list of Controllers. This causes the Expression Controller dialog box to appear.
You can use this dialog box to define variables and write expressions. The dialog box, shown in Figure 32-2, includes four separate panes that are used to display a list of Scalar and Vector variables, build an expression, and enter a description of the expression.
Defining variables
Variables are placeholders for different values. For example, creating a variable for a sphere’s radius called “r” would simplify an expression for doubling its size from “take the sphere’s radius and multiply it by two,” to simply “r times 2.”
To add Variables to the list panes in the Expression Controller dialog box, type a name in the Name field, select the Scalar or Vector option type, and click the Create button; the new variable appears in the Scalars or Vectors list. To delete a variable, select it from the list and click the Delete button. The Tick Offset value is the time added to the current time and can be used to delay variables.
Chapter 32 Using the Expression Controller |
805 |
Figure 32-2: You can use the Expression controller to build expressions and define their results.
You can assign any new variable either to a constant or to a controller. Assigning a variable to a constant does the same thing as typing the constant’s value in the expression. Constant variables are simply for convenience in writing expressions. The Assign to Controller button opens the Track View Pick dialog box, shown in Figure 32-3, where you can select the specific controller track for the variable, such as the position of an object.
Figure 32-3: The Track View Pick dialog box displays all the tracks for the scene. Tracks that you can select are displayed in black.
Assigning a variable to a controller enables you to animate the selected object based on other objects in the scene. To do this, create a variable and assign it to an animated track of another object. For example, if you create a Vector variable named boxPos and assign it to the Position track for a box object, then within the expression you can use this variable to base the motion of the assigned object on the box’s position.
Building expressions
You can type expressions directly into the Expression pane of the Expression Controller dialog box. To use a named variable from one of the variable lists (Scalars or Vectors), type its name in the Expression pane. Predefined variables (presented later in the chapter) such as F and NT do
806 Part VII Animation
not need to be defined in the variable panes. The Function List button opens a list of functions, shown in Figure 32-4, where you can view the functions that can be included in the expression. This list is for display only; you still need to type the function in the Expression pane.
Figure 32-4: The Function List dialog box lets you view all the available functions that you can use in an expression.
Note The Expression pane ignores any white space, so you can use line returns and spaces to make the expression easier to see and read.
Debugging and evaluating expressions
After typing an expression in the Expression pane, you can check the values of all variables at any frame by clicking the Debug button. This opens the Expression Debug window, shown in Figure 32-5. This window displays the values for all variables, as well as the return value. The values are automatically updated as you move the Time Slider.
Figure 32-5: The Expression Debug window offers a way to test the expression before applying it.
The Evaluate button in the Expression Controller dialog box commits the results of the expression to the current frame segment. If the expression contains an error, an alert dialog box warns you of the error. Replacing the controller with a different one can erase the animation resulting from an Expression controller.
Chapter 32 Using the Expression Controller |
807 |
Managing expressions
You can use the Save and Load button to save and recall expressions. Saved expressions are saved as files with an .XPR extension. Expression files do not save variable definitions.
Tutorial: Creating following eyes
As a quick example, we start with a simple expression. The Expression controller is very useful for setting the eye pupil objects to move along with the ball’s motion. This same functionality can be accomplished using a manipulator and wiring the parameter, but we show it with the Float Expression controller.
To make eye pupil objects follow a moving ball object, follow these steps:
1.Open the Following eyes.max file from the Chap 32 directory on the CD-ROM.
This file includes face taken from a Greek model made by Viewpoint Datalabs, along with a ball that is animated to move back and forth.
2.Select the left eye pupil object (the right pupil has been linked to move with the left pupil), and open the Motion panel. Select the Position track, and click the Assign Controller button. Select the Position Expression controller, and click Ok.
The Expression Controller dialog box opens.
3.Create a new vector variable named ballPos by typing its name in the Name field, selecting the Vector option, and clicking the Create button.
4.With the ballPos variable selected, click the Assign to Controller button. In the Track View Pick dialog box, locate and select the Position track for the Sphere01 object, as shown in Figure 32-6, and click OK.
Figure 32-6: Select the Position track for the Sphere01 object in the Track View Pick dialog box.
5. In the Expression pane, erase the existing expression and type the following:
[ -3.1 + ballPos.x/20, -2.9, 41.0 ]