Chapter 12. Particles and Dynamics

Animating large numbers of similar objects frequently can be a time-consuming and arduous task. With hundreds, if not thousands, of individual objects and their animated parameters and transforms to consider, this is a task that, one object at a time, could quickly become overwhelming. 3ds Max has several tools for animating large numbers of objects in a scene including instanced objects, externally referencing objects, instanced modifiers, the Crowd utility for characters, and particle systems for controlling any number of particles. Particles are usually small objects, often in large numbers, that can represent rain, snow, a swarm of insects, a barrage of bullets, or anything else that requires a large quantity of objects that follow a similar path.

Another method of creating animations for several objects simultaneously is through the use of reactor, the physics engine contained within 3ds Max. Using reactor, you can calculate the interactions between many rigid and soft body objects or simulate fluids or rope dynamics.

Topics in this chapter include:

  • Understanding Particle Systems

  • Setting Up a Particle System

  • Particle Systems and Space Warps

  • Using Rigid Body Dynamics

  • Using Soft Body Dynamics

Understanding Particle Systems

Particle systems are a means to manage the infinite possibilities that can be encountered when controlling thousands of seemingly random objects in a scene. The particles can follow a tight stream or emanate in all directions from the surface of an object. The particles themselves can be pixel-sized elements on the screen or instanced geometry from an object in the scene. Particles can react to space warps, such as wind and gravity, and bounce off objects called deflectors to give them a natural flow through a scene. Particles can even spawn new particles upon collision.

All particle systems have two common components: the emitter and the particles. The emitter, as you would guess, is the object from which the particles originate. The location and, to a lesser extent, the orientation of the emitter are vital to the particles' origination point in the scene. Emitters are nonrendering objects, making their size and color unimportant. The particles themselves are the elements that spew from the emitter. The number of particles can range from a few (to simulate a burst from a gun) to thousands (to simulate smoke from a burning building). The number of particles visible in a viewport can adversely affect the viewport refresh speed and your ability to quickly navigate within the viewports. By default, far fewer particles are shown in the viewports than actually render in the scene. This helps maintain a reasonable system performance level.

Particle System Types

Two types of particle systems are available in 3ds Max: event-driven and non-event-driven particle systems.

Event-Driven Particle Systems

Event-driven particle systems use a series of tests and operators grouped into components called events. An operator affects the appearance and action of the individual particles and can, among many other abilities, change the shape or rotation of the particles, add a material or external force, or even delete the particles on a per-particle basis. Tests check for conditions such as a particle's age, its speed, and whether it has collided with a deflector. Particles move down the list of operators and tests in an event and, if the particles pass the requirements of a test they encounter, they can leave the current event and move to the next. If they do not pass the test, the particles continue down the list in the current event. Particles that do not pass any test in an event commonly are deleted or recycled through the event until they do pass a test. Events are wired together in a flowchart style to clearly display the path, from event to event, that the particles follow.

Particle Flow is the event-driven particle system in 3ds Max, and it is a very comprehensive solution to most particle system requirements. The upper-left pane in the Particle View window in Figure 12.1 shows a partial layout of the events in a Particle Flow setup. Events are the named boxes, operators are the gray boxes, and tests appear as yellow diamonds. To the right of the Particle View window is a common example of one of the several emitter types that a Particle Flow can utilize. Using Particle Flow, you can create almost any particle-based effect, including rain, snow, mist, a flurry of arrows and spears, and objects assembling and disassembling in a blast of particles. Unfortunately, an in-depth examination of Particle Flow is beyond the scope of this book.

The Particle View window and a Particle Flow emitter

Figure 12.1. The Particle View window and a Particle Flow emitter

Non-Event-Driven Particle Systems

Non-event-driven particle systems rely on the parameters set in the Modify panel to control the appearance and content of the particles. All particles are treated identically by the system's parameters, and there are no tests to modify the behavior for certain particles. Non-event-driven particle systems have been around for a long time; they are stable, easy to learn, and an acceptable solution for many particle requirements. Non-event-driven particle systems are the focus of this chapter. These particles can be bound to space warps to control their apparent reactions to scene events, and they can be instructed to follow a path.

Six different non-event-driven particle systems are available in 3ds Max; each has its own strengths. They all have similar setups and, after you understand one type, the others are easy to master.

The Super Spray particle system is the most commonly used non-event-driven particle system in Max. It features a spherical emitter with a directional arrow to indicate the initial direction of the particles. It has eight rollouts containing the parameters that control the appearance and performance of the particles. The particles can emerge over a specified range of time or throughout the length of the scene's duration. When rendered, they can appear as one of several 2D or 3D shapes, instanced scene geometry, or as interconnecting blobs that ebb and flow as they near each other. The particles can even spawn additional particles when they collide and load a predesigned series of parameters called a preset. The Super Spray particle system essentially replaced the older, less-comprehensive Spray particle system, and it will be the main focus of this chapter.

Non-Event-Driven Particle Systems

Rather than being the emitter, the Particle Array particle system that is created in a viewport is only a visual link to the particle system emitter itself. The PArray uses a scene object as the emitter for the particles. While the parameters are adjusted with the PArray selected, the particles are emitted from the vertices, edges, or faces of the designated object. When used in conjunction with the PBomb space warp and the Object Fragments setting, acceptable object explosions can be created.

Non-Event-Driven Particle Systems

