# Dynamics and Particle Effects, Part 3

In this article-the third of four on dynamics-I play pick-up on a few topics I haven’t covered before. Most 3D software packages have dynamics systems, and the program I will be using-Autodesk* Maya*-is no different. I start with an exercise using blobby particles-a favorite of mine for creating liquid-like substances and an often-overlooked option for such tasks. Then, I introduce you to rigid-body and soft-body dynamics. Because I love to use dynamics for art-related projects, I include a short section at the end of this article with a piece I animated using dynamics to be projected behind a dance company. What is so wonderful about using rigid- and soft-body dynamics is the ability to create animation with geometries, employing the same forces and expressions you can use on particles.

## Creating Chocolate Using Blobby Surface Particles

Let’s start by creating a little bit of chocolate in Maya*. For this task, I assume that you have some basic knowledge of Maya*. If you’re a beginner, I recommend you read the first two articles in this series (Part 1, Part 2), as I don’t re-explain setting attributes and parameters already dealt with in those installments. As always, I recommend studying up on any effect you are trying to create. For example, how does the effect interact with light, the environment, other substances? how dense is it? how transparent? how does it move? what are its surface qualities? How does it taste? Okay . . . I know you can’t show that!

Over the years, I have found that using blobby particles is an easy way to create a thick liquid substance such as chocolate. The threshold parameter is particularly important in using blobbies. The higher the parameter’s value, the more the particles stick (or blob) together. The lower the value, the less they blob.

#### Creating Particles

In the Maya* Dynamics module, create a plane with a height and width of 1 and subdivisions 10 × 10. From that plane, create a surface emitter. Accept the emitter defaults, with a Particles/second setting of 100. Set the speed to 0, as you will be using forces to guide and set the particles’ speed. Name the emitter `chocolate`. Figure 1 shows the settings.

Figure 1. Creating a surface emitter named chocolate.

Select the particles (`particle1`) emitted by the chocolate emitter, and open their attribute editor. At the top of the particle attribute editor, click the ParticleShape1 tab (Figure 2).

Figure 2. The render attributes reside in the attribute editor’s particleShape node for the particle.

Now, set your attributes. Under Render Attributes, choose Blobby Surface as the particle type. Click the Current Render Type tab under the Particle Render Type tab so that you can set the threshold of the particles: Make the threshold 1.818. Next, set the Lifespan Mode to Constant and the Lifespan to 30.

Next, assign a simple Phong E material with a ramp to your particles (Figure 3). An advantage of using blobbies is that you can assign any shader to them.

Figure 3. A simple Phong E shader with a ramp is assigned to the blobby particles. One of the fun parts of working with blobbies (unlike cloud particles) is that you have such a wide selection of shaders to assign to them. For this example, I’m setting up a rudimentary shader that still creates good results.

#### Creating the Forces

With the `particle1` you just created selected, create a Newton field with a magnitude of 5 and attenuation of 1. Place it above the emitter on the y-axis, 11 units up. Now, duplicate the first plane, and put it 22 units up from the first plane. Scale the plane to about 47 × 47 units (Figure 4).

Figure 4. The two planes, the Newton field, and the particles.

To make the particles collide with the second plane you made (`pPlane2`), select the particles and plane 2, and then click Particles > Make Collide. Accept the defaults (Figure 5). Then, change the threshold settings of the particles, and run through the scene to see how doing so affects the particles. You can also adjust the settings in the `geoConnector` you just created when you added the particle collision.

Figure 5. The `geoConnector` is a node connected with both your plane and the particles; you can find it as a tab at the top of the attribute editor of both. The node serves as an interface between the geometry object and the dynamics system.

Figure 6 shows an image in which only the threshold settings of the blobby particles for the three chocolate columns have been changed.

Figure 6. I used frame 360 for the renders. Starting from the left, the particles have a threshold of 3, 1.8, and 0.2, respectively. The larger the threshold number, the more the clumping occurs.

#### Creating a Collision Event

With the particles selected, bring up the collision event editor by clicking Particles > Particle Collision Event Editor. Select Split as the Event type, set a spread of 0.500, and set an inherit velocity of 1.000. Then, click Create Event (Figure 7). `Event0` is created along with the target particle 2.

Figure 7. The collision event editor with the settings filled in. After clicking Create Event, particle 2 is created and used as the target particle. The highlighted green particles to the left of the event editor are particle 2 being created every time a particle 1 hits the plane.

