Creating Cigarette Smoke
 
 
 

In this lesson, you use a particle system to create a stream of cigarette smoke trailing from an ashtray. The animation relies on space warps to affect the movement of the smoke. For example, you use a Wind space warp to model the fan in the scene blowing the smoke around.

Animation techniques used in this lesson:

Set up the scene:

Create the particle system:

  1. Activate the Top viewport.
  2. If you need to, select the ashtray and click Zoom Extents Selected to fit the ashtray in the viewport.
  3. In the Create panel, make sure Geometry is active, and choose Particle Systems from the drop-down list.
  4. On the Object Type rollout, click Super Spray.
  5. In the Top Viewport, click and drag in the ashtray near the tip of the cigarette object.

Super spray particle system in the Top viewport

Super spray particle system in a user view

You have now created a Super Spray particle system. The icon you see is called the emitter. The emitter doesn't render, but it shows the location in the scene where particles will be emitted. The arrow points up, indicating that initially particles will move upward out of the center of the icon.

When you create a Super Spray system, the particles are emitted toward you in the viewport you click. That is, they move along the Z axis in the positive direction. This is why we used the Top viewport to create the system.

(Different kinds of particle systems have differently shaped emitters, and different emission behavior.)

You are seeing the default behavior and settings for Super Spray. To get a more smoke-like effect, the first thing to do is adjust the Super Spray parameters.

Slow the particles down and make them easier to visualize:

  1. With the Super Spray particle system selected, go to the Modify panel.
    TipParticle systems have a large number of rollouts. If you like, you can expand the command panel to see more rollouts and controls at once. Move your mouse to the border between the command panel and the viewports, and drag the command panel to create multiple columns. The command panel can be widened whether it is floating or docked. To dock or float a command panel, right-click to one side of the tabs, and choose Float or Dock from the flyout menu.
  2. In the Basic Parameters rollout > Viewport Display group, change the display type to Dots rather than Ticks.

    For the purpose of working in viewports, especially when particles are very close together, Dots give a better preview than the plus-sign Ticks.

  3. In the Basic Parameters rollout > Particle Formation group, set the Spread value for Off Axis to 2.0.

    (This is the Spread spinner immediately below the Off Axis spinner, and not the Spread value associated with Off Plane.)

  4. In the Particle Generation rollout > Particle Motion group, set Speed to 1.5.

Now if you play the animation, you see the particles stream upward more slowly. The slight increase in the Spread value means they don't move in a completely straight line. (Spread is measured in degrees. Higher Spread values create a more fan-like pattern.)

However, the particles stop emitting at frame 30 and completely disappear from the scene at frame 100. To get a smoke effect, you also need to change the default values that govern particle generation and lifetime.

Adjust particle generation:

  1. In the Particle Generation rollout > Particle Quantity group, set Use Rate to 30.

    This increases the number of particles generated per frame from 10 to 30.

    NoteWhen you play the animation in the Camera02 viewport, you don't see 30 particles being emitted per frame. By default, in viewports, Super Spray displays only 10 percent of the particles actually being emitted. This keeps viewport playback fast. You can adjust the preview value in the Viewport Display group of the Basic Parameters rollout, but we recommend you keep it low. Previewing a large percentage of particles in a system can seriously slow down 3ds Max. When you render the animation, the rendering uses the full number of particles.
    TipA better way to preview the effect of all particles is to use the command Rendering > Make Preview.
  2. Also on the Particle Generation rollout, in the Particle Timing group, set both Emit Stop and Display Until to 300.

    The animation is 300 frames long. Setting Emit Stop to 300 means that particles continue to be emitted throughout the animation. Setting Display Until to the same value means that all particles that haven't died remain in the scene until the end of the animation.

  3. Continuing down, set the Life value to 180.

    A particle in this system dies 180 frames after it is emitted. Not all of the particles will last until frame 300.

Now the particles emerge in a denser cloud that doesn't move right out of the scene. This is more reminiscent of smoke. But the movement of the particle system still looks artificial.

Adding Wind, Turbulence, and Drag

Particles are not smart. Like sheep, you need to herd them. Space warps such as Wind and Gravity add directional fields that affect particle motion. In this simulation of cigarette smoke, you'll associate the fan with a Wind space warp that models the breeze from the fan.