The Particle Cloud particle system contains particles within a volume defined by the emitter or by selecting a 3D object in the scene to act as the constraining volume. When instanced geometry is used as the particle type, an array of space cruisers or a school of fish can be represented by the PCloud system. The PCloud object does not render, and any object used to constrain the particles can be hidden to give the illusion that the particles are not held in place by an external force.

Note

Instanced geometry takes instanced copies of an object and assigns one instance to the particles in a scene. You can animate a school of fish, for example, by assigning an instanced fish model to particle locations, and then animating the particles to school together and swim along.

Non-Event-Driven Particle Systems

The Blizzard particle system is similar to the Super Spray particle system in its toolset and capabilities. The presets that ship with Blizzard are designed to simulate the particle motion of rain, snow, or mist. The Blizzard particle system has replaced the less-capable Snow particle system.

Non-Event-Driven Particle Systems

The Spray and Snow particle systems are the original particle systems that shipped with the initial release of 3D Studio Max, the first Windows release after four DOS-based versions of 3D Studio. At the time, they were cutting edge and beneficial, but they have not been improved significantly since their implementation. Spray and Snow do not offer primitive or instanced geometry as particles, presets, or particle spawning. The concepts used with these two systems are similar to the other more-advanced systems, but they are seldom used anymore.

Non-Event-Driven Particle Systems

Setting Up a Particle System