Next, choose `particle 2` and make them into blobby particles. Give them a constant lifespan of 25. Assign a threshold of 3 and the same Phong E material you used on `particle 1`. Then, add a radius per particle attribute to them (Figure 8).

Figure 8. Selecting General in the attribute editor of `particleShape2` brings up the add attribute editor. Selecting particle, and then selecting radiusPP creates a `radiusPP` in the per particle attributes.

Create a ramp in the `Radius PP` attribute. Make the value at position 0 (bottom of the ramp) 1; at position 0.880, make the value 0.7; and make the value at position 1 (the top of the ramp) 0 so that the particles are born with a radius of 1 and at the end of their life have a radius of 0 (Figure 9).

Figure 9. My chocolate fountain column now.

In the example in Figure 10, I changed some of the settings to create a different look.

Figure 10. For this chocolate mound, I created a collision plane for `particle 2` at the base of the mound and another particle event. By changing radius and threshold parameters as well as the resilience in the `geoConnector`, you can achieve a host of looks.

## Creating Rigid Bodies

A rigid body is a geometry-either polygon or nurbs-that can be animated using fields, keys, expressions, collisions with particles (including soft-body particles), or rigid-body constraints. In some ways, it’s like having a geometry act like a particle. Rigid bodies collide with each other: They do not pass through each other. The animation of rigid bodies is controlled by the Maya* Rigid Body Solver component. You can have active and passive rigid bodies: Passive rigid bodies can have rigid bodies collide with them, but unlike active rigid bodies, they do not react to fields, collisions, or springs. Unlike active rigid bodies, passive rigid bodies can have their `translate` and `rotate`attributes key framed

#### Knocking Over a Stack of Cubes

Let’s start with a simple exercise-using dynamics to knock over a stack of cubes with a sphere:

1. Create five poly cubes, and stack them on a poly plane.
2. Select the plane, and then click Soft/Rigid Bodies > Create Passive Rigid Body.
3. Accept the defaults.
4. Make sure that the Active and Particle collision check boxes for rigid bodies are not checked (Figure 11).

Figure 11. Making the plane into a passive rigid body.

1. Select the first cube, and then click Soft/Rigid Bodies > Create Active Rigid Body.
2. Accept the defaults.
3. In the rigid body attributes, select the Active check box, and clear the Particle collision check box (Figure 12).

Figure 12. Choose one cube at a time to create an active rigid body for it.

1. Repeat step 7 for each cube, creating a new rigid body with a different name for each one.

The `rigidSolver` node is connected with the rigid bodies sphere and contains attributes that control the accuracy of the rigid-body solution as well as some global attributes, such as friction and bounciness, which you can turn on or off. Decreasing the collision tolerance and the step size make the solver more accurate but slower. You can choose from three solver methods, but each scene has only one rigid solver. This solver acts as a global control on all the rigid bodies in the scene. However, each rigid body created also has its own rigid body node whose attributes, such as bounciness, friction, damping, and initial velocity, can be adjusted separately (Figure 13).

Figure 13. The node tabs in the attribute editor of the cube. Notice the tab for the rigidSolver as well as the tab for the rigid body of the cube (in this case, named `cube4Rigid1`).

Now, select the sphere and make it into an active rigid body as well. This time, though, make sure both the Active and Particle collision check boxes are selected. Put a 0.5 impulse on x (this starts the cube moving on the x-axis), set Damping to 0.4, and set Dynamic friction to 0.5 (Figure 14). If the sphere does not move fast enough for your taste, adjust the dynamic friction higher.

Figure 14. Making the sphere into an active rigid body so it can knock over your cubes.

Next, select one of the cubes and apply a gravity field to it. Set the magnitude to 10 and the gravity direction to -1 on the y-axis. Using the dynamic relationship editor, apply the same gravity field to the rest of the cubes. Now, play through your scene (Figure 15).

Figure 15. This is a movie of the sphere going through the cubes. The initial velocity of the sphere rigid body is 100 on the x-axis.

## More on How Rigid Bodies Work

Only the side of a rigid body with the normals pointing out can collide with another rigid body surface. So for example, if you wanted to create popcorn popping in a pot, you would have to reverse the normals on the pot so that they were pointing toward the inside of the pot and animate the popcorn to move toward the pot’s inner surface. It’s okay for one passive rigid body to penetrate another passive rigid body, but it’s not alright for an active rigid body to penetrate either another active or passive rigid body (Figure 16).

