Fireworks using Spawner


By: Anupam Das


Requirements:
Particle Storm 2.0 Pro and LightWave 5.5 or higher.
Sample Content location: Tutorials/PStorm2/Fireworks/
Basic Overview:
In this tutorial we will be creating an elaborate fireworks display using Spawner, Fountain Emitter, and Particle Shader. To create our fireworks display, we’ll need some rockets. We’ll launch these rockets at random time intervals, and when they rockets reach their peak altitude, they will detonate, creating a beautiful umbrella of colored fireworks. Let’s explore how we can use Particle Storm to achieve such an effect.
Initial Setup:
Clear the Project. You should now be using your default project settings. The default project should contain a Particle Group, a Fountain, and Gravity. This may be different if you are using your own default project, so make sure these items are created before starting this tutorial.
Creating the Rocket Particles:

1. Select the Particle Group.
2. Set the "Name" to RocketGroup. Do the same for the effect file base. You can also click on the File button and browse for a directory where you want to put the resulting PSM data file. Once you have selected a directory, type in a name in the file dialogue's edit box. After clicking ok, you should see the path and name of your effect file base.
3. Let’s have a total of 10 rockets so set the number of Particles to 10.
4. Select Recycler. Turn off RocketGroup in its Affected Particle Group list. After our 10 rockets have ignited, our fireworks display is permanently over.
5. Set the particle shape to "Ticks". NOTE: The ticks option is not available on PS2 MAC OS. This will help us differentiate the rockets from the explosions. This is only for viewing purposes.
6. Go to Simulation and set the simulation time to 10 seconds.
Particle Group Settings

Animating the Rocket Particles:
1. Select Fountain (Create a new instance of a fountain if one does not exist already).
2. Set the orientation of the fountain to H=0, P=-90, B=0. We now have our rockets discharging upward.
3. If you are using the default project settings that come with PS2, you should also see that an instance of Gravity has been applied to the particles. This is fine. If there is no Gravity instance, add one at this time.
4. Back to the fountain emitter, set the minimum speed to 15 m/s and the maximum speed to 25 m/s.

Particle Storm will randomly choose a velocity for a rocket between these two values. This will create a more random effect.

5. Hit Play in the Preview Window to see the particles spraying upward fairly rapidly. At this point you’ll probably need to position the camera so that you can see the entire spray better.
6. You can also control the spread of the particles (the angle at which they are emitted). Set the Minimum Angle to 0 degrees and the Max Angle to 30 degrees. Particle Storm will randomly select an angle to discharge the particles between these two values.
7. Notice that the particles all spray out pretty rapidly. We want our fireworks display to gradually launch rockets, not launch all the rockets at once. To slow down the rate at which the fountain launches the rockets, we’ll control the birth rate of the particles. In Fountain Emitter, set the birth rate to 5 particles per second. Having 10 rockets on hand, and launching 5 rockets per second, we have about 2 seconds to launch all of our particles.

Taking a quick glance at our preview window, notice how the particles are being launched more gradually.
The rocket particles so far.

Extinguishing the Rockets:

When the rocket reaches a certain altitude, we’ll want to disappear because we don’t need them anymore.

1. Create an instance of Death Wish.
2. Set the Death By value to Age. This will kill the particles a certain time after they are born.
3. Set the Death Value to 1.5 seconds. This value was determined by trial and error.
4. Observe the preview window. The particles will now be moving as usual, but they will disappear after 1.5 seconds. It is at this point that the explosion should occur.

We now have some rockets blasting off and disappearing when they reach a certain age. It is at this point that we want the rocket to explode and discharge a colorful glowing umbrella of particles.
Death Wish settings for RocketGroup

Creating the Explosion:

We want the timing of each explosion to be in-sync with the death of each of the rockets. Since each rocket dies at a different time interval, it would be quite difficult to time each of the multiple explosions that must occur. We need to have some automated way of doing this. Enter Spawner. Spawner can emit more particles based on a input parameter, like the age of another particle. What we want to do in this situation is tell Spawner that when a particle (our rockets) dies, to spawn more particles. The spawned particles will essentially represent the individual explosions..