Create a wind space warp to simulate a breeze from the fan:

  1. Go to the Create Panel and turn on the Space Warps button.
  2. Make sure Forces is the active space warp type.
  3. In the Object Type rollout, click Wind.
  4. Drag in the Left viewport to create the Wind space warp.

    Wind space warp created in Left viewport (facing away from user)

Position the wind space warp:

Wind space warp in Top viewport, before aligning to fan

Wind space warp in Top viewport, after aligning to fan

You don't have to be too accurate about aligning the Wind icon with the fan motor. The wind direction, and linking it to the motor's motion, are the important things.

Link the wind to the fan so their motion is coordinated:

Bind the wind space warp to the smoke particles:

  1. Select the Super Spray particle system.
  2. Click Bind To Space Warp, then click the Super Spray system, and hold the button down as you drag to the Wind space warp.

    When Bind To Space Warp is active and the cursor is over a selected object, the cursor changes to the space warp icon to inform you that this object can be bound to a space warp. Then when you drag from the object to the space warp, a line is drawn to show which object is being bound. Once off the object, the cursor changes again until it’s over a suitable space warp. Then it reverts to the space warp icon to inform you that this binding is legal. When you release the mouse, the bound space warp briefly highlights to indicate the binding is complete.

  3. Activate the Camera02 viewport, then play the animation.

    The effect of the wind is much too strong. The smoke is whipped around dramatically.

Adjust the strength of the wind:

By default, the Wind space warp’s Strength value is 1.0. Reducing the Strength value makes the effect of the fan look more realistic.

  1. Select the Wind space warp.
  2. In the Modify panel, set the Strength value to 0.03.
  3. Activate the Camera02 viewport, then play the animation.

    The smoke is more gently wafted now. But you can make the smoke's appearance more realistic still, by giving it a bit of inertia. To do so, you use another space warp.

Add a drag space warp:

  1. Go to the Create panel and click the Space Warps button.
  2. Make sure Forces is the active space warp type.
  3. On the Object Type rollout, click Drag.
  4. In the Top viewport, drag to create a Drag space warp near the Super Spray.

    Drag space warp created in the Top viewport

Set the drag space warp parameters:

The Drag space warp has a large number of parameters. For the purposes of this animation, you need to set only a few of them: Time Off, and the Axis percentages for Linear Damping.

  1. With the Drag space warp selected, go to the Modify panel. Set Time Off to 300.

    By default, the Time Off value is 100, but you need Drag to be active for the duration of the animation.

  2. With Linear Damping the active damping type, set the X and Y Axis percentages to 1.0, and the Z Axis percentage to 2.0.

    As with Wind, the Drag space warp doesn't affect the particles until you bind them to it.

Bind the drag space warp to the smoke particles:

  1. Click Bind To Space Warp, then in the Top viewport click the Super Spray system, and hold the button down as you drag to the Drag space warp.

    Now a drag force is applied to the particles. The force is non-uniform: there is more drag along the Z-axis (up and down in the scene) than in other dimensions.

  2. Activate the Camera02 viewport, then play the animation.

    The effect of the Wind space warp is decreased. The Drag warp slows down the particles.

Add turbulence to the wind:

The smoke looks better, but its motion is still unnaturally uniform. The solution is to make the Wind more turbulent.

  1. Select the Wind space warp.
  2. On the Modify panel, go to the Wind group box in the Parameters rollout. Set Turbulence to 0.03, Frequency to 0.12, and Scale to 0.1.

    The Turbulence value controls how much the particles are perturbed from their position. Frequency causes random variation in the turbulence, and Scale adjusts the size of the turbulence field.

    Why such low values? Actually, a good rule of thumb for turbulence settings is to start very low and work your way up. Turbulence creates a fractal noise field that is localized to the Wind space warp icon. The scale of this field needs to match the scale of your scene. The easiest way to do this is to start with low values and then increase them as needed.

  3. Activate the Camera02 viewport, then play the animation.

    The particles move much more like cigarette smoke, with wispy sways and curls.

    Also, the particles are blown in the current direction of the Wind space warp on a given frame. The effect is not conical with attenuation as it would be for an actual fan; instead, the effect of the wind and its turbulence is parallel.

