CPSC 324, Spring 2004
Lab 11: Blender Particle Systems
BY NOW, YOU have some idea of the power of Blender. Today, you will look at one of its most interesting advanced features: particle systems. A particle system is essentially a bunch of free-moving vertices that are emitted by a mesh object. The particles have a finite lifetime. They have an initial velocity and can be affected by forces that simulate things like gravity and friction.
Partical systems are often used with a special kind of material called a halo, so before getting to the actual partical systems, the first part of the lab will introduce you to halo materials. By using halos and and animating various halo properties, you can make the particle system take on the appearance of things as varied as fog and fireworks.
It is also possible to place an object on each particle in a partical system, using "DupliVerts." The objects are all duplicates of one model object, and so are identical. This might be used, for example, to model a school of fish.
All the .avi files that are linked to this page can also be found in /home/cs324/lab11 so that you can run them easily with the xanim command. You'll also find sample Blender files that use particle systems there.
Exercise: For this lab, you should create one animation that uses a particle system. Save the animation in AVI JPEG format and put a link to the animation on your Web page, along with a description of how it uses particles. Also add at least one still image from the animation to your web page. Your animation should not be just a simple modification of one of my examples. Ideally, you should use a particle system in a scene that includes other objects. For example, use a particle system to make the exhaust of a rocket or the water in a fountain or the tail of a comet.
Halo Materials
A "halo" is a special kind of material that appears as a spark or glow at each vertex of a mesh object (or, as we shall see, at each particle in a particle system). When a halo material is applied to a mesh object, the faces and edges of the object are not drawn. Only the halo at each vertex is drawn. To apply a halo material to an object, add a material in the usual way. You will find a "Halo" button among the buttons in the center of the Material buttons window. If you click the "Halo" button, as I've done in the following image, you get a whole new set of options:
In the image at the right, I've applied a halo material to a 16-vertex mesh circle. The material settings that I used are shown above. A default halo is simply a ball of light, but you can add "Lines" and "Rings", as I've done here. You can control the basic halo color and the colors of the lines and rings separately, and you can set the number of lines and rings. The "Star" option changes the shape of the basic halo, and you can control the number of points on the star. If apply a texture to the object, the texture will make the color of the halos vary from vertex to vertex on the object. If you also turn on "Halo Tex", then the texture that is applied to the object is applied to each individual halo, which can be a very neat effect.
The "Halo Size" button is an important control. It allows you to set the size of the individual halos. The "Alpha" slider can be used to make the halos transparent.
Particle Systems
Particles can be emitted from any mesh object, but most often a plane or mesh circle is used. It's easy to get a plane to emit particles in a direction perpendicular to the plane, and it's easy get a mesh circle to emit them radially outward from the center of the circle. In the picture, particles have been emitted moving upwards from the plane. The particles also have a small random amount added to their velocities, which makes them spread out as they move. Note that in the default setting, which is used here, particles are emitted only from the vertices of the mesh. Often, you will want to decrease the size of the emitter so that it looks like all the particles are coming from about the same place.
In order to understand particles, you have to work with them a bit. Start with a plane object, as in Blender's default start-up configuration, go into camera view (Keypad-0), and move the plane down towards the bottom of the view. To add a particle system to the plane, make sure the plane is selected and go to the Animation buttons (F7). Click on the button named "New Effect" in the center of the Animation buttons window. Then switch the pop-up menu, which initially says "Build", to "Particles". A large number of buttons appear for controlling the particle system, as shown below. The first three buttons, "Total", "Sta", and "End" say that there will be 1000 particles in the particle system. The plane will start emitting them in frame number 1 and will stop in frame number 100. (Thus, 10 particles will be emitted in each frame.) The next button, "Life", gives the lifetime of the particles. That is, each particle lives for 50 frames after it is emitted and then disappears. The "Keys" button controls the number of key frames that Blender creates for controlling the particle animation -- more keys might give a smoother animation. The keys are created automatically; you don't have to do anything except set the number of keys. Leave these buttons at their default settings for now. The second row of buttons is used only for multi-generation particle systems, which are discussed later on this page.
The Remaining four rows of buttons are used to control the motion of the particles. If you leave them at their default settings, the particles will never move away from the position where they are born. (Note that this might actually be what you want--if the object itself is moving, if will drop off the particles as it moves.)
The "RandLife" button can add some randomness to the lifetime of the particles. Turing "Face" on causes the particles to be emitted from polygon faces rather than just from vertices. "Bspline" should make the motion smoother (and I don't know why you would ever want to leave it off). The "Vect" button assigns a vector to each particle which points in the direction the particle is moving. This vector will affect objects attached to the particle so that they change orientation as they move. You might need this, for example, if you were animating a school of fish, to orient them along the line of motion.
The remaining buttons affect the speed of the particles. "Norm", "Ob", "Rand" affect their initial velocities. "Norm" makes a particle move away from its emitter, in the direction of the normal vector of the emitter. If the emitter is moving, "Ob" tells how much of the object's velocity is transferred to the particle, making it move in the same direction as the object. "Rand" adds some extra speed in a random direction. Try these out on the plane. If "Norm" is positive and "Rand" is zero, the particles will move straight up from the plane. (To see the animation easily, go to frame 1 (Shift-Left-Arrow), then hold down the right arrow key.) Now if you change "Rand" to a positive value, you will get a picture more like the one shown above. If "Rand" is positive and "Norm" is zero, you will get a cloud of particles.
To see the effect of "Ob", you will have to animate the plane: Make it move from left to right between frames 0 and 100. You will also have to click the "Recalc All" button at the top of the particle system controls. Otherwise, Blender will not necessarily recalculate the particles' motion to reflect the new animation. You should use "Recalc All" to force a recalculation whenever you modify the emitter's animation. (The particles' motion is automatically recalculated when you change any of the settings of the particle systems controls.)
The "Damp" button adds friction. That is , it gives the rate at which moving particles slow down. The "X", "Y", and "Z" Force buttons apply a force to each particle that that will gradually accelerate it in a given direction. For example, a negative "Z" force will act like gravity, pulling the particles downwards. An "X" force will act something like wind, blowing the particles horizontally. (If "Tex" is non-zero, the velocity can be affected by a texture, which can add effects such as turbulence, but I haven't tried this.)
You should try some of the velocity controls. For example, You can make a "fountain" if you use a negative "Z" force along with "Norm", "Rand", and perhaps "Damp". Try a moving emitter with high values for "Ob" and "Damp" and perhaps a negative "Z" force -- smoke coming out of a smokestack might behave like this.
Halos and Objects for Particle Systems
The little white particles that you see in the 3D window are not visible in a rendered image. However, if you add a Halo material to the emitter, then each particle will appear as a halo in the rendered image. You can get various effects by using different settings for the halo properties. The "smoke" shown in this image is a particle system with relatively few particles and rather large halos. A Cloud texture is used as a HaloTex on the halos, to give each halo some variation in color. The texture just uses two slightly different shades of gray. The animated version of this is pretty effective. See smoke.avi (950K). The Blender file for this is /home/cs324/lab11/smoke.blend.
This example uses material animation to improve the smoke effect. As each particle ages, it gets smaller. This is accomplished by inserting animation keys for the "HaloSize" material property. (When you hit the "I" key in the Material button window, this property is listed as "HaSize" in the menu.) You could also animate the color or transparency of the halos. Note that the halo on each particle is animated separately, over the lifetime of the particle. For halo animations, the frame number has a peculiar meaning: Frame 1 corresponds to the beginning of the particle's life, and frame number 100 corresponds to the end. This is true no matter what the actual lifetime of the particle.
As an alternative to halos, it is possible to place a duplicate of an object at each particle. In the image, particles are emitted from a large vertical plane located at the left. There is a red cone at the position of each particle. This is not very difficult to do: Create the object that you want to duplicate. Make that object a child of the emitter. (Right-click the object, shift-right-click the emitter, press CONTROL-P, and confirm that you want to "Make Parent".) Now, select the emitter. Go to the Animation buttons (F9). Find the button named "DupliVerts" and click it. You will see a duplicate of the object at each particle. (As noted in a previous lab, DupliVerts can be used on any mesh, not just on meshes being used as particle emitters -- one copy of the duplicated object is made for each vertex of the mesh.)
An animation of the flying cones can be found in cones.avi (1.7M). In an alternative version, cones_with_x_force.avi (1.3M), I used a small initial velocity with a large force in the X direction to make it look like the cones were appearing on the left then accelerating rapidly to the right. You can find the blender file in /home/cs324/lab11/cones.blend.
For the cones example, I subdivided the emitting plane several times so that cones would be emitted from more points on the plane. However, I still had the problem that the cones were emitted in a very regular pattern. In a particle system, the vertices of a mesh take turns emitting particles. If the vertices are ordered in a regular pattern, then the particles are emitted in the same pattern. To fix this, I randomized the order of the vertices: Select the mesh, go into edit mode, and select all the vertices. Go to the Edit buttons (F9). Find the button named "Hash" and click it.
Bonus Info: Generations of Particles
A more advanced aspect of particle systems is the use of multiple generations of particles. (You are not required to know how this works.) When a particle reaches the end of its lifetime, it can give birth to one or more new particles. It is possible to assign a different material to each generation. You can even have a third generation. The picture is from a particle animation that uses two generations. The emitter in this example is a mesh circle that is moved along curve by path animation, dropping off particles as it goes. About 1/4 of these particles will bloom at the ends of their lifetimes into another generation of particles. The new particles are more orange than the originals. All the particles have a short lifetime and decrease rapidly in size. The animation can be found in sparkles.avi (400K), and the Blender file is /home/cs324/lab11/sparkles.blend.
The row of buttons labeled "CurMul", "Mat", "Mult", "Life", and "Child" control multiple generations of particles. "CurMul" tells which generation the other buttons are talking about. "Mat" determines which material is used for that generation (but if you want to know how to use multiple materials, you will have to look it up). "Mult" tells what fraction of particles in this generation give birth to new particles. Setting this to a value greater than zero gives a multi-generation particle system. The "Life" button gives the lifetime of the child particles, and the "Child" button gives the number of children generated. When you use multiple generations, the "Tot" button gives the total number of particles in the system, including children.
As an example using a plane as an emitter, set the "Mult" button to 1 and the number of children to 49. With "Tot" set to 1000, this will give exactly 20 first generation particles. Set both "Norm" and "Rand" to be positive, and use a negative "Z" force. Decrease the lifetimes of the particles. The particle animation will look something like fireworks, with each original particle blooming into 49 new particles. An animation that uses this technique can be found in firework.avi (529K).
Bonus Info: IPO Curves and Animation
A value that has been animated can be visualized as a curve that plots the value as a function of frame number. Such curves are called IPO curves (InterPOlation curves) in Blender. Blender has a type of window called an IPO Window for displaying and editing IPO curves. To see an IPO window, find the label "SCR:screen.001" at the top of the screen, next to the menu bar. There is a small menu button, with a little white rectangle, next to the label. Select "screen" from this menu. This will add an IPO window to the right side of the screen. (If your selection of screens does not include one with an IPO window, you can add one by hand. Blender's screen is actually highly configurable. You can split and join windows and change the type of a window. Ask how to do this, if you want. The "SCR" menu button allows you to select from pre-configured screens and to add new screen configurations. No matter which screen is selected, you are looking at the same 3D world. (The "SCE" menu button next to the "SCR" button lets you have more than one world in the same project file.))
An IPO window shows the IPO curves only for the currently selected object. Each curve has a name. The names are shown along the right edge of the window. When you left-click a name, the corresponding curve becomes visible and other curves are hidden. SHIFT-left-click to show multiple curves. (Initially, all the curves are visible anyway -- the names of visible curves are shown in white.) Next to each name is a colored rectangle. This shows the color of the curve. The IPO curves are actually Bezier curves, and you can edit them. To edit a curve, it must first be selected. You can select a curve by left-clicking the colored rectangle or by right-clicking the curve itself. Use the SHIFT key to select multiple curves. Use the A key to select/deselect all the curves at once.
The usual editing features work in the IPO window. Hit the Home key to fit the window to the size of the curves. You can use the middle mouse button with the shift or control key to change the view, and you can move in and out with the Keypad + key and the Keypad - key. You can drag or scale a selected curve using the "G" key or "S" key as usual. To make an animation shorter or longer, you can scale all the curves in the horizontal direction only. (Hit the G-key, start dragging the mouse, then hit the middle mouse button to restrict the scaling to one direction. It might then be necessary to drag the curves to get them to start at frame zero again.)
To change the shape of a curve, the curve must be in edit mode. Hit TAB to put the selected curve in edit mode. You will see the Bezier curve control points and handles, and you can manipulate them in the usual way. There is a control point for each key frame. Remember that while you are in edit mode, you can only work with the selected curve(s).
By default, animation in Blender is smooth. When an object starts moving, it starts out slowly and speeds up, for example. Often, this is not the behavior you want. You can modify the animation to use sharp transitions by editing the IPO curves. Select the curve or curves, go into edit mode, and select the vertices that you want to modify. Hit the "V" key. This makes the vertex into a sharp rather than a smooth corner. Alternatively, you can hit the "H" key, which makes it possible to drag a corner independently, so that you can make a corner at the point.
Towards the right end of the IPO window header, you will find four little buttons that determine what happens to the IPO curves outside the range of frames for which you specified key values. The first setting, which is the default, is that the value stays constant. That is, once the animation passes the last key frame, the object stops changing. The button for this option shows a horizontal arrow. The next button causes the curve to be extended in the direction that it is heading at its endpoint. The third option is to repeat the same curve over and over. This can be used to make cyclic animations. The fourth option repeats the same shape over and over, but the shape will be moved vertically or horizontally to make the endpoints match up. This could be used to make a spiraling motion, for example. To change the setting, select the curve or curves that you want to modify, and hit the appropriate button. Note that if the window is not wide enough to show these buttons, you can make them appear by dragging the window header to the left; to do this, control-middle-mouse-click-and-drag on the header that contains the buttons.)
Finally, the K key can be used to toggle "key display" mode. In key display mode, vertical lines are drawn through the curves to mark all the key frames that you have created for the animation. You can select one of these lines by right-clicking it, and you can then drag the line to move the key values to another frame. (By the way, the K key in the 3D world window toggles key display mode in that window as well. When key display mode is in effect, you see the positions of the objects for every key frame. As you change frames, you can see the object move from one key to another. You can't do anything with the keys, but seeing them can help you to get the animation right.)