Particles are renderable objects in Max, so a particle system is created in the Geometry tab of the Command panel. Like most other objects in 3ds Max, the particle system's parameters can be changed immediately in the Create panel, but they must be changed in the Modify panel after the object is selected at a later point in time. To set up a particle system, follow these steps.

  1. Click Create → Geometry → Particle Systems from the Command panel and then click on the Super Spray button in the Object Type rollout. The particle system's parameters appear in the Command panel.

    Setting Up a Particle System
  2. Click and drag in the Perspective viewport to create the Super Spray emitter. The emitters do not render, so the size does not matter; the arrow will point in the positive Z direction, as shown in Figure 12.2.

  3. Drag the time slider to the right until the particles extend beyond the limits of the viewport. Frame number 10 should be sufficient.

    The Basic Parameters rollout controls how the particles spread as they exit the emitter, the size of the emitter, and how they display in the viewports.

  4. In the Basic Parameters rollout, set both Spread values to 30 to spread the particles out 30 degrees in both the local X- and local Y-axes of the emitter. The Off Axis parameter rocks the emission direction along the X axis and the Off Plane parameter rotates the angle of emission around the Z-axis. Both of these should remain at zero.

    Setting Up a Particle System
  5. In the Viewport Display area, make sure Ticks is selected and the Percentage of Particles is set to 10. This ensures that the particles appear as small crosses in the viewports, regardless of the type of particle used, and that only 10 percent of the particles that are actually emitted are displayed in the viewport. Both of these parameters are used to ensure a minimal loss of performance in the viewport when using particles.

  6. Click the Quick Render button (

    Setting Up a Particle System
    The Super Spray emitter created in the Perspective viewport

    Figure 12.2. The Super Spray emitter created in the Perspective viewport

The Particle Generation Parameters

The parameters in the Particle Generation rollout control the emission of the particles including the quantity, speed, size, and life span. If you can't see any particles in your scene, the first place to look should be the Particle Generation rollout.

  1. Expand the Particle Generation rollout. In the Particle Quantity area, the Use Rate value determines the number of particles emitted at each frame and the Use Total value determines how many particles are emitted over the active life of the system. Only one of these options can be active at a time. Increase the Use Rate value to 12.

    The Particle Generation Parameters
  2. Increase the Speed value to 15 to increase the velocity of the particles.

  3. In the Playback Controls area, click the Play Animation button (

    The Particle Generation Parameters
  4. In the Particle Timing section of the Particle Generation rollout, change the Emit Start value to 10 and the Emit Stop value to 100 and then click the Play Animation button again. The particle system will pause for 10 frames at the beginning of the active time segment and then emit 12 particles every frame for the remaining 90 frames.

    The Particle Generation Parameters
  5. Drag the Time slider to frame 50 or so and then zoom out in the Perspective viewport until the limits of the particles extents are visible. Play the animation again. The particles increase their distance from the emitter until frame 45 and then travel no farther.

    There are several parameters that determine when a particle is visible. The Emit Start and Emit Stop parameters mentioned earlier bracket the frames when the particles are emitted. The Display Until parameter in the Particle Timing area defines the last frame when any particle is visible. Regardless of whether this frame falls within the Start and Stop values, when the Display Until frame is reached, no further particles appear in the viewports or in any renderings. Another parameter that controls the display of particles is the Life value. The Life value determines how long each particle exists in a scene from when it is emitted until it disappears. Currently, the Life value is set to 30 so that at frame 45, which is 30 frames after the emission begins at frame 15, the particles disappear. Particles that are emitted after frame 10 also live for 30 frames, moving the same distance from the emitter before dying.

  6. Change the Life value to 40, allowing the particles to travel one-third farther from the emitter, and change the Variation to 20, adding randomness to the particle's lifespan.

    The Particle Generation Parameters
  7. Play the animation. The particles now travel farther from the emitter and die between 32 and 48 frames after being emitted.

  8. In the Particle Size area, change the Size value to 10 and then render one frame of the scene at some point after frame 30. The result should look similar to Figure 12.3.

    The Super Spray particle system rendered in the Perspective viewport

    Figure 12.3. The Super Spray particle system rendered in the Perspective viewport

    Notice that the particles are smaller very near the emitter and also very far away from the emitter. By default, the Grow For value causes the particles to grow from a size of zero to full size over the first 10 frames of their lives. The Fade For parameter causes those same particles to shrink from full size to zero size during the last 10 frames of their lives.

  9. Change the Fade For value to 0, so the particles retain their size at the end of their lives, and leave Grow For at its default.

  10. Render the Perspective viewport again and notice how the particles grow, but never shrink.

    The Super Spray particle system rendered in the Perspective viewport

Putting It Together

Now that you have a basic understanding of particle systems, you will continue to work with them by creating a system that represents the bullets fired from a gun and the brass expelled from the ejection port. This will require two particle systems, one for each type of object leaving the gun. We will also examine the different particle types that can be emitted.

Creating the Particle Systems

The basic process of creating a particle system is fairly simple; you place the emitter in the scene, fine tune its location and orientation, and then adjust the system's parameters. The third item mentioned is the one that will take the most experimentation to perfect.

  1. Creating the Particle Systems
  2. In the Top viewport, create a Super Spray particle system. Move and rotate it so that the emitter is recessed slightly into the barrel of the gun, similar to Figure 12.4. Turn on the Angle Snap Toggle (

    Creating the Particle Systems
    The Top and Right viewports showing the proper placement of the Super Spray particle emitter

    Figure 12.4. The Top and Right viewports showing the proper placement of the Super Spray particle emitter

  3. Click the Select and Link button (

    The Top and Right viewports showing the proper placement of the Super Spray particle emitter
  4. Click on the particle system; a rubber banding line stretches from the emitter to the cursor. Place the cursor over the gun barrel and then click again. The gun flashes white to indicate that the linking is complete. Any changes in the gun's orientation or position are now passed down to the particle system, keeping it colocated and oriented with the gun.

    The Top and Right viewports showing the proper placement of the Super Spray particle emitter
  5. Rename this particle system to Super Spray Bullets.

  6. Create a second Super Spray particle system and place it on the right side of the gun body. Orient the emitter so that the particles are ejected upward and away from the gun, as shown in Figure 12.5. In the figure, the target and its supports have been hidden for clarity.

    Note

    You may see a random particle or two already emitted by the particle systems. These are caused by the Emit Start time being set to the initial frame of the scene. This anomaly is corrected in the next section.

  7. Link this particle system to the gun, just as you did with the other in Steps 3 and 4.

  8. Rename this system to Super Spray Brass.

Configuring the Particle System Timing

The amount of particles emitted over time defines the density of the particles in the scene. The speed of the particles also factors into the proximity of the particles.

  1. In the Time Controls area, click the Time Configuration button (

    Configuring the Particle System Timing
    The Top and Front viewports showing the proper placement of the second Super Spray particle emitter

    Figure 12.5. The Top and Front viewports showing the proper placement of the second Super Spray particle emitter

  2. In the Time Configuration dialog box, change the Length value to 300 and then click the OK button. At 30 frames per second (fps), the scene is now 10 seconds long.

    The Top and Front viewports showing the proper placement of the second Super Spray particle emitter
  3. Select Super Spray Bullets and then click the Modify tab of the Command panel.

  4. In the Particle Generation rollout, set the Use Rate to 10, the Speed to 10.0, the Emit Start value to 45, and the Emit Stop value to 255. After a one-and-a-half second pause, the gun will fire 10 rounds per frame continuously for seven seconds.

  5. Change the Display Until value to 300 so that the particles appear in the scene for the entire active time segment. Set the Life value to 255 (the scene length minus the frames prior to the first particle emission) so the particles do not die out in the scene.

  6. In the Particle Size section, change the Size value to 4. Drag the Time slider to approximately frame 80 and then render the Camera viewport. The scene should look similar to Figure 12.6.

    The Top and Front viewports showing the proper placement of the second Super Spray particle emitter

The particles appear as triangles that grow as they travel away from the emitter. This is not the look that you want for the particles when you are creating a traditional gun; the rounds should all appear the same size for the life of the particles. The particle type is covered in the next section and in the "Particle Systems and Space Warps" section later in this chapter. The conditions that allow the particles to pass through the target object are also addressed.

The rendered camera viewport showing the particles

Figure 12.6. The rendered camera viewport showing the particles

Selecting the Particle Type

There are several types of particles that can be emitted by a particle system. Standard particles consist of eight different 2D and 3D particles including cubes, spheres, and six-pointed stars. The Facing Standard particle type is a square, 2D particle that maintains a continuous orientation perpendicular to the viewport. Using opacity mapped materials in conjunction with Facing particles can give the illusion of smoke or steam without using a massive number of particles.

MetaParticles use what is known as metaball technology where each particle appears as a blob with a sphere of influence surrounding it. Whenever the two spheres of influence from two particles in close proximity overlap, the particles meld together in an organic manner similar to mercury or the wax in a lava lamp. Using MetaParticles can be computationally intensive, so caution should be a priority when that is the selected particle type. Start with a quantity of particles fewer than you would expect to use and then increase the amount, as required, after test rendering the scene.

Geometry that exists in the scene can also be substituted for the particles at render time. Using instanced geometry, a particle system can emit any objects from jet fighters to fire fighters, or nearly any other geometry in the scene, using the material from the object that is instanced. The original scene object can be hidden so as not to appear in the render of the scene, while still being instanced by the particle system.

  1. With the Super Spray Bullets particle system selected, expand the Particle Type rollout.

  2. In the Particle Types section, select MetaParticles.

  3. From the Menu Bar, choose Edit → Hold to temporarily save the scene. If rendering the scene causes a system crash, it can be restored to this point using Edit → Fetch. 3ds Max is a stable program, but rendering MetaParticles can significantly task a computer system.

  4. Render the scene. The particles that are near to each other combine to form blobs of meshes.

    Selecting the Particle Type
  5. In the MetaParticle Parameters section, decrease the Tension to 0.1. Tension controls a particle's effort to maintain a spherical shape while in proximity to another particle. Lowering the Tension increases the amount of inter-particle combining.

  6. Render the scene again to see the effect of the lower Tension value.

    Selecting the Particle Type
  7. MetaParticles would be the solution if this were a plasma rifle, rather than a conventional machine gun. In this case, instanced geometry is the appropriate particle choice.

  8. Right-click on a blank area of the Active viewport and choose Unhide by Name from the Quad menu. Select the bullet and brass objects from the list in the Unhide Objects dialog box and then click the Unhide button. Two small objects, a bullet and a brass casing, appear below the gun.

  9. At the top of the Particle Type rollout, select Instanced Geometry as the particle type. In the Instancing Parameters section, click the Pick Object button.

    Selecting the Particle Type
  10. Select the Bullet object in the scene. If necessary, press the H key to open the Pick Object dialog box to select the object by name. The bullet flashes white briefly to indicate that the selection is successful and the object name is now identified in the Instancing Parameters section as the instanced geometry object.

  11. Render the Camera viewport. There are still a few problems that need to be corrected. The particles are growing as they leave the emitter, the particles grow to be too large for the gun barrel, and the bullets rotate in several axes, rather than maintaining a forward orientation. The bullets also display their object color, the color used by the particles system, rather than the material applied to the Bullet object.

    Selecting the Particle Type
  12. In the Particle Size section of the Particle Generation rollout, set the Grow For and Fade For parameters to 0. This will cause the particles to maintain a constant size throughout their life spans.

    Selecting the Particle Type
  13. When using standard or metaparticles, the Size parameter defines the size of the particle. When using instanced geometry, it becomes a multiplier of the object's actual size. With the current Size value set to 4, the bullets are scaled to four times their modeled size. Set the Size value to 1.

    Selecting the Particle Type
  14. Expand the Rotation and Collision rollout. In the Spin Axis Controls section, select Direction of Travel/Mblur to make each bullet's orientation follow its direction of travel.

  15. At the bottom of the Particle Type rollout, make sure that the Instanced Geometry radio button is selected and then click the Get Material From button.

  16. Render the camera viewport again. All of the particles are now oriented properly.

    Selecting the Particle Type
    Selecting the Particle Type

Setting Up the Other Particle System

We have a particle system set up to emit the bullets, and now we need one that ejects the brass casings. In many cases, the same parameters must be maintained among the two systems so these parameters will be wired together, ensuring a common value between them.

  1. Setting Up the Other Particle System
  2. Select the Super Spray Brass particle system.

  3. In the Particle Generation rollout, set the Size to 1 and set both the Grow For and Fade For values to 0. Set Emit Start to 45, Emit Stop to 255, and Life to 300.

  4. In the Particle Motion section, reduce the Speed value to 5. The rate of particles emitted is still set to 10; the Speed value just determines the velocity of the particles as they leave the emitter.

    Setting Up the Other Particle System
  5. In the Particle Type rollout, choose Instanced Geometry in the Particle Types section and then click the Pick Object button. Select the brass object as the geometry to be instanced.

  6. Select the Instanced Geometry option in the Mat'l Mapping and Source section at the bottom of the Particle Type rollout, and then click the Get Material From button to define the material applied to the particles.

  7. In the Rotation and Collision rollout, select the Direction of Travel/Mblur option.

  8. Select the bullet and brass objects and hide them.

  9. Drag the time slider. The Super Spray Brass particle system emits particles for 30 frames and then stops before the Super Spray Bullets particle system begins. This disconnect is addressed in the next section.

Wiring the Parameters Together

The values that define the parameters unique to each particle system in the scene have been set properly. Several values, such as the Use Rate, must maintain the same value for both particle systems so that, for example, the amount of brass ejected matches the number of bullets fired. These parameters can always be adjusted manually; however, the Parameter Wiring tool forces one object's parameters to drive another's. In the following exercise, the parameter values of the Super Spray Bullets particle system are used to define the parameter values of the Super Spray Brass particle system.

  1. Wiring the Parameters Together
  2. Select the Super Spray Bullets particle system. Right-click in the viewport and choose Wire Parameters from the Quad menu.

    Wiring the Parameters Together
  3. From the small pop-up menu that appears, choose Object (SuperSpray) and then Birth Rate from the cascading menu. A rubber banding line connects the particle system to the cursor. At this point, the object to be wired to the Super Spray Bullet's Birth Rate parameter must be selected.

    Wiring the Parameters Together
  4. Press the H key to open the Pick Object dialog box, select Super Spray Brass, and then click the Pick button.

    Wiring the Parameters Together
  5. From the small pop-up menu that appears, choose Object (SuperSpray) and then Birth Rate from the cascading menu.

    Wiring the Parameters Together
  6. The Parameter Wiring dialog box opens, as shown in Figure 12.7. The Birth Rate parameters are highlighted in both the left and right windows. The left side of the dialog box displays the Super Spray Bullets particle system's parameter, and the right side displays the parameters for the Super Spray Brass particle system.

    The Parameter Wiring dialog box with the Birth Rate parameters highlighted

    Figure 12.7. The Parameter Wiring dialog box with the Birth Rate parameters highlighted

  7. The control direction, defining which parameter controls the other, can be set so that either one of the parameters controls the other, or bidirectional control can be set so that either parameter can change the other. In this case, the bullet rate is used to control the brass rate. Click the right arrow between the two parameter windows.

    The Parameter Wiring dialog box with the Birth Rate parameters highlighted
  8. Complete the wiring process by clicking the Connect button. The parameters in each window will turn red to indicate that they are wired.

    The Parameter Wiring dialog box with the Birth Rate parameters highlighted
  9. Select the Super Spray Bullets particle system and change the Use Rate to 12.

  10. Select the Super Spray Brass particle system and examine its Use Rate. It is now set to 12 as well.

    Note

    You can try to change the Use Rate for the Super Spray Brass particle system, but it won't work. The related spinners simply do not work, and they shouldn't because the particle system's Use Rate is defined by the Use Rate of the Super Spray Brass particle system. You can highlight and change the value manually; however, nothing will really happen. When you deselect the system and then select it again, the Use Rate reverts to the value set by the other system.

  11. Select the Life parameter in both windows; click the right arrow and then the Connect button. The Life parameters are now wired together as well.

    Note

    Unfortunately, the Emit Start, Emit Stop, and Display Until parameters are not exposed to the Parameter Wiring dialog box. These values must be changed for each particle system individually.

  12. Close the Parameter Wiring dialog box.

  13. Drag the time Slider. The two particle systems emit equal numbers of particles at the same time. The brass ejects in a straight line from the gun body; this is corrected in the next section.

    The Parameter Wiring dialog box with the Birth Rate parameters highlighted

The particle systems have been created and linked to the gun so that they maintain the proper position and orientation when the gun moves or rotates. The systems have been adjusted to fire bullets from the barrel and eject brass from the side at an equal and wired rate. In the next section, the processes of adding space warps to interject gravity into the scene and to cause the particles to collide with scene objects are covered.

Particle Systems and Space Warps

Space warps are nonrendering objects that can modify or manipulate the objects in a scene. Modifier-based space warps, for example, deform objects based on the object's proximity to the space warp. In this section, the focus is on the Forces and Deflectors categories of space warps; the space warps that affect particle systems.

The Forces space warps affect particle systems by altering the trajectory of the particles as they move through the scene. Each space warp displays as an icon in the viewports that must be bound to each object that it is designated to affect. The bindings appear as wide gray lines at the top of the Modifier Stack.

The Forces space warps are listed here:

Motor

Applies a directional spin to the particles, creating a circular movement. The orientation of the Space Warp icon defines the direction of the rotation.

Vortex

Similar to the Motor space warp, Vortex causes the particles to move in a circular motion but also decreases the radius of the motion over distance, creating a funnel-shaped motion.

Path Follow

Requires the particles to follow a spline path. The particle timing is controlled by the Path Follow's parameters.

Displace

Changes the particle trajectory by pushing them based on the space warp's Strength and Decay values. Image maps can also be used to define the amount of displacement.

Wind

Adds a directional force to the particles based on the space warp's orientation. Randomness can be added to increase the realism of the simulation.

Push

Applies a constant, directional force to the particles.

Drag

Rather than changing the direction of the particles, Drag slows the speed of the particles as they pass through its influence.

PBomb

Disperses particles with a linear or spherical force. This can be effective when used with the Particle Array particle system.

Gravity

Applies a constant acceleration used to simulate the affect of gravity on the particles. Gravity can be applied in a linear fashion

Adding Gravity to a Scene

When looking at the particle systems in the previous exercises, especially the Super Spray Brass system, it's evident that the motion of the particles is not realistic. The particles are emitted at approximately a 45-degree angle up and away from the gun body. The particles maintain a perfectly straight trajectory and never fall to the earth as they should. In this exercise, gravity is added to both particle systems to cause the bullets and brass to drop.

  1. Adding Gravity to a Scene
  2. Drag the Time slider to frame 100.

  3. Click Create → Space Warps. Choose Forces from the drop-down menu if necessary, and then click the Gravity button.

    Adding Gravity to a Scene
  4. Click and drag in the Top viewport to place and size the Gravity Space Warp icon. The size and the location are unimportant, but the orientation of the icon defines the direction of the gravitational force.

    Adding Gravity to a Scene
  5. Select the Super Spray Brass particle system. Click the Bind to Space Warp button (

    Adding Gravity to a Scene
    After the Gravity is bound to the particle system, the particles drop through the floor.

    Figure 12.8. After the Gravity is bound to the particle system, the particles drop through the floor.

  6. Click on the Particle System emitter or the particles themselves and drag the cursor toward the Gravity. A rubber banding line connects the particle system to the cursor.

  7. Place the cursor over the Gravity space warp, the cursor's appearance changes to identify it as a valid object for binding, and then release the mouse button. The space warp flashes briefly to indicate a successful binding and the particles now drop through the floor as shown in Figure 12.8.

    After the Gravity is bound to the particle system, the particles drop through the floor.
  8. Select the Super Spray Bullets space warp and bind it to the Gravity space warp as well.

  9. Play the animation. The particles from both systems are affected by the gravity, but the bullets drop too far for their distance from the gun to the target. Reducing the amount of gravity isn't appropriate because the brass would fall too slowly and the gravitational force should be consistent throughout the scene. This situation is fixed by increasing the velocity of the bullets as they leave the barrel.

  10. The Bind to Space Warp button is still active. Click the Select Object button, and then select the Super Spray Bullets particle system.

  11. Make sure the Time slider is at a frame well into the animation so that changes to the system are reflected in the viewports.

  12. In the Modify panel, click the SuperSpray entry in the Modifier Stack to expose the particle system's parameters.

    After the Gravity is bound to the particle system, the particles drop through the floor.
  13. In the Particle Generation rollout, increase the Speed value to 50. The visible trajectories of the particles will flatten out.

Note

At the bottom of the Rotation and Collision rollout, you will find the Interparticle Collisions section. Enabling this parameter causes Max to calculate and determine the result of any situation where two particles impact each other. This can add a measure of realism to the way the particles react, but it can also consume a significant amount of system resources. Use this feature with caution and always Hold the scene prior to enabling or testing the feature.

Controlling the Particles with Deflectors

As you can see in the previous exercises, particles travel through a scene, guided by space warps but unaffected by geometry. Deflectors are a type of space warp that causes the particles that impact it to bounce as if they have collided with an unmovable surface. The amount of Bounce assigned to a deflector is a multiplier that defines the velocity of a particle after it impacts the space warp. A Bounce value of 0.5 results in the particle's speed being reduced to 50 percent of the speed it was when it hit the deflector. Most deflectors have Time On and Time Off parameters that control when the deflector is active.

Deflecting the Brass at the Floor

To get the spent casings to collide with the ground, follow these steps:

  1. Deflecting the Brass at the Floor
  2. Drag the Time slider to frame 100.

  3. Click Create → Space Warps. Choose Deflectors from the drop-down menu and then click the POmniFlect button.

    Deflecting the Brass at the Floor
  4. In the Top viewport, click and drag to define the two opposite corners of the deflector. The deflector should be similar in size to the floor object in the scene. Unlike the Forces space warps, deflectors must be positioned in the stream of the particles.

    Deflecting the Brass at the Floor
  5. Move the deflector 0.3 units in the positive Z direction. The impact point is based on the particle location. When using instanced geometry, the particle location is defined by the center point of the geometry. The bullets and brass are about 0.3 units in radius, so moving the deflector up 0.3 units prevents the particles from sinking into the floor.

  6. Select the Super Spray Brass particle system and then click the Bind to Space Warp button in the Main toolbar. Click on the particle system, or particles, drag to the perimeter of the deflector, and then release to bind the deflector to the particle system.

  7. Activate the camera viewport and then play the animation. The particles initially bounce equal in height to their highest point after being ejected, but they discontinue shortly afterward.

  8. Select the deflector object in the viewport, not the deflector binding in the Modifier Stack.

    UNDERSTANDING DEFLECTOR NAMES
  9. In the Timing section of the Parameters rollout, set the Time Off value to 300 to leave the deflector on during the entire active time segment.

  10. In the Reflection section, set the Bounce value to 0.25 and the Variation to 10 percent. Increase Chaos to 50 percent so the particles' directions are not constrained to a straight line.

  11. In the Common section, increase the Friction value to 4.0 to prevent the particles from spreading too far along the deflector's surface.

  12. Play the animation. The brass is ejected from the side of the gun, falls to the floor, and spreads a bit from the point of impact.

Deflecting the Bullets at the Target

The brass is handled, and now the bullet collisions need to be addressed equally as well.

  1. Click Create → Space Warps and then click the UOmniFlect button.

  2. In the Top viewport, click and drag to place and size the universal deflector. The size and position do not matter. This is just a visible icon. A scene object will be selected to act as the deflector.

    Deflecting the Bullets at the Target
  3. Select the Super Spray Bullets particle system, and bind it to the UOmniflect icon, not the Target object. Bind the particle system to the POmniFlect deflector as well.

  4. Click the Select Object button and then select the UOmniFlect icon.

  5. Click the Pick Object button and then select the target object in the scene.

  6. In the Timing section, set the Time Off value to 300.

  7. In the reflection section, set Bounce to 0.01, Variation to 10, and Chaos to 4.

  8. Play the animation. The particles hit the target, fall to the floor, and then spread out a bit.

As you can see, the proper use of Force and Deflector space warps, in conjunction with particle systems, can successfully animate thousands of small objects within the constraints of a scene. The completed scene can be examined using the Particle Gun Complete.max and Particle Gun.avi files on the companion CD. In the remaining sections in this chapter, we will look at the implementation of rigid and soft body dynamics in physics simulations.

Using Rigid Body Dynamics

Part of the core package of 3ds Max is the physics engine known as reactor. With reactor, complex physical conditions are accurately animated showing the interaction of the scene objects with each other and with external forces such as wind or gravity. Objects are assigned mass, elasticity, and friction properties and designated as movable or immovable objects. Rigid body dynamics, soft body dynamics, rope, and cloth simulations are all within the limits of reactor's toolset. The Real Time Preview window displays a lower resolution, unrendered example of the animation to be created. Reactor calculates the animation, but the standard practice of creating keyframes is the final output of the simulations. These keyframes can be edited and manipulated; however, the integrity of the simulation could be compromised.

Creating the Simulation Objects

In this exercise, a series of primitive objects are dropped onto a complex inclined object to examine the interaction of the scene objects. Although this is a simple example of the use of the physics simulator, reactor can be used to simulate the interactions of very complex scenes with many colliding objects and external forces.

Creating the Simulation Objects
  1. Open the Rigid.max file from the companion CD. This consists of an inclined box with additional boxes, cylinders, and a hemisphere placed on its surface to make the simulation more complex.

    Creating the Simulation Objects
  2. Create two rows of spheres above the objects. Make sure they are all over the top edge of the large box and fit between the two angled boxes.

  3. Create a row of small boxes between the rows of spheres, and rotate them each about all three axes.

  4. From the Extended Primitives category of geometry objects, create a Star2 hedra and position it near the other objects. The scene should look similar to Figure 12.9.

    Creating the Simulation Objects
  5. Open the Material Editor and then apply the Checker material to all of the objects you created. The Checker Diffuse Color map helps discern the rotation of each object in the simulation.

The scene after creating additional objects for the simulation

Figure 12.9. The scene after creating additional objects for the simulation

Assigning the Physical Properties

Each object in the scene must be assigned the correct properties to define their reactions during the simulation. Objects that are to be stable and immovable are assigned a Mass value of 0.

Assigning the Physical Properties
  1. Select all of the objects that existed in the scene when the file was first opened.

  2. From the reactor toolbar, click the Open Property Editor button (

    Assigning the Physical Properties
  3. Make sure Mass is set to 0 in the Physical Properties rollout and Mesh Convex Hull is selected in the Simulation Geometry rollout.

  4. Select all of the spheres that you created. Set their Mass value to 1.0 and choose Bounding Sphere in the Simulation Geometry rollout. When using a spherical object, Bounding Sphere is more accurate and calculates faster than Mesh Convex Hull.

    THE SIMULATION GEOMETRY ROLLOUT

    Note

    Most 3D geometry works as expected during a reactor simulation. Reactor, however, contains its own plane object for use whenever flat, 2D surfaces are required. When a 3ds Max plane is used instead of a reactor plane, Concave Mesh must be chosen as the Simulation Geometry type.

  5. Select all of the boxes that you created, assign a Mass value of 1.0, and choose the Bounding Box option.

  6. Select the hedra. Increase its Mass to 1.0 and select Mesh Convex Hull for the simulation.

Creating the Collection

Scene objects must be members of a collection to be included in any simulations. The collections appear as simple icons in the viewports that are selected to access the simulation's parameters, including editing the list of included objects.

  1. Continue with the previous exercise or open the Rigid1.max file from the companion CD.

    Creating the Collection
  2. Click the Create Rigid Body Collection button (

    Creating the Collection
  3. Click in any viewport to place the Rigid Body Collection icon. The location does not matter.

    Creating the Collection
  4. In the Command panel, click the Add button at the bottom of the RB Collection Properties rollout.

    Creating the Collection
  5. In the Select Rigid Bodies dialog box that opens, select all of the objects in the scene except for the collection itself and then click the Select button. The object names will appear in the Rigid Bodies field in the Command panel.

    Creating the Collection

In most cases, no objects in a scene are required to be in a simulation. They should be omitted if their impact to the simulation is not required. For example, in a scene where marbles spill across a table and onto a floor, the marbles, table, and floor must be included, but the nearby lamp or the ceiling should be omitted.

Testing the Simulation

Reactor provides the Real-Time Preview window where you can view the simulation. Materials and lighting are not considered for this preview; therefore it is much faster, but less accurate, than rendering the animation.

  1. Click the Preview Animation button (

    Testing the Simulation
    The reactor Real- Time Preview window showing the scene

    Figure 12.10. The reactor Real- Time Preview window showing the scene

  2. Press the P key to begin the preview, and then press P again to stop it.

  3. After the preview runs its course, choose Simulation → Reset to place the objects at their starting points and review the animation.

    Note

    You can click and drag in the Preview window to arc-rotate around the simulation objects.

  4. The hedra is large for the scene and may cause a bottleneck. Close the Preview window.

  5. Select the hedra and reduce its Radius value.

  6. Select all of the objects that existed when the scene was first opened, and then open the Rigid Body Properties dialog box.

  7. Set the Friction property to 0.1.

    The reactor Real- Time Preview window showing the scene
  8. Select the remaining objects in the scene, and set the friction to 0.1 as well.

  9. Rearrange the objects to change the simulation.

    The reactor Real- Time Preview window showing the scene
  10. Continue to preview the animation and rearrange the objects until the simulation meets your liking.

Creating the Animation

The Preview window showed what the animation will be like, but the animation keys have not been created. The next exercise creates keys for all the objects in the collection. Creating the keys is not undoable, so it is recommended that an Edit → Hold be performed prior to creating the animation.

  1. In the Time Configuration dialog box, increase the length of the scene's animation to 200 frames.

  2. Click Edit → Hold from the Main menu.

  3. Click the Create Animation button (

    Creating the Animation
  4. Click OK in the reactor dialog box that opens and warns you that the action cannot be undone.

    Creating the Animation
  5. Max creates keys at every frame for every object in the simulation.

    Note

    The process of creating keys with reactor cannot be undone, but the objects can be selected and their keys can be deleted in the Track Bar, the Dope Sheet, or the Function Curve dialog boxes.

  6. Play the animation. The scene animates through frame 100 and then stops. The default value for all simulations is 100 frames.

  7. To restore the scene to its state before Max created the animation, click Edit → Fetch from the main menu and then click the Yes button in the dialog box that opens.

  8. Click the Utilities tab (

    Creating the Animation
  9. Click the reactor button in the Utilities rollout.

    Note

    In reactor, solvers provide the algorithms that determine each object's reactions in the simulation. The two available solver options in 3ds Max 9 are Havok 1 and Havok 3. The Havok 1 solver has more functionality and can handle all types of simulation objects. Havok 3 is faster and more accurate, but it can solve only for rigid body objects. If only rigid body objects are used in a simulation, Havok 3 is usually the better choice.

    Creating the Animation
  10. In the About rollout, select Havok 3 from the Choose Solver drop-down menu. Havok 3 is the better choice when using only rigid body objects.

  11. Expand the Preview & Animation rollout and change the End Frame value to 200.

  12. Click Edit → Hold again, and then click the Create Animation button.

  13. 3ds Max creates the simulation. You can fetch the scene and rearrange the objects as you want to change the simulation parameters. Remember to hold the scene before creating the animation each time.

The completed exercise is available as the Rigid Complete.max file in the Dynamics Scene Files folder on the companion CD and the final rendering as Rigid Complete.avi.

Creating the Animation

Using Soft Body Dynamics

Soft body objects differ from rigid body objects in that they can deform upon impact with other objects in the scene. To be included in a simulation as soft body objects, scene objects must have the Soft Body modifier applied and be members of a soft body collection. Soft body objects can interact with rigid body objects in the same simulation. Physical properties are assigned to soft body objects in the same manner that they are assigned to their rigid counterparts.

Creating the Collections

Before you can simulate the reactions between soft body objects, all objects considered in the simulation must be contained in a collection.

  1. Creating the Collections
    Creating the Collections
  2. Select all of the base objects, and then click the Create Rigid Body Collection button in the reactor toolbar. The icon is placed at the center of the selection, and the selected objects are added to the collection.

  3. Select the spheres and boxes with the Checker material applied.

  4. Click the Apply Soft Body Modifier button (

    Creating the Collections

    Note

    In 3ds Max 9, the Soft Body modifier is applied incorrectly when it is applied to instanced objects. It is applied to each instance for the total number of instances selected. For example, if you have eight instanced objects and apply the Soft Body modifier to them, each object will have the modifier applied to it eight times. For this exercise, the objects used are not instances.

  5. With the objects still selected, click the Create Soft Body Collection button (

    Creating the Collections
  6. Move the Collection icons away from the scene geometry. Your Perspective viewport should look similar to Figure 12.11.

Creating the Animation

In the previous exercise, the Havok 3 solver was selected because of its capabilities when using rigid body objects exclusively. With the combination of both soft and rigid objects in this exercise, the Havok 1 solver is the better choice.

The Perspective viewport with the rigid and soft body collections

Figure 12.11. The Perspective viewport with the rigid and soft body collections

  1. In the Utilities panel, click the reactor button and then choose Havok 1 from the drop-down menu in the About rollout.

    The Perspective viewport with the rigid and soft body collections
  2. Click the Preview Animation button in the reactor toolbar. Play the animation in the reactor Real-Time Preview window. The animation plays slower than the rigid body preview due to the more complex animation required by the deforming meshes.

    The Perspective viewport with the rigid and soft body collections

    Note

    In a complex scene, or on a slower computer, the reactor Real-Time Preview may display the scene at a rate that is too slow to easily determine the effectiveness of the simulation. In these cases, you need to create the animation and then, if revisions are required, delete all of the simulation objects' animation keys before making any changes and re-creating the animation.

  3. Close the Preview window.

  4. Select one of the spheres and then, in the Modify panel, change its Mass to 2, Stiffness to 4, and Friction to 0.1. Repeat this step with one more sphere and one of the boxes. The parameters of individual objects can be set in the reactor SoftBody Modifiers settings. The larger mass value will cause the object to impact with a greater force.

    The Perspective viewport with the rigid and soft body collections
  5. Test the animation again. Continue to make changes and then, when you are satisfied, Hold the scene.

  6. Click the Create Animation button in the reactor toolbar to create the animation using the properties assigned to the objects.

The Perspective viewport with the rigid and soft body collections

Summary

This chapter introduced you to both Max's non-event-driven particle systems and the reactor physics simulation engine. Using particles, thousands of seemingly random or purposeful objects can be animated by effectively manipulating the particle system's parameters. Particles can appear as primitive shapes, interconnecting blobs, or any instanced geometry object from the scene. Particle systems can be affected by external forces, such as gravity, wind, or vortex, and they can bounce off many types of deflectors positioned within the flow of particles.

The reactor component of Max is a powerful tool for creating accurate animations based on the interactions of scene objects. Rigid or soft body objects in collections can impact each other and deform, bounce, or slide away based on the objects' physical properties. Animations can be previewed and then thousands of animation keys can be created quickly to fulfill a scene's physics-based animation requirements.

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

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