Chapter 12. Maya Dynamics and Effects

Autodesk's Maya is renowned for creating special effects animations that simulate not only physical phenomena, such as smoke and fire, but also the natural movements of colliding bodies. Behind that latter type of animation is the Maya dynamics engine, which is the sophisticated software that creates realistic-looking motion based on the principles of physics.

Another powerful Maya animation tool, Paint Effects, can create dynamic fields of grass and flowers, a head full of hair, and other such systems in a matter of minutes. Maya Unlimited also offers dynamic simulations for hair, fur, and cloth. In this chapter, we will cover the basics of dynamics in Maya and let you practice working with particles right away by making steam.

Topics in this chapter include:

  • An Overview of Dynamics and Maya Nucleus

  • Rigid and Soft Dynamic Bodies

  • Animating with Dynamics: The Pool Table

  • nParticle Dynamics

  • Emitting nParticles

  • Animating an nParticle Effect: Locomotive Steam

  • Introduction to Paint Effects

  • Where Do You Go from Here?

An Overview of Dynamics and Maya Nucleus

Dynamics is the simulation of motion through the application of the principles of physics. Rather than assigning keyframes to objects to animate them, with Maya dynamics you assign physical characteristics that define how an object behaves in a simulated world. You create the objects as usual in Maya, and then you convert them to dynamic bodies. Dynamic bodies are defined through the dynamic attributes, which affect how the objects behave in a dynamic simulation, that you've added to them.

Dynamic bodies are affected by external forces called fields, which exert a force on them to create motion. Fields can range from wind forces to gravity and can have their own specific effects on dynamic bodies. You'll learn how to use fields later in this chapter.

In Maya, dynamic objects are categorized as bodies, particles, hair, and fluids. Dynamic bodies are created from geometric surfaces and are used for physical objects such as bouncing balls. Particles are merely points in space with renderable properties that behave dynamically. Particles are used for numerous effects, such as fire and smoke, but they're also useful in tons of other situations and, as such, are a specialty of their own for professional animators. Particle basics will be covered in the latter half of this chapter. Hair consists of curves that behave dynamically, such as strings. Fluids, available only in Maya Unlimited, are, in essence, volumetric particles that can exhibit surface properties. Fluid dynamics can be used for natural effects such as billowing clouds or plumes of smoke.

Nucleus, which was introduced in Maya 8.5 with nCloth, is a more stable way of calculating dynamic simulations in Maya than its traditional dynamics engine. Nucleus speeds up the creation and increases the stability of some dynamic effects in Maya, including particle effects and cloth simulation (through nCloth).

In Maya 2009, Autodesk has introduced nParticles, which are closely related to traditional particles in Maya, but have been made somewhat easier to create and manage, requiring far less explicit expression controls than before.

We will introduce nParticles (instead of traditional particles) later in this chapter; however, soft bodies, hair, nCloth, and fluid dynamics are advanced topics and will not be covered in this book.

Rigid and Soft Dynamic Bodies

The two types of dynamic bodies are rigid and soft. Rigid bodies are solid objects, such as a pair of dice or a baseball, that move and rotate according to the dynamics applied. Fields and collisions affect the entire object and move it accordingly. Soft bodies are malleable surfaces that deform dynamically, such as drapes in the wind or a bouncing rubber ball. In brief, this is accomplished by making the surface points (NURBS, CVs, or polygon vertices) of the soft body object dynamic instead of the whole object. The forces and collisions of the scene affect these surface points, making them move to deform their surface.

In this section, you'll learn about rigid body dynamics.

Creating Active and Passive Rigid Body Objects

Any surface geometry in Maya can be converted to a rigid body. Once converted, that surface can respond to the effects of fields and take part in collisions. When one Maya object hits another in a dynamic simulation, Maya calculates the animation of the colliding objects according to their velocity and other dynamic properties such as mass. Sounds like fun, eh?

The two types of rigid bodies are active and passive. An active rigid body is affected by collisions and fields. A passive rigid body is not affected by fields and remains still when it collides with another object. A passive rigid body is solely used as a surface against which active rigid bodies collide.

The best way to see how the two types of rigid bodies behave is to create some and animate them. In this section, you will do that in the classic animation exercise of a bouncing ball.

To create a bouncing ball using Maya rigid bodies, switch to the Dynamics menu and follow these steps:

  1. Create a polygonal plane and scale it to be a ground surface.

    Place a poly sphere a few units above a poly plane ground surface.

    Figure 12.1. Place a poly sphere a few units above a poly plane ground surface.

  2. Create a poly sphere and position it a number of units above the ground, as shown in Figure 12.1.

  3. Switch to the Dynamics menu (choose Dynamics from the Status Line drop-down bar). Select the poly sphere, and choose Soft/Rigid Bodies → Create Active Rigid Body. The sphere's Translate and Rotate attributes will turn yellow. There will be a dynamic input for those attributes and, as such, you cannot set keyframes on any of them. The dynamics engine drives the movement and rotation of the active rigid body sphere.

  4. Select the ground plane, and choose Soft/Rigid Bodies → Create Passive Rigid Body. This will set the poly plane as a passive rigid body to serve as the floor on which to bounce your active rigid ball. For this exercise, stick with the default settings and ignore the various creation options and Rigid Body attributes; you'll explore the most important of those later in this chapter.

  5. To put the ball into motion, you need to create a field to affect it. Select the sphere, and choose Fields → Gravity. By selecting the active rigid object(s) while you create the field, you connect that field to the objects automatically. Fields affect only the active rigid bodies to which they are connected. If you hadn't established this connection initially, you could still do so later, through the Dynamic Relationships Editor. You'll find out more about this process later in this chapter.

Note

If you try to scrub the Timeline, you will notice that the animation does not run properly. Because Dynamics simulates physics, no keyframes are set. You must play the scene from start to finish for the calculations to execute properly. You must also play the scene using the Play Every Frame option. Click the Animation Options button to the right of the Range slider, or choose Window → Settings/Preferences → Preferences. In the Preferences window, choose Time Slider under the Settings header. Choose Play Every Frame from the Playback Speed menu. You can also set the maximum frames per second that your scene will play back by setting the Max Playback Speed attribute.

To play back the simulation, set your frame range from 1 to at least 500. Go to frame 1 and click Play. Make sure you have the proper Playback Speed settings in your Preferences window; otherwise, the simulation will not play properly.

When the simulation plays, you'll notice that the sphere begins to fall after a few frames and collides with the ground plane, bouncing back up.

As an experiment, try turning the passive body plane into an active body using the following steps:

  1. Select the plane and open the Attribute Editor.

  2. In the rigidBody 2 tab, click the Active check box to turn it on. This will switch the plane from a passive body to an active body.

  3. Play the simulation and you'll see the ball fall to hit the plane and knock it away. Because the plane is now an active body, it will be moved by collisions. Because it was not connected to the gravity field, however, it does not fall with the ball.

