
- •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

808 Part VII Animation
Then click the Debug button. The Expression Debug window appears, in which you can see the variable values change as items in the scene change. With the expression complete, you can drag the Time Slider back and forth and watch the pupil follow the ball from side to side. If you’re happy with the motion, click the Evaluate button and then the Close button to exit the interface.
This is a simple example, but it demonstrates what is possible. Figure 32-7 shows the resulting face.
Figure 32-7: The Expression controller was used to animate the eye’s following the ball in this example.
Understanding Expression Elements
The key to making the Expression controller work is building expressions. Before you can build expressions, you need to understand the various elements that make up an expression. Expressions can consist of variables (including predefined variables), operators, and functions, so we start by explaining these. It is also important to understand what the expression will return and the various return types.
Predefined variables
Max includes several predefined variables that have constant values. These predefined variables are defined in Table 32-1. They are case sensitive and must be typed exactly as they appear in the Syntax column.

Chapter 32 Using the Expression Controller |
809 |
Table 32-1: Predefined Variables
Variable |
Syntax |
Value |
|
|
|
PI |
pi |
3.14159 |
Natural Logarithm |
e |
2.71828 |
Ticks Per Second |
TPS |
4800 |
Frame Number |
F |
Current frame number |
Normalized Time |
NT |
The entire time of the active number of frames |
Seconds |
S |
The number of seconds based on the frame rate |
Ticks |
T |
The number of ticks based on the frame rate, where 4,800 ticks |
|
|
equal 1 second |
|
|
|
In addition to these predefined variables, you can choose your own variables to use. These variables cannot contain spaces, and each variable must begin with a letter. After a variable is defined, you can assign it a constant value or have it pick up its value from a controller track.
Operators
An operator is the part of an expression that tells how to deal with the variables. One example of an operator is addition: It tells you to add a value to another value. These operators can be grouped as basic operators, which include the standard math functions such as addition and multiplication; logical operators, which compare two values and return a true or false result; and vector operators, which enable mathematical functions between vectors. Tables 32-2 through 32-4 identify the operators that are in each of these groups.
Tip Although it isn’t required, scalar variables are typically lowercase and vector variables are uppercase.
Table 32-2: Basic Operators
Operator |
Syntax |
Example |
|
|
|
Addition |
+ |
i+j |
Subtraction |
- |
i-j |
Negation |
- |
-i |
Multiplication |
* |
i*j |
Division |
/ |
i/j |
Raise to the power |
^ or ** |
i^j or i**j |
|
|
|

810 Part VII Animation
Table 32-3: Logical Operators
Operator |
Syntax |
Example |
|
|
|
Equal to |
= |
i=j |
Less than |
< |
i<j |
Greater than |
> |
i>j |
Less than or equal to |
<= |
i<=j |
Greater than or equal to |
>= |
i>=j |
Logical Or (Returns a 1 if either value is 1) |
| |
i|j |
Logical And (Returns a 1 if both values are 1) |
& |
i&j |
|
|
|
Table 32-4: Vector Operators
Operator |
Syntax |
Example |
|
|
|
Component (Refers to the x component of vector V) |
. |
V.x |
Vector Addition |
+ |
V+W |
Vector Subtraction |
- |
V-W |
Scalar Multiplication |
* |
i*V |
Scalar Division |
/ |
V/i |
Dot Product |
* |
V*W |
Cross Product |
x |
VxW |
|
|
|
The order in which the operators are applied is called operator precedence. The first equations to be calculated are the expressions contained inside of parentheses. If you’re in doubt about which expression gets evaluated first, place each expression in separate parentheses. For example, the expression (2 + 3) * 4 equals 20 and 2 + (3 * 4) equals 14. If the equation doesn’t contain any parentheses and only simple operators, then the precedence is from left to right with multiplication and division coming before addition and subtraction.
Functions
Functions are like mini-expressions that are given a parameter and return a value. For example, the trigonometric function for sine looks like this:
Sin()
It takes an angle, which is entered within the parentheses, and returns a sine value. For example, if you open the Expression Controller dialog box and enter the expression
Sin(45)

Chapter 32 Using the Expression Controller |
811 |
|
and then open the Debug window, the Expression Value will be 0.707, which is the sine value |
|
for 45 degrees. |
|
Table 32-5 lists the functions that are used to create expressions. |
Tip |
You can see a full list of all the possible functions with explanations by clicking the Function |
|
List button in the Expression Controller dialog box. |
Table 32-5: Expression Functions
Function |
Syntax |
Description |
|
|
|
Sine |
sin(i) |
Computes the sine function for an angle. |
Cosine |
cos(i) |
Computes the cosine function for an angle. |
Tangent |
tan(i) |
Computes the tangent function for an angle. |
Arc Sine |
asin(i) |
Computes the arc sine function for an angle. |
Arc Cosine |
acos(i) |
Computes the arc cosine function for an angle. |
Arc Tangent |
atan(i) |
Computes the arc tangent function for an angle. |
Hyperbolic Sine |
hsin(i) |
Computes the hyperbolic sine function for an angle. |
Hyperbolic Cosine |
hcos(i) |
Computes the hyperbolic cosine function for an |
|
|
angle. |
Hyperbolic Tangent |
htan(i) |
Computes the hyperbolic tangent function for an |
|
|
angle. |
Convert Radians to Degrees |
radToDeg(i) |
Converts an angle value from radians to degrees. |
Convert Degrees to Radians |
degToRad(i) |
Converts an angle value from degrees to radians. |
Ceiling |
ceil(i) |
Rounds floating values up to the next integer. |
Floor |
floor(i) |
Rounds floating values down to the next integer. |
Natural Logarithm (base e) |
ln(i) |
Computes the natural logarithm for a value. |
Common Logarithm (base 10) |
log(i) |
Computes the common logarithm for a value. |
Exponential Function |
exp(i) |
Computes the exponential for a value. |
Power |
pow(i,j) |
Raises i to the power of j. |
Square Root |
sqrt(i) |
Computes the square root for a value. |
Absolute Value |
abs(i) |
Changes negative numbers to positive. |
Minimum Value |
min(i,j) |
Returns the smaller of the two numbers. |
Maximum Value |
max(i,j) |
Returns the larger of the two numbers. |
Modulus Value |
mod(i,j) |
Returns the remainder of i divided by j. |
Continued

812 Part VII Animation
Table 32-5 (continued)
Function |
Syntax |
Description |
|
|
|
Conditional If |
if(i,j,k) |
Tests the value of i, and if it’s not zero, then j is |
|
|
returned, or if it is zero then k is returned. |
Vector If |
vif(i,V,W) |
Same as the if function, but works with vectors. |
Vector Length |
length(V) |
Computes the vector length. |
Vector Component |
comp(V,i) |
Returns the i component of vector V. |
Unit Vector |
unit(V) |
Returns a vector of length 1 that points in the same |
|
|
direction as V. |
Random Noise Position |
noise(i,j,k) |
Returns a random position. |
|
|
|
Return types
|
A return type is the type of value that is expected to be returned to the track that was assigned |
|
the Expression controller. For example, if you assign the Position Expression controller to the |
|
Position track of an object, then the return type is a vector, expecting coordinate values. |
Tip |
In the Expression Controller dialog box, the object and the track that is assigned to the con- |
|
troller are displayed in the title bar. |
The return type can be a number (called a scalar), a collection of coordinates (called a vector), or a collection of color values (called a Point3). Scalars are used to control parameter values, vectors define actual coordinates in space, and the Point3 return type defines colors. Each of these types has its own format that you need to know before you can use it in an expression.
Caution |
Variables used in an expression need to match the return type. For example, if you have a |
|
Vector return type describing an object’s position, it can use a scalar or vector variable, but |
|
the expression result needs to be a vector. A scalar return type (such as a sphere’s Radius) |
|
cannot be multiplied by a vector; otherwise, an error appears. |
Scalar return type
A scalar value is a single value typically used for an object parameter, such as a sphere’s radius or the length of a Box object. This is used for tracks that have the Float Expression controller applied. Any resulting value from the expression is passed back to the assigned parameter. Scalars have no special format — only the number.
Vector return type
If a transform such as position is assigned, the Expression pane shows three values separated by commas and surrounded by brackets. These three values represent a vector, and each value is a different positional axis. You can refer to an individual axis value by placing a dot and the axis after the variable name. For example, if a vector variable named boxPosition exists, you can refer to the X-axis position component with the variable boxPosition.x. Component values are actually scalars.

Chapter 32 Using the Expression Controller |
813 |
Point3 return type
Materials work with yet another return type called a Point3. This type includes three numbers separated by commas and surrounded by brackets. Each of these values, which can range between 0 and 255, represents the amount of red, green, or blue in a color.
Note Any value that is out of range is automatically set to its nearest acceptable value. For example, if your expression returns a value of 500 for the green component, the color is shown as if green were simply 255.
Sample expressions
If you scan through your old physics and math books, you can find plenty of equations that you can use to create expressions. Following are some sample motions and their respective expressions.
For example, if the sphere object has the Float Expression controller applied to its Radius track, then a simple expression for increasing the radius from an initial radius value as the frame number increases would look like this:
initialRadius + F
You can use the trigonometric functions to produce a smooth curve from 0 to 360. Using the Sine function, you can cause the sphere’s radius to increase to a maximum value of 50 and then decrease to its original radius. The expression would look like this:
50 * sin(360*NT)
To make our sphere example move in a zigzag path, we can use the modulus function. This causes the position to increase slowly to a value and then reset. The expression looks like this:
[0, 10*mod(F,20), 10*F]
You can use the square root function to simulate ease in and ease out curves, causing the object to accelerate into or from a point. The expression would look like this:
[100*sqrt(NT*200), 10, 10]
Building complex expressions takes a little bit of math to accomplish, but it isn’t difficult to do and the more experience you get with expressions, the easier it becomes. To help get you started, Table 32-6 includes several prebuilt expressions that can be entered into the Expression Controller Interface to get certain motions.
Table 32-6: Sample Expressions
Motion |
Expression |
Variable Description |
|
|
|
Circular motion |
[Radius1 * cos(360*S), |
Where Radius1 is the radius of the orbiting |
|
Radius1 * sin(360*S), 0] |
path. |
Elliptical motion |
[Radius1 * cos(360*S), |
Where Radius1 and Radius2 are the radii of |
|
Radius2 * sin(360*S), 0] |
the elliptical path. |
Continued