1. Create an instance of a Particle Group. (Right click on Particle Group and select Create). Name it ExplosionGroup. Set the effect file base like we did previously.

Note: This is your second particle group in the current project. (Our first was RocketGroup). Remember to make the effect file base name unique.

2. Set the number of particles to 1000.

We have now created the particle group that Spawner will use when new particles will be spawned.

Particle Group settings
Creating a Spawner:
1. Go to Fountain. Deselect ExplosionGroup from the Affected Particle Groups list.
2. Go to Death Wish and Deselect ExplosionGroup from its Affected Particle Groups list.
3. Now create an instance of Spawner. (Right click on Controllers and select Spawner from the list)
4. Select ExplosionGroup for Spawner's Affected Particle Group. Leave all other groups unselected. What we’ve just done is tell the Spawner controller that it is to only use particles from this group to make the explosions.

Using Spawner:
1. Still within Spawner, scroll down to where it says Test Particle Groups. Expand the list and select ONLY the RocketGroup particle group.
We do this because we want our fireworks to explode (or spawn) after the rockets have reached their burnout stage (which as you will remember we set in Death Wish).
2. Set the test parameter to Age because we’ll be spawning particles based on the life span of the rockets.
3. Set the test parameter Minimum value to 1.4 and the Maximum to 1.5. What we’ve just done is tell Spawner that when the rockets are between 1.4 and 1.5 seconds old, begin spawning particles.
4. Hit Play and watch the particles explode! You should see the rockets taking off, and then the fireworks particles exploding. This should look very natural and random since the particles are being emitted at random time intervals and are dying at random time intervals. If you do not see particles being spawned, go back to "Creating a Spawner" and trace through the steps carefully.

Spawner now has enough information to begin spawning particles when a rocket particle is 1.5 seconds old.


Spawner parameters

Setting the blast settings:

1. The remaining parameters in Spawner are identical to fountain emitter. You can think of this as a "Spawner emitter".
Source Scale: x=0.y=0,z=0
Minimum Angle: 0 degrees
Maximum Angle: 360 degrees
Minimum Speed: 2 m/s
Maximum Speed: 7 m/s
Birth Rate: 1000 particles/sec


Optional: Set the Initial Color to Red. This way you’ll be able to tell the spawned particles apart from the rockets.

2. Observe the animation in the preview window. The explosion particles should animate much more realistically. Notice that the explosion particles never fade away. We’ll want nice fade away to the explosion (as should happen when glowing particles lose their energy). To do this, we add a Death fadeout.

Adding Death fadeout to the explosion particles:

1. Just like we did for the rockets, create a Death Wish instance.
2. Select only ExplosionGroup as the affected particles.
3. Set the Death By value to Age.
4. Set the Death Value to .5 and the Fade Duration to 1s.
5. Set the Probability to 70%. This will randomize the death of each particle to create a more natural fadeout.
6. Observe the animation in the preview window. The fireworks look a lot more natural when they explode and gradually fade out.
Adding some color.


Let's use Particle Shader to add some animated color to the fireworks.

1. Create a Shader Instance.
2. Make sure that only ExplosionGroup is select for the affected particle groups.
3. We’ll shade the particles based on their age, so select Age as the Independent Variable.
4. Select Color Path. This will bring up the special color path editor. This tutorial assumes you have already made yourself familiar with the color-path editor. If not, please refer to the color-path reference at this time.
5. Create a color key at .2 seconds and set the color to a red. Create another color key at 1.1 seconds. Set the color to blue.
6. Observe the animation in the preview window. You should see the particles starting out as red hot, and cooling off to a blue color as they get older.
Conclusion:
This concludes the fireworks animation tutorial. You can record the animation and import it into Layout. Use the steps outlined in the sections titled "Recording Particles" and "Importing Particles".
If you got lost somewhere, the project file for this tutorial is included in the content directory for this tutorial. You can load the project and record the animation.