To connect the now active body plane to the gravity field, open the Dynamic Relationships window, which is shown in Figure 12.2 (choose Window → Relationship Editors → Dynamic Relationships).

Note

You can also connect a dynamic object to a field by selecting the dynamic object or objects and then the desired field by choosing Fields → Affect Selected Object(s). This method is more useful for connecting multiple dynamic objects to a field.

The Dynamic Relationships window

Figure 12.2. The Dynamic Relationships window

On the left is an Outliner list of the objects in your scene. On the right is a listing where you can choose which category of objects to list: Fields (default), Collisions, Emitters, or All. Select the geometry (pPlane1) on the left side, and then connect it to the gravity field by selecting the gravityField1 node on the right.

Once you connect the gravity field to the plane and run the simulation, you will see the plane fall away with the ball. Because the two fall at the same rate (the rate set by the single gravity field), they will not collide. To disconnect the plane from the gravity field, deselect the gravity field in the right panel.

Turning the active body plane back to a passive floor is as simple as returning to frame 1, the beginning of the simulation, and clearing the Active attribute in the Attribute Editor. By turning the active body back to a passive body, you regain an immovable floor upon which the ball can collide and bounce.

Moving a Rigid Body

Because Maya's dynamics engine controls the movement of any active rigid bodies, you cannot set keyframes on their translation or rotation. With a passive object, however, you can set keyframes on translation and rotation as you can with any other Maya object. Because the object is not active, the dynamics engine does not regulate its movement with fields or collisions. You can easily keyframe an object to be either active or passive, however, for the widest of options.

Now, any movement that the passive body has through regular keyframe animation is translated into momentum, which is passed on to any active rigid bodies with which the passive body collides. Think of a baseball bat that strikes a baseball. The baseball bat is a passive rigid body that you have keyframed to swing. The baseball is an active rigid body that is hit by (collides with) the bat as it swings. The momentum of the bat is transferred to the ball, and the ball is sent flying into the stadium stands.

You'll see an example of this in action in the next tutorial.

Rigid Body Attributes

What makes an object a rigid body is the addition of several attributes that help govern how it behaves in a dynamic simulation. Here is a rundown of the more important attributes for both passive and active rigid bodies as they pertain to collisions.

Mass

Sets the relative mass of the rigid body. Set on active or passive rigid bodies, mass is a factor in how much momentum is transferred from one object to another. A more massive object will push a less massive one with less effort and will itself be less prone to movement when hit. Mass is relative, so if all rigid bodies have the same mass value, there is no difference in the simulation.

Static and Dynamic Friction Sliders

Set how much friction the rigid body has while at rest (static) and while in motion (dynamic). Friction specifies how much the object resists moving or being moved. A friction of 0 makes the rigid body move freely, as if on ice.

Bounciness

Specifies how resilient the body is upon collision. The higher the bounciness value, the more bounce the object will have upon collision.

Damping

Creates a drag on the object in dynamic motion so that it will slow down over time. The higher the damping, the more the body's motion diminishes.

Animating with Dynamics: The Pool Table

This exercise will take you through the creation of a simple scene in which you will use dynamics to animate a cue ball striking two balls on a pool table.

Creating the Pool Table and the Balls

You will create a simple pool table as a collision surface for the pool balls. To create the table, follow these steps:

  1. Create a polygonal plane for the surface of the table. Scale it to 10 along its height and length.

  2. To create the pocket holes, you'll make two simple holes in opposite corners. The easiest way is to duplicate the tabletop plane and offset it slightly in both directions, as shown in Figure 12.3. This will create a pair of square holes in the corners for the ball to drop through. For this exercise, it will do perfectly well.

  3. Create a polygonal cube, and scale it to fit one edge of the plane to create a rail. Duplicate the cube three times, and then move and rotate the pieces to create the rails around the table, as shown in Figure 12.4.

  4. Create three poly spheres and then scale and place them as shown. It is important to place them slightly above the pool table surface. Although it's not imperative to have the exact location shown in Figure 12.5, it's a good idea to get rather close to the layout shown.

    Duplicate the tabletop plane and offset it slightly in both directions.

    Figure 12.3. Duplicate the tabletop plane and offset it slightly in both directions.

    A simple pool table

    Figure 12.4. A simple pool table

    Scaling and placing the three spheres

    Figure 12.5. Scaling and placing the three spheres

    The pool balls in texture view

    Figure 12.6. The pool balls in texture view

  5. Shade your pool balls to make each one different. The figures in this exercise show a solid white ball, a striped ball (it will be yellow on your screen), and a black eight ball, as shown in Figure 12.6.

The spheres are placed a bit over the table surface so that their geometries' surfaces are not accidentally crossing each other, an effect known as interpenetrating. When surfaces interpenetrate, the dynamics that result will usually be as welcome as sand in your eyes. Starting all colliding rigid bodies a little bit away from each other should guarantee that their surfaces do not interpenetrate. Using the simple pool table that we've set up will make the dynamics calculations quick and easy.

The pool balls in texture view

Use the file Table_v1.mb in the Scenes folder of the Pool_Table project on the CD as a reference or to catch up to this point.

Creating Rigid Bodies

Define the pool table as a passive rigid body and define the pool balls as active rigid bodies. Follow these steps:

  1. Select the two planes that make up the tabletop and the four cubes that are the side rails. Choose Soft/Rigid Bodies → Create Passive Rigid Body.

  2. Select the three balls, and choose Soft/Rigid Bodies → Create Active Rigid Body to make them active rigid bodies.

  3. With all three pool balls selected, create a gravity field by choosing Fields → Gravity. The gravity field will automatically connect to all three balls.

  4. Run the simulation and you should see the balls fall slightly onto the tabletop. Check to see that none of them interpenetrate the table surface. If any of them do, Maya will select the offending geometry and display an error message in the Command Feedback line, turning it red.

Animating Rigid Bodies

If you need to, enable texture view in your view panel by pressing 6.