Figure 16. To break rigid body connections, you must select the Allow Disconnection check box. To break key frame connections not specifically used by the rigid body, click Soft/Rigid Bodies > Break Rigid Body Connections.

## Creating Soft Bodies

An interesting aspect of the dynamic engine in Maya* is that you can constrain vertices to particles. For example, you can create a flexible object from a geometry or lattice object. This process is called a soft body. Soft bodies consist of particles and geometry, and there is a corresponding particle object to the geometry or lattice object. Generally, one particle is created for every vertex or CV in the object. The particles won’t render but can be influenced by all the forces, expressions, goals, springs, and collisions that can affect particles, causing the corresponding CV or vertex to move. The soft body will have the same static and dynamic attributes as the corresponding particle object, which allows for an almost infinite variety of effects.

#### Creating a Trampoline

Try using a soft body as a trampoline so that the trampoline bed will have some give to it. First, you need to create a simple trampoline object like the one in Figure 17. You create the trampoline bed, which you will turn into a soft body, by making a cylinder (set the subdivisions axis to 60 and the subdivisions cap to 40) and deleting everything but the top cap.

Figure 17. The trampoline bed made into a soft body.

Now, create a sphere and place it over the trampoline. Select the plane corresponding to the trampoline bed. Then, in the dynamics module, click Soft/Rigid Bodies > Create Soft Body; in the Soft Options dialog box, in the Creation options list, select Duplicate, make copy soft. Select the Duplicate input graph, Hide non-soft object, and Make non-soft a goal check boxes. Set the weight to 0.500 (Figure 18).

Figure 18. Making the trampoline bed into a soft body. By selecting the Make non-soft a goal check box, you have a goal for your soft body particles that will control them based on how they are weighted. A weight of 1 has the goal completely controlling them; a weight of 0 would have the goal having no influence over them at all. You can give each soft-body particle a different weight. For example, a soft-body particle with a weight of 1 won’t react to a force such as gravity but instead will stay firmly in place with the goal. A soft-body particle with a weight of 0 won’t be influenced by the goal at all but instead will be fully influenced by the gravity force applied to it.

#### Select the Sphere

In the dynamics module Soft/Rigid Bodies, click Create Active Rigid Body. In the Rigid Options dialog box, select the Particle collision check box, set Bounciness to 0.100, and set Damping to 0.500 (Figure 19).

Figure 19. Making the sphere into an active rigid body so it can bounce on the trampoline.

Next, select the trampoline bed particles, then the sphere. Click Particles > Make Collide; in the options, set Resilience to 0.3, and set Friction to 0.5.

With that done, paint the weights of the soft-body particles (Figure 20). At a value of 1 (white), the particles are totally controlled by the goal of the hidden soft body; at a weight of 0 (black), they are not at all influenced by that goal.

Figure 20. The Paint Weights tool is where you can paint different values on the soft-body particles.

There are a number of nodes in which you can adjust the dynamic action of your sphere. The `geoConnector` node is connected with both your sphere and the particles of the trampoline soft body; you can find this node as a tab in the attribute editors of both. The node serves as an interface between the geometry object and the dynamics system. In this case, it is the interface between the particles of the trampoline soft body and the rigid-body sphere geometry.

The `rigidSolver` node is connected with your rigid-body sphere and contains attributes that control the accuracy of the rigid-body solution as well as some global attributes, such as friction and bounciness, which you can turn on or off. Decreasing the collision tolerance and the step size makes the solver more accurate but slower. You can choose from three solver methods. There is also the rigid-body node of your sphere, for which you can adjust several attributes, such as bounciness, friction, damping, and initial velocity (Figure 21).

Figure 21. The attribute editor of the sphere, with the tabs for the different nodes.

## Conclusion

Dynamics provides a powerful tool for any 3D animator. Although we usually think of animation in terms of cartoon animations turned out by studios such as Disney and DreamWorks or the photoreal effects we see in our movies and games, the places in which 3D animation and therefore dynamics can be found go far beyond the abovementioned areas. I enjoy using them for what I call “visual poetry.” For example, I am currently working with some musicians to produce two hours of music and visuals to be projected in a dome (Figure 22). We hope to take the audience on a wonderful voyage.

Figure 22. This is a tiny piece of a video I created that I animated using dynamics in Maya*. It was projected behind a dance group as they performed.

In the final article on dynamics, I will be doing more with `nDynamics`-particularly `nCloth` and `nParticles`.