Particle Geometry

While the movement of the smoke is now good, the particle geometry needs some adjusting.

Preview the particle system:

The particles still appear as a bunch of solid-looking dots (by default, they render as 3D triangles). To make them more convincing as smoke, first you adjust the particle geometry, then you apply an appropriate material to them.

Change the particle geometry:

  1. Select the Super Spray particle system.
  2. Go to the Modify panel.
  3. If one of the space warp bindings is chosen in the modifier stack, click the Super Spray entry so you can see the particle system's rollouts.
  4. In the Particle Type rollout > Standard Particles group, choose Facing.

    Facings are square particles that are constantly oriented towards the camera. If you rendered them as solid, they wouldn't appear realistic, either. But facing particles are meant to have a material applied to them. When facings are clumped together and a material gives them a degree of transparency, you can achieve a fairly realistic smoke.

    The size of the particles is uniform. In general, when you want realistically to model natural phenomena, you want to avoid uniformity.

Make the particle geometry more random:

Ideally, the particles should increase in size after they are born, and then fade out as they die. The Grow For and Fade For parameters let you do this. Also, to break up the unrealistic uniformity of the particle size, you need to add some variation to the size.

  1. With Super Spray still selected and the Modify panel still active, go to the Particle Size group near the bottom of the Particle Generation rollout.
  2. Set the Size to 2.0 and the Variation to 30 %.
  3. Set the Grow For value to 90 and Fade For to 30.

    In these last steps, you have increased the overall size of the particles and randomized this size by plus or minus 30 per cent. Each particle now grows for 90 frames, from an initial size of zero to the full size it will achieve. Thirty frames before it dies, it begins to shrink back down to a size of zero. (Remember that you have set each particle to live for 180 frames.)

Cigarette Smoke Material

Now that you've adjusted the particle geometry, you can shade the particles to look like smoke. The trick to this is to use a soft, partially transparent material that allows the particles to blend together and form a wispy smoke pattern. Because the particles are rendered as square facing geometry, a radial gradient with transparent edges can accomplish this.

Set up the material:

  1. Open the Material Editor.
  2. Choose an unused sample slot.
  3. On the Blinn Basic Parameters rollout, click the Diffuse color swatch to display the Color Selector.
  4. Set the Diffuse color to pure white (Value=255).
  5. Set both the Specular Level and Glossiness values to 0.
  6. Turn on the Self-Illumination Color check box.

    The Self-Illumination control changes from a spinner to a color swatch.

  7. Click the Self-Illumination color swatch. In the Color Selector, set the self-illumination color to a medium gray (Value=144).
  8. On the Shader Basic Parameters rollout, turn on the Face Map toggle.

    Use Face Map shading with Facing particles, so that each rendered particle displays the entire map.

    You now have a material that is pure white, partially self-illuminated with a medium gray color, and face mapped for particles.

Assign the material to the smoke particles:

To soften the smoke, you create a radial gradient with transparency at its edges.

Make a radial gradient map for the smoke particles:

  1. In the Material Editor, open the Maps rollout and click the Opacity map button.
  2. In the Material/Map Browser, choose Browse From: New, click Gradient, and then click OK.
  3. On the Gradient Parameters rollout, change the Gradient Type to Radial.
  4. Click Go To Parent to return to the base level of the material.
  5. On the Maps rollout, change the Opacity Amount value to 5.

    The Gradient map determines only five per cent of the opacity. Ninety-five percent of the opacity is still controlled by the base Opacity parameter. For smoke, make the particles as soft and semi-transparent as possible, especially with high particle counts. So the Gradient map should be the only thing that sets the Opacity of the particles, but you also want the overall Opacity to be very low. For this animation, you turn off the base Opacity value completely.

  6. In the Basic Parameters rollout, set the Opacity value to 0.

    The rendered scene now has very soft smoke that rises up, grows gradually in size, and is blown around and perturbed by the wind from the fan.

The Final Animation

You are now ready to activate the Camera02 viewport and render the entire animation. Even at low resolution, this can take about half an hour. Alternatively, you can play the file cigarette_smoke.avi, provided on the Tutorial Files CD.

Next

Creating Gushing Water