The next step is to put the cue ball (the white sphere) into motion so that it hits the striped ball into the black eight ball to sink it into the corner pocket. The easiest way to do this is to keyframe the cue ball's translation from its starting point to hit into the striped ball. However, because active rigid bodies cannot be keyframed, you have to turn the cue ball into a passive rigid body. To do that, follow these steps:

  1. Select the cue ball (the white ball). Notice the Active attribute in the Channel box. (You may have to scroll down; it's at the bottom.) It is set to On.

  2. Rewind your animation to the first frame. Choose Soft/Rigid Bodies → Set Passive Key. Notice that the Active attribute has turned a dark yellow. You have set a keyframe for the active state of the cue ball, and it now says Off. You can toggle rigid bodies between passive and active. Maya has also set translation and rotation keyframes for the cue ball.

  3. Go to frame 10. Move the cue ball with the Translate tool so that its outer surface slightly passes through the yellow-striped ball, as shown in Figure 12.7. Choose Soft/Rigid Bodies → Set Passive Key.

  4. Go to frame 11 and choose Soft/Rigid Bodies → Set Active Key. This will turn the cue ball back into an active rigid body in the frame after it strikes the striped ball.

By animating the ball as a passive rigid body, keyframing its translation and then turning it back to active, you set the dynamic simulation in motion. The cue ball animates from its starting position and hits the striped ball. Maya's dynamics engine calculates the collisions on that ball and sets it into motion; it then strikes the black eight ball, which should roll into the corner pocket. The dynamics engine, at frame 11, also calculates the movement of the cue ball after it strikes the striped ball, so you do not have to animate its ricochet.

Move the cue ball with the Translate tool.

Figure 12.7. Move the cue ball with the Translate tool.

Go to the start frame and play back the simulation. The cue ball knocks the striped ball into the eight ball. The eight ball rolls into the corner, and the striped ball bounces off to the right. If the eight ball does not go into the corner, you will have to edit your cue ball's keyframes to hit the striped ball at the correct angle to hit the eight ball into the corner pocket.

At the current settings, however, the eight ball bounces out of the corner without falling through the hole. You need to control the bounciness of the collisions:

  1. Go back to the first frame. Select all three balls. In the Channel box, change the Bounciness attribute from 0.6 to 0.2. Once you set the attribute value in the Channel box, Maya will set the value for all three spheres concurrently.

    Note

    Changing the Bounciness attribute through the Attribute Editor changes the value for only one sphere even when they are all selected. You will have to change the value for each sphere individually in the Attribute Editor. This is true for all values changed on multiple objects through the Attribute Editor.

  2. Play back the animation, and you will see that the balls do not ricochet off each other and the sides of the pool table with as much spring. The eight ball should now fall through the hole. (See Figure 12.8.) You may need to increase your frame range if your ball doesn't quite make it by frame 120. Try 200 frames instead.

    Move the cue ball with the Translate tool.

    You can load the scene file Table_v2.mb from the Pool_Table project on the CD to compare your work.

    The eight ball falls through the hole.

    Figure 12.8. The eight ball falls through the hole.

Additional Rigid Body Attributes

In addition, while using the pool table setup without any animation, try playing with the rigid body attributes to see how they affect the rigid body in question. Some of these attributes are defined here:

Initial Velocity

Gives the rigid body an initial "push" to move it in the corresponding axis.

Initial Spin

Gives the rigid body object an initial twist to start the rotation of the object in that axis.

Impulse Position

Gives the object a constant push in that axis. The effect is cumulative; the object will accelerate if the impulse is not turned off.

Spin Impulse

Rotates the object constantly in the desired axis. The spin will accelerate if the impulse is not turned off.

Center of Mass (0,0,0)

Places the center of the object's mass at its pivot point, typically at its geometric center. This value offsets the center of mass, so the rigid body object behaves as if its center of balance is offset, like trick dice or a top-weighted ball.

Creating animation with rigid bodies is straightforward and can go a long way toward creating natural-looking motion for your scene. Integrating such animation into a final project can become fairly complicated though, so it's prudent to become familiar with the workings of rigid body dynamics before relying on that sort of workflow for an animated project. You'll find most professionals use rigid body dynamics as a springboard to create realistic motion for their projects. The dynamics are often converted to keyframes and further tweaked by the animator to fit into a larger scene.

Here are a few suggestions for scenes using rigid body dynamics:

Bowling Lane

The bowling ball is keyframed as a passive object until it hits the active rigid pins at the end of the lane. This scene is simple to create and manipulate.

Dice

Active rigid dice are thrown into a passive rigid craps table. This exercise challenges your dynamics abilities as well as your modeling skills if you create an accurate craps table.

Game of Marbles

This scene challenges your texturing and rendering abilities as well as your dynamics abilities.

Baking Out a Simulation

Frequently, a dynamic simulation is created to fit into another scene, perhaps to interact with other objects and such. In instances such as this, you want to exchange the dynamic properties of the dynamic body you have set up in a simulation for regular, good old-fashioned animation curves that you can edit along with the rest of the animated scene, if need be. You can easily take a simulation that you've created and bake it out to curves. As much fun as it is to think of cupcakes, baking is a somewhat catchall term used to describe converting one type of action or procedure into another; in this case, we're baking dynamics into keyframes.

We will take the simulation we set up with the pool balls earlier and turn them into keyframes to give you a quick idea of how it can be done and the curves that you will get. Dynamics is a deep layer of Maya, and there is a lot to learn about it. Keep in mind you can use this introduction as a foundation for your own explorations.

To bake out the rigid body simulation of the pool balls, follow these steps:

Baking Out a Simulation
  1. Open the scene file Table_v2.mb from the Pool_Table project on the CD or, if you prefer, open your scene from the previous exercise. We will bake out the motion of all three pool balls on the table to see their keyframes.

  2. Because the simulation is already set up and working to our liking, we can jump right to it. Select all three pool balls, and choose Edit → Keys → Bake Simulation

    Baking Out a Simulation
  3. Set Hierarchy to Selected, and set Channels to From Channel Box. This ensures that we have control over which keys are created. Make sure that Keep Unbaked Keys and Disable Implicit Control are checked and that Sparse Curve Bake is turned off. Before clicking the Bake or Apply button, select the Translate and Rotate channels in the Channel box. Click Bake.

  4. Maya will run through the simulation. Scrub the Timeline back and forth. Notice how the pool balls are moving around normally as if the dynamic simulation were running, except you can scrub in the Timeline, which you cannot do with a dynamics simulation. If you open the Graph Editor, you will see something similar to Figure 12.10.

    The Bake Simulation Options window

    Figure 12.9. The Bake Simulation Options window

    The pool balls have animation curves.

    Figure 12.10. The pool balls have animation curves.

  5. The curves, however, are crowded; they have keyframes at every frame. A typical dynamics bake will give you results like this. We can, however, set the Bake command to sparse the curves for us; that is, it can take out keyframes at frames that have values within a certain tolerance, so that a minor change in the ball's position or rotation need not have a keyframe on the curve.

  6. Let's go back in time and try this again. Press Z (Undo) until you back up to right before we baked out the simulation to curves. You can also just close this scene and reopen it from the original project if necessary. This time, select the balls and choose Edit → Keys → Bake Simulation

    The pool balls have animation curves.
  7. Maya will run through the simulation again and bake everything out to curves, this time making a sparser animation curve for each channel because it is looking at five-frame intervals, as shown in Figure 12.11. If you open the Graph Editor, you will notice that the curves are much friendlier to look at and edit.

Sampling by fives may give you an easier curve to edit, but it can overly simplify the animation of your objects; so make sure to use the best Sampling setting for your simulation when you need to convert it to curves for editing.

Sampling by fives makes a cleaner curve.

Figure 12.11. Sampling by fives makes a cleaner curve.

Simplifying Animation Curves

Despite a higher Sampling setting when you bake out the simulation, you can still be left with a lot of keyframes to deal with, especially if you have to modify the animation extensively from here. One last trick we can use is to simplify the curve further through the Graph Editor itself. We will have to work with curves of the same relative size, so we will start with the rotation curves, because they have larger values. To keep things simple, let's just deal with one ball: the black eight ball. To simplify the curve in the Graph Editor, follow these steps:

  1. Select the black eight ball and open the Graph Editor. In the left Outliner side of the Graph Editor, select Rotate.X, Rotate.Y, and Rotate.Z to display only these curves in the graph view. Figure 12.12 shows the curves.

  2. In the left panel of the Graph Editor, select the rigidBody_rx8.Input(1) nodes displayed right under the Rotate X, Y, and Z entries for all three curves as shown in Figure 12.13. In the Graph Editor menu, choose Curves → Simplify Curve

    Simplifying Animation Curves
    The Graph Editor displays the rotation curves of the eight ball.

    Figure 12.12. The Graph Editor displays the rotation curves of the eight ball.

    Select the curves to simplify them.

    Figure 12.13. Select the curves to simplify them.

    A simplified curve for the rotations of the eight ball

    Figure 12.14. A simplified curve for the rotations of the eight ball

  3. Click Simplify, and you will see that the curve retains its basic shape but loses some of the unneeded keyframes. Figure 12.14 shows the simplified curve, which differs little from the original curve with keys at every five frames.

Simplifying curves is a handy way to convert a dynamic simulation to curves. But you can also use this method to simplify other animation curves to make it easier to edit them as you animate the scene. Keep in mind, however, that you may lose fidelity to the original animation once you simplify a curve, so use it with care.

With this methodology, you could bake out the animation of any simulation, from dynamics (as we just did) to constraints and some scripts. The curve simplification works with good old-fashioned keyframed curves as well, so if you inherit a scene from another animator and need to simplify the curves, do it just as we did here.

nParticle Dynamics

Like rigid body objects, particles are moved dynamically using collisions and fields. In short, a particle is a point in space that is given renderable properties—that is, it can render out. When particles are used en masse, they can create effects such as smoke, a swarm of insects, fireworks, and so on. nParticles are an implementation of particles through the Maya Nucleus solver, which provides better and easier simulations than traditional Maya particles.

Although particles (and nParticles) can be an advanced and involved aspect of Maya, it is important to have some exposure to them as you begin to learn Maya.

Much of what you learned about rigid body dynamics transfers to particles. However, it is important to think of particle animation as manipulating a larger system rather than as controlling every single particle in the simulation. You control fields and dynamic attributes to govern the motion of the system as a whole.

For example, with the pool table you control the motion of the cue ball and let Maya dynamics calculate the motion of the other balls after they collide. Each ball is a distinct part of the scene and renders out as a distinct object in the frame. Particles are most often used together in large numbers so that the entirety is rendered out to create an effect. To control a particle system, you'll create an emitter and define fields and attributes that control the particles' movement.

Emitting nParticles

Typical work flow for creating an nParticle effect in Maya breaks out into two parts: motion and rendering. First, you create and define the behavior of particles through emission. An emitter is a Maya object that creates the particles themselves. After creating fields and adjusting particle behavior within a dynamic simulation, much as you would do with rigid body motion, you give the particles renderable qualities to define how they look. This second aspect of the workflow defines how the particles "come together" to create the desired effect, such as steam. You will make a steaming locomotive pump later in this chapter.

Creation options for an nParticle emitter

Figure 12.15. Creation options for an nParticle emitter

To create an nParticle system, follow these steps:

  1. Make sure you are in the nDynamics menu, and then choose nParticles → Create nParticles and check Cloud to turn it on. Then choose nParticles → Create nParticles → Create Emitter

    Creation options for an nParticle emitter

    The default settings will create an Omni emitter with a rate of 100 particles per second and a speed of 1.0. Click Create. A small round object (the emitter) will appear at the origin.

  2. Click the Play button to play the scene. As with rigid body dynamics, you must also play back the scene using the Play Every Frame option. You cannot scrub or reverse play particles unless you create a cache file. You will learn how to create a particle disk cache later in this chapter. But for the most part, particles need to be played back to run properly.

You will notice a mass of round circles stream out of the emitter in all directions (see Figure 12.16). These are the nParticles themselves.

An Omni emitter emits a swarm of cloud particles in all directions.

Figure 12.16. An Omni emitter emits a swarm of cloud particles in all directions.

Emitter Attributes

You can control how particles are created and behave by changing the type of emitter and adjusting its attributes. Here are the most often used emitters:

Cloud nParticles sprayed in a specific direction

Figure 12.17. Cloud nParticles sprayed in a specific direction

Omni

Emits particles in all directions.

Directional

Emits a spray of particles in a specific direction, as shown in Figure 12.17.

Volume

Emits particles from within a specified volume, as shown in Figure 12.18. The volume can be a cube, a sphere, a cylinder, a cone, or a torus. By default, the particles can leave the perimeter of the volume.

Cloud nParticles emit from anywhere inside the emitter's volume.

Figure 12.18. Cloud nParticles emit from anywhere inside the emitter's volume.

After you create an emitter, its attributes govern how the particles are released into the scene. Every emitter has the following attributes to control the emission:

Rate

Governs how many particles are emitted per second.

Speed

Specifies how fast the particles move out from the emitter.

Speed Random

Randomizes the speed of the particles as they are emitted for a more natural look.

Min/Max Distance

Emits particles within an offset distance from the emitter itself. You enter values for the Min and Max Distance setting. Figure 12.19 shows a Directional emitter with a Min and Max Distance setting of 3.

An emitter with a Min and Max Distance setting of 3 emits Cloud nParticles three units from itself.

Figure 12.19. An emitter with a Min and Max Distance setting of 3 emits Cloud nParticles three units from itself.

nParticle Attributes

Once created (or born) and set into motion by an emitter, nParticles rely on their own attributes and any fields or collisions in the scene to govern their motion, just like rigid body objects.

nParticle attributes

Figure 12.20. nParticle attributes

In Figure 12.20, the Attribute Editor shows a number of tabs for the selected particle object. Particle1 is the particle object node. This has the familiar Translate, Rotate, and Scale attributes, like most other object nodes. The shape node, however, particleShape1, is where all the important attributes are for a particle, and it is displayed by default when selecting a particle object. The third tab in the Attribute Editor is the emitter1 node that belongs to the particle's emitter. This makes it easier to toggle back and forth to adjust emitter and particle settings.

The Lifespan Attributes

When any particle is created, or born, you can give it a lifespan, which allows the particle to die when it reaches a certain point in time. Giving particles a lifespan is a good idea for a variety of reasons. As you'll see with the steaming locomotive later in the chapter, a particle that has a lifespan can change over its lifespan. For example, a particle might start out as white and fade away at the end of its life. A lifespan also helps keep the total number of particles in a scene to a minimum, which helps the scene run more efficiently.

You use the Lifespan mode to select the type of lifespan for the nParticle:

Live Forever

The particles in the scene can exist indefinitely.

Constant

All particles die when their Lifespan value is reached. Lifespan is measured in seconds, so upon emission, a particle with a Lifespan of 1.0 will exist for 30 frames (in a scene set up at 30fps) before it disappears.

Random Range

This type sets a lifespan in Constant mode but assigns a range value via the Lifespan Random attribute to allow some particles to live longer than others for a more natural effect.

LifespanPP Only

This mode is used in conjunction with expressions that are programmed into the particle with MEL (Maya Embedded Language). Expressions are an advanced Maya concept and are not used in this book.

The Shading Attributes

The Shading attributes determine how your particles look and how they will render. Two types of particle rendering are used in Maya: software and hardware. Hardware particles are typically rendered out separately from anything else in the scene and are then composited with the rest of the scene. Because of this compound work flow for hardware particles, this book will introduce you to a software particle called Cloud. Cloud, like other software particles, can be rendered with the rest of a scene through the software renderer.

The Particle Render Type drop-down menu

Figure 12.21. The Particle Render Type drop-down menu

With your particles selected, open the Attribute Editor. In the Shading section, you will find the Particle Render Type drop-down menu (Figure 12.21).

The three render types listed with the (s/w) suffix are software-rendered particles. All the other types can be rendered only through the hardware renderer. Select your render type and Maya adds the proper attributes you'll need for the render type you selected.

For example, if you select the Points render type from the menu, your particles change from circles on the screen to dots, as shown in Figure 12.22.

Dots on the screen represent the Point particles.

Figure 12.22. Dots on the screen represent the Point particles.

Each Particle Render Type displays its own set of attributes.

Figure 12.23. Each Particle Render Type displays its own set of attributes.

Several new attributes that control the look of the particles will appear when you switch the Particle Render Type. Each Particle Render Type has its own set of render attributes. Set your nParticles back to the Cloud type. The Cloud particle type attributes are Threshold, Surface Shading, and Opacity. (See Figure 12.23.)

In the Shading heading, shown in Figure 12.24 for our Cloud nParticles, are controls for the Opacity Scale, Color, and Incandescence attributes. They control how the particles look when simulated and rendered. Notice how each of these controls is based on ramps.

nParticles are already set up to allow you to control the color, opacity, and incandescence during the life of the particle. For example, by default, the Color attribute is set up with a white to cyan ramp. This means that each of the particles will begin life white in color and will gradually turn cyan toward the end of its lifespan, or Age.

Likewise, in the Particle Size heading in the Attribute Editor, is a ramp for Radius Scale that works much the same way as the Color attribute just described. In this case, you will use the Radius Scale ramp to increase or decrease the size of the particle along its Age.

Controls for Opacity Scale, Color, and Incandescence attributes

Figure 12.24. Controls for Opacity Scale, Color, and Incandescence attributes

nCaching Particles

It would be nice to turn particles into cash, but I can only show you how to turn your particles into a cache instead. You can cache the motion of your particles to memory or to disk to make playback and editing of your particle animation easier. To cache particles to your system's fast RAM memory, select the nParticle object you want to cache and open the Attribute Editor. In the Caching section, under Memory Caching, check the Cache Data box. Play back your scene and the particles will cache into your memory for faster playback. You can also scrub your Timeline to see your particle animation. If you make changes to your animation, the scene will not reflect the changes until you delete the cache from memory by selecting the particle object and unchecking the Memory Cache check box in the Attribute Editor. The amount of information the memory cache can hold depends on the system RAM of your machine.

Although memory caching is generally faster than disk caching, creating a disk cache lets you cache all the particles as they exist throughout their duration in your scene and ensures that the particles are rendered correctly, especially if you are rendering on multiple computers or across a network. You should create a particle disk cache before rendering.

Note

If you make changes to your particle simulation but you do not see the changes reflected when you play back the scene, make sure you have turned off any memory or deleted any disk cache from previous versions of the simulation.

Creating an nCache on Disk

Once you have created a particle scene, and you want to be able to scrub the Timeline back and forth to see your particle motion and how it acts in the scene, you can create a particle nCache to disk. This lets you play back the entire scene as you like, without running the simulation from the start and by every frame.

To create an nCache, switch to the nDynamics menu, select the nParticle object, and choose nCache → Create New Cache. Maya will run the simulation according to the Timeline and save the position of all the particle systems in the scene to cache files in your current project's datacache folder. You can then play or even scrub your animation back and forth and the particles will run properly.

If you make any dynamics changes to the particles, such as emission rate or speed, you will need to detach the cache file from the scene for the changes to take effect. Choose nCache → Delete Cache. You can open the option box to select if you wish to delete the cache files physically or merely detach them from the current nParticles.

Now that you understand the basics of particle dynamics, it's time to see for yourself how they work.

Animating a Particle Effect: Locomotive Steam

You will create a spray of steam puffing out of the steam pump on the side of the locomotive that drives the wheels on the model you started creating in Chapter 4, "Beginning Polygonal Modeling," and Chapter 5, "Modeling with NURBS, Subdivisions, and Deformers." We'll use the more detailed locomotive model from Chapters 8, "Introduction to Animation," and 9, "More Animation!"

Emitting the nParticles

The first step is to create an emitter to spray from the steam pump and to set up the motion and behavior of the nParticles:

  1. In the nDynamics menu, choose nParticles → Create nParticles → Create Emitter

    Emitting the nParticles
  2. To set up the emission in the proper direction, adjust the attributes of the emitter. In the Distance/Direction Attributes section, set Direction Y to 0, Direction X to 0, and Direction Z to 1. This emits the particles straight out of the pump over that first large wheel and toward the back of the engine.

    Place the emitter at the end of the pump.

    Figure 12.25. Place the emitter at the end of the pump.

    Note

    The Direction attributes are relative. Entering a value of 1 for Direction X and a value of 2 for Direction Y will make the particles spray at twice the height (Y) of their lateral distance (X).

  3. Play back your scene. You'll see the Cloud nParticles emit in a straight line from the engine, as shown in Figure 12.26.

    Place the emitter at the end of the pump.

    You can load the file Locomotive_Steam_v1.ma from the Locomotive project on the CD to check your work.

    Cloud nParticles emit in a straight line from the pump.

    Figure 12.26. Cloud nParticles emit in a straight line from the pump.

  4. To change the particle emission to more of a spray, adjust the Spread attribute for the emitter. Click the emitter1 tab in the particle's Attribute Editor (or select the emitter to focus the Attribute Editor on it instead), and change Spread from 0 to 0.30. Figure 12.27 shows the new cloud spray.

    Note

    The Spread attribute sets the cone angle for a directional emission. A value of 0 results in a thin line of particles. A value of 1 emits particles in a 180-degree arc.

  5. The emission is rather slow for hot steam being pumped out as the locomotive drives the wheels, so change the Speed setting for the emitter from 1 to 2.0, and change Speed Random from 0 to 1. This will create a random speed range between 1 and 3 for each particle. These two attributes are found in the emitter's Attribute Editor in the Basic Emission Speed Attributes section.

  6. So that all the steam does not emit from the same point, keep the emitter's Min Distance at 0 but set its Max Distance to 0.3. This will create a range of offset between 0 and 0.3 units for the particle to emit from, as shown in Figure 12.28.

    The emitter's Spread attribute widens the spray of particles.

    Figure 12.27. The emitter's Spread attribute widens the spray of particles.

    A range of offset between 0 and 0.3 units creates a more believable emission.

    Figure 12.28. A range of offset between 0 and 0.3 units creates a more believable emission.

Setting nParticle Attributes

It's always good to get the particles moving as closely to what you need as possible before you tend to their look. Now that you have the particles emitting properly from the steam pump, you'll adjust the nParticle attributes. Start by setting a lifespan for them and then add rendering attributes:

The initial radius settings for the steam nParticles

Figure 12.29. The initial radius settings for the steam nParticles

  1. Select the nParticle object and open the Attribute Editor. In the Lifespan section, set the Lifespan Mode to Random Range. Set Lifespan to 2 and Lifespan Random to 1. This will create a range of 1 to 3 for each particle's lifespan. (This is based on a lifespan of 3, plus or minus a random value from 0 to 1.)

  2. You will control the radius of the particles as they are emitted from the pump. Under the Particle Size heading in the Attribute Editor, set a Radius attribute of 0.50. Set the Radius Scale Randomize attribute to 0.25. This allows you to have particles that emit with a radius range between 0.25 and 0.75. Figure 12.29 shows the attributes.

  3. If you play back the simulation, you'll see the particles are quite large initially. Because steam expands as it travels, we will need to adjust the size (radius) of our nParticles to make them smaller at birth to grow larger over their lifespan for a good look for your steam.

  4. In the Radius Scale heading in the Attribute Editor, click the arrow to the right of the ramp to open a larger view of the ramp, as shown in Figure 12.30.

    Open the Radius Scale ramp.

    Figure 12.30. Open the Radius Scale ramp.

  5. Click and drag the ramp's first and only handle (an open circle at the very top-left corner of the Ramp window) down to a value of about 0.25, as shown in Figure 12.31. You will notice the particles getting smaller as you adjust the ramp value.

  6. To allow the particles to grow in size, add a second handle to the scale curve by clicking anywhere on that line and dragging to a value of 1.0 and the position shown in Figure 12.32. You will notice the particles toward the end of the spray get larger.

    Decrease the Radius of the nParticles using the Radius Scale ramp

    Figure 12.31. Decrease the Radius of the nParticles using the Radius Scale ramp

    Adjust the Radius Scale ramp to grow the particles.

    Figure 12.32. Adjust the Radius Scale ramp to grow the particles.

    Select the meshes with which the nParticles will collide.

    Figure 12.33. Select the meshes with which the nParticles will collide.

  7. Now let's set up collisions so that the nParticle steam doesn't travel right through the mesh of the locomotive. Select the meshes shown in Figure 12.33 and choose nMesh → Create Passive Collider.

  8. In the Outliner, select the three nRigid nodes that have just been created, and set the Friction attribute in the Channel box to 0.0 from the default of 0.10. Play back your scene, and your particles will now collide with the surface of the locomotive. (See Figure 12.34.)

Select the meshes with which the nParticles will collide.

If you want to check your work, load the file locomotive_steam_v2.ma from the Locomotive project on the CD.

The particles now react very nicely against the side of the locomotive.

Figure 12.34. The particles now react very nicely against the side of the locomotive.

Setting Rendering Attributes

After you define the nParticle movement to your liking, you can create the proper look for them. This means setting and adjusting rendering parameters for the nParticles. Because Maya has several types of particles, the particles are set up according to their type; the following workflow applies only to the Cloud particle type:

  1. Select the nParticle object and open the Attribute Editor. Expand the Shading heading and take a look at the Color ramp. It has, by default, the particles going from white to light blue in color. Click the cyan color's circle handle on top of the ramp. The Selected Color attribute right below the ramp shows the cyan color. Click in the swatch to open the Color Chooser and change the color to a very light gray.

  2. Click the arrow bar to the right of the Opacity Scale ramp to open a larger ramp view. Grab the first handle in the upper left corner and drag it down to a value of 0.12.

  3. The steam needs to be less opaque at its birth, grow more opaque toward the middle of its life, and fade completely away at the end of the particle's life. Click to create new handles to create a curve for the ramp as shown in Figure 12.35. The values for the five ramp handles shown from left to right are 0.12, 0.30, 0.20, 0.08, and 0.

  4. In the Render Settings window, set the Image Size to 640 × 480. In the Maya Software tab, set the Quality to Intermediate Quality. Run the animation and stop it when some steam has been emitted. Render a frame. It should look like Figure 12.36. The steam doesn't travel far enough along the engine; it disappears too soon.

    With the steam nParticles selected, open the Attribute Editor and, in the Radius Scale, set the first handle's value from 0.25 to 0.35 to make the steam particles a bit larger. Immediately below the Opacity Scale ramp is the Input Max slider. Set that value to 1.6.

    Creating an Opacity ramp for the steam

    Figure 12.35. Creating an Opacity ramp for the steam

    The steam seems too short and small.

    Figure 12.36. The steam seems too short and small.

    A better emission, but a bit too solid

    Figure 12.37. A better emission, but a bit too solid

  5. Select the emitter1 tab and change the Spread for the emitter to 0.2. Change the Rate (Particles/Sec) to 200 and the Speed to 3.0. Play back the simulation and render a frame to compare to Figure 12.37.

  6. The Color ramp in the nParticle's Attribute Editor controls the color of the steam, and a shader is assigned to the particles. Select the steam nParticle object and open the Hypershade window. In the Hypershade, click the Graph materials on the selected object's icon (

    A better emission, but a bit too solid
    The shaders assigned to the cloud nParticle

    Figure 12.38. The shaders assigned to the cloud nParticle

  7. In the Hypershade, select the npCloudVolume shader and open the Attribute Editor. Notice that the Common Material Attributes section's attributes all have connections. The ramp controls in the nParticle Attribute Editor are actually controlling the attributes in this Particle Cloud shader.

  8. Under the Transparency heading in the Attribute Editor for the shader, set the Density to 0.35. Try a render and the steam should look a bit better. (See Figure 12.39.)

Batch render a 200-frame sequence of the scene at a lower resolution, such as 320 × 240, to see how the particles look as they animate. (Check the frames with FCheck. Refer to Chapter 11, "Maya Rendering," for more on FCheck.)

The shaders assigned to the cloud nParticle

Load the file locomotive_steam_v3.ma from the Locomotive project on the CD to check your work.

The steam is less flat and solid.

Figure 12.39. The steam is less flat and solid.

Experiment with the steam by animating the Rate attribute of the emitter to make the steam pump out in time with the wheel arm. Also, try animating the Speed values and playing with different values in the Radius and Opacity ramps. The steam you'll get in this tutorial looks pretty good, but it is not as lifelike as it could be. You can do a lot more as you learn more about Maya, but those techniques are beyond the scope of this book. Particle animators are always learning new tricks and expanding their skills, and that comes from always trying new things and retrying the same effects with different methods.

Once you feel comfortable with the Steam exercise, try using the Cloud nParticle to create steam for a mug of coffee. That steam moves much slower and is less defined than the blowing steam of the locomotive and should pose a new challenge. Also try your hand at creating a smoke trail for a rocket ship or a wafting stream of cigarette smoke, or even the billowing smoke coming from the engine's chimney.

Cloud nParticles are the perfect particle type with which to begin. As you feel more comfortable animating with clouds, experiment with the other render types. The more you experiment with all the types of nParticles, the easier they will be to harness. You'll quickly find Maya nParticles can create a wild array of realistic and stylized effects for your animations more easily than traditional Maya particles.

Introduction to Paint Effects

One of the tools in Maya's effects arsenal is a tool called Paint Effects. Using Paint Effects, you can create a field of grass rippling in the wind, a head of hair or feathers, or even a colorful aurora in the sky. Paint Effects is a rendering effect found under the Rendering menu. It has incredible dynamic properties that can make leaves rustle in the wind or trees sway in a storm. Although it does not use the same dynamics engine as particles or rigid bodies, Paint Effects uses its own dynamics calculations to create natural motion. It is one of Maya's most powerful tools, with features that go far beyond the scope of this introductory book. Here you will learn how to create a Paint Effects scene and how to access all the preset brushes to create your own effects.

Paint Effects uses brushes to paint effects into your 3D scene. The brushes create strokes on a surface or in the Maya modeling views that produce tubes , which render out through Maya's software renderer. These Paint Effects tubes have dynamic properties, which means they can move according to their own forces. Therefore, you can easily create a field of blowing grass.

Try This

Create a field of blowing grass and flowers; it will take you all of five minutes.

  1. Start with a new scene file. Maximize the perspective view. (Press the spacebar with the Perspective window active.)

    The preset grass brushes in the Visor window

    Figure 12.40. The preset grass brushes in the Visor window

  2. Switch to the Rendering menu set (press F6). Choose Paint Effects → Get Brush to open the Visor window. The Visor window displays all the preset Paint Effects brushes that automatically create certain effects. Select the Grasses folder in the Visor's left panel to display the grass brushes available (see Figure 12.40). You can navigate the Visor window as you would navigate any other Maya window using the Alt key and the mouse buttons.

  3. Click the grassWindWide.mel brush to activate the Paint Effects tool and set it to this grass brush. Your cursor will change to a Pencil icon.

  4. In the Perspective window, click and drag two lines across the grid, as shown in Figure 12.41, to create two Paint Effects strokes of blowing grass. If you can't see the grass in your view panel, increase the Global Scale in the Paint Effects Brush Settings to see the grass being drawn onto the screen.

    Click and drag two lines across the grid.

    Figure 12.41. Click and drag two lines across the grid.

  5. To change your brush so you can add some flowers between the grass, choose Paint Effects → Get Brush and select the flowers folder. Select the dandelion_Yellow.mel brush. Your Paint Effects tool is now set to paint yellow flowers.

  6. Click and drag a new stroke between the strokes of grass, as shown in Figure 12.42.

  7. Position your camera and render a frame. Make sure you are using Maya Software and not mental ray to render through the Render Settings window and that you use a large enough resolution, such as 640 × 480, so that you can see the details. Render out a 120-frame sequence to see how the grass animates in the wind. Figure 12.43 shows a scene filled with grass strokes as well as a number of different flowers.

    Add new strokes to add flowers to the grass.

    Figure 12.42. Add new strokes to add flowers to the grass.

    Paint Effects can add realistic flowers and grass to any scene.

    Figure 12.43. Paint Effects can add realistic flowers and grass to any scene.

Once you create a Paint Effects stroke, you can edit the look and movement of the effect through the Attribute Editor. You'll notice, however, that there are a large number of attributes to edit with Paint Effects. The next section introduces the attributes that are most useful to the beginning Maya user.

Paint Effects Attributes

It is best to create a single stroke of Paint Effects in a blank scene and experiment with adjusting the various attributes to see how they affect the strokes. Select the stroke and open the Attribute Editor. Switch to the stroke's tab to access the attributes. For example, for an African Lily Paint Effects stroke, the Attribute Editor tab is called africanlily1.

Each Paint Effects stroke produces tubes that render to create the desired effect. Each tube (you can think of a tube as a stalk) can grow to have branches, twigs, leaves, flowers, and buds. Each section of a tube has its own controls to give you the greatest flexibility in creating your effect. As you experiment with Paint Effects, you will begin to understand how each attribute contributes to the final look of the effect.

Here is a summary of some Paint Effects attributes:

Brush Profile

Gives you control over how the tubes are generated from the stroke; this is done with the Brush Width attribute. This will make tubes emit from a wider breadth from the stroke to cover more of an area.

Shading and Tube Shading

Gives you access to the color controls for the tubes on a stroke.

Color1 and Color2

From bottom to top, graduates from Color1 to Color 2 along the stalk only. The leaves and branches have their own color attributes, which you can display by choosing Tubes → Growth.

Incandescence1 and 2

Adds a gradient self-illumination to the tubes.

Transparency1 and 2

Adds a gradient transparency to each tube.

Hue/Sat/Value Rand

Add some randomness to the color of the tubes.

In the Tubes section, you will find all the attributes to control the growth of the Paint Effects effect. In the Creation subsection, you can access the following:

Tubes per Step

Controls the number of tubes along the stroke. For example, this setting will increase or decrease the number of flowers for the africanlily1 stroke.

Length Min/Max

Controls how tall the tubes are grown to make taller flowers or grass (or other effects).

Tube Width1 and Width2

Controls the width of the tubes (the stalks of the flowers).

In the Growth subsection, you can access controls for branches, twigs, leaves, flowers, and buds for the Paint Effects strokes. Each attribute in these sections controls the number, size, and shape of those elements. Although not all Paint Effects strokes create flowers, all strokes contain these headings; some may or may not be active. Each stroke has its own settings.

The Behavior subsection contains the controls for the dynamic forces affecting the tubes in a Paint Effects stroke. Adjust these attributes if you want your flowers to blow more in the wind.

Paint Effects are rendered as a post process, which means they will not render in reflections or refractions as is. They are indeed processed and rendered after every other object in the scene is rendered out. They will, however, play back in the work panels to give you feedback on your dynamic settings.

You can also convert Paint Effects to polygonal surfaces that will render in the scene along with any other objects so that they may indeed take part in reflections and refractions. To convert a Paint Effects stroke to polygons, select the stroke and choose Modify → Convert → Paint Effects to Polygons. The polygon Paint Effects tubes can still be edited by most of the Paint Effects attributes mentioned so far; however, some, such as color, will not affect the poly tubes. Instead, the color information is converted into a shader that is assigned to the polygons. It's best to finalize your Paint Effects strokes before converting to polygons to avoid any confusion.

Paint Effects is a strong Maya tool and you can use it to create complex effects such as a field of blowing flowers. A large number of controls to create a variety of effects come with that complexity. Fortunately, Maya comes with a generous sampling of preset brushes. Experiment with a few brushes and their attributes to see what kinds of effects and strange plants you can create.

Toon Shading

Paint Effects has been developed into a toon-shading system to make your animations render more like traditional cartoons. Using Paint Effects, Maya renders outlines for the objects in your scene, and using a Toon shader, Maya renders the objects in the scene with a flat cartoon-color look. We'll take a quick look at how to apply Toon shading to the wagon scene to make it render like a cartoon next.

Try This

Set your project to the RedWagon project and open the RedWagonModel_v08.ma scene file from the Scenes folder.

  1. You'll see the wagon in a 3/4 view in the persp panel. Select all the parts of the body of the wagon without the railings, as shown in Figure 12.44.

  2. Switch to the Rendering menu set and select Toon → Assign Fill Shader → Shaded Brightness Two Tone. The Attribute Editor will open focused on a Ramp shader, shown in Figure 12.45.

    Select the main body of the wagon, without the wheels or the rails.

    Figure 12.44. Select the main body of the wagon, without the wheels or the rails.

    A Ramp shader is added to the scene and applied to the wagon's body.

    Figure 12.45. A Ramp shader is added to the scene and applied to the wagon's body.

  3. In the Color heading, set the color of the gray part of the ramp to a dark red, and set the white part of the ramp to a bright red. Your wagon should turn red in the persp panel if you are in shaded or texture view. Render a frame and you should see the wagon in only two tones of red, but with gray railings and wheels (shown in grayscale in Figure 12.46).

  4. Select the rail objects and select Toon → Assign Fill Shader → Shaded Brightness Two Tone to create another Toon shader. Set the colors to a dark tan and a bright tan color in the Color ramp.

  5. Select the handlebar and all four wheels and create another two-tone fill shader with a gray and white Color ramp (which is the default).

  6. The frame, railings, and wheels now have a Toon shader as well. Notice the wheels in Figure 12.47 and how cool they look when toon shaded. Of course, adjust any of the colors to your liking.

  7. Now for the toon outlines. Select all the parts of the wagon, and select Toon → Assign Outline → Add New Toon Outline. A black outline appears around the outside of the wagon's parts and a new node called pfxToon1 appears in the Outliner or Hypergraph. The outlining is accomplished with Paint Effects.

  8. Before you render a frame, let's set the background to white to make the black toon outlines pop. Select the persp camera and open the Attribute Editor. Under the Environment heading, set the Background Color to white.

  9. Open the Render Settings window and set the renderer to Maya Software. Render a frame and compare to Figure 12.48. The outlines are too thick!

    The wagon now has a toon-shaded body. The front side of the wagon is a darker red than the front, due to the lighting in the scene.

    Figure 12.46. The wagon now has a toon-shaded body. The front side of the wagon is a darker red than the front, due to the lighting in the scene.

    The wagon has Toon shaders for the fill color applied.

    Figure 12.47. The wagon has Toon shaders for the fill color applied.

    Note

    mental ray does not render Paint Effects by default. You will have to render with Maya Software rendering to be able to see Paint Effects strokes. To see Paint Effects with mental ray, you will have to convert the paint effects to polygons, a procedure not covered in this introductory text.

    The black outlines are applied, but they are too thick.

    Figure 12.48. The black outlines are applied, but they are too thick.

    The cartoon wagon!

    Figure 12.49. The cartoon wagon!

  10. Select the pfxToon1 node in the Outliner and open the Attribute Editor window. Click on the pfxToonShape1 tab to open the attributes for the outlines. Set the Line Width attribute to 0.03 and render a frame. Compare to Figure 12.49.

You can adjust the colors and the ramps of the Fill shader to suit your tastes, and you can try out the other fill shader types, such as a three-tone shader to get a bit more detail in the coloring of the wagon. Adjust the toon outline thickness as you like, and have some fun playing with the toon outline's attributes to see how they affect the toon rendering of the wagon. This should be a quick primer to get you into toon shading. The rest, as always, is up to you. With some playing and experimenting, and you will be rendering some pretty nifty cartoon scenes in no time.

Summary

In this chapter, you learned how to create dynamic objects and create simulations. Beginning with rigid body dynamics, you created a set of pool balls that you animated in the simulation to knock into each other. Then, you learned how to bake that simulation into animation curves for fine-tuning. Next, you learned about particle effects by creating a steam effect for the locomotive animation using nParticles. Finally, you learned a little bit about Maya's Paint Effects tool and how it can easily be used to create various effects such as grass and flowers.

To further your learning, try creating a scene on a grassy hillside with train tracks running through. Animate the locomotive, steam and all, driving through the scene and blowing the grass as it passes. You can also create a train whistle and a steam effect when the whistle blows, and you can create various other trails of smoke and steam as the locomotive drives through.

With power comes complexity of use. Maya dynamics has a rich feature set and compound controls. The best way to be exposed to Maya dynamics is simply to experiment once you're familiar with the general workflow in Maya. You will find that the workflow in dynamics is more iterative than other Maya workflows, as you are required to experiment frequently with different values to see how they affect the final simulation. With time, you will develop a strong intuition, and you will accomplish more complex simulations faster and with greater effect.

Where Do You Go from Here?

It's so hard to say goodbye! But this is really a "hello" to learning more about animation and 3D!

Please explore other resources and tutorials to expand your working knowledge of Maya. Several websites contain numerous tips, tricks, and tutorials for all aspects of Maya, including the author's columns in HDRI3d magazine (www.hdri3d.com) and his occasional tutorials and ramblings online at www.koosh3d.com. Of course, www.autodesk.com/maya has a wide range of learning tools. Check the bibliography in Chapter 1, "Introduction to Computer Graphics and 3D," for some suggested reading materials. Now that you have gained your all-important first exposure, you will be better equipped to forge ahead confidently.

The most important thing you should have learned from this book is that proficiency and competence with Maya come with practice, but even more so from your own artistic exploration. Treat this text and your experience with its information as a formal introduction to a new language and way of working for yourself; doing so is imperative. The rest of it, the gorgeous still frames and eloquent animations, come with furthering your study of your own art, working diligently to achieve your vision, and truly having fun along the way. Enjoy and good luck.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset