
By Mike Jacobs | Article Rating: |
|
July 31, 2005 07:15 PM EDT | Reads: |
98,131 |

The Star Trek universe has inspired many technology ideas but I'm disappointed I don't have a transporter yet. One Star Trek technology that has been available for sometime is the particle system. No, this is not an exotic propulsion system for your flying car. The particle system was invented to animate the Genesis effect in Star Trek II: The Wrath of Khan. While the Genesis device was used to transform a barren planet into one full of life, we can adopt this technology for more modest effects in Java3D.
In the Beginning
In previous articles, we've focused on creating planetary surfaces with Java3D. One challenging area of graphics programming is rendering irregular or ill-defined objects like clouds, smoke, or fireworks. William Reeves faced that challenge when Lucasfilm was asked to create a planetary creation effect called the Genesis effect for Star Trek II: Wrath of Khan. The idea was that a planet would be hit with a missile that would transform it from a barren wasteland into one full of life. Explosions and flames on a planetary scale gave birth to a new form of animation called a particle system.
Reeves' original paper (see references) describes a particle system as one defined by clouds of primitive particles or points in three dimensions. These particles change and move with time making a particle system dynamic. How a particle changes or moves is based on a controlled stochastic process giving it a natural look. How particles evolve in a particle system is called the particle life cycle.
Your morning shower is just like a particle system. Particles are born and emitted by the system. Where the particles are born and where they are headed is assigned by the particle system. Your plumbing system determines the water temperature and velocity of the droplets. Particles exist and change under the influence of external forces. The room temperature and gravity affect how the water changes temperature and where it collides with you or the tub. So where does that fancy stochastic process come into play? To make the rate of particle emission, ejection angle, velocity, or any other attribute more interesting we need to vary them in slightly unpredictable ways. Reeves described the approach of adding a randomly selected variance to the central value of an attribute:
Attribute = CentralAttibuteValue + Random() * AttributeVariance
This approach can be applied to just about any attribute of the particle or the particle system. Figure 1 provides a simple example. The particle system evolves over time by repeating a series of steps and varying the attributes along the way. The steps are:
- New particles are initialized and emitted using varying attributes.
- Particles past their life expectancy die and are removed.
- Surviving particles are updated based on external forces, velocity, etc.
- The particles are rendered.
Transporting to Java3D
Before we build the particle system in Java3D, let's lay out the objectives. First of all, the particle system should be easy to add to the scene graph just like any other Java3D shape. We should allow the Java3D TransformGroup to be used to position and orient the particle system. The design should allow us to use anything from pixels to Shade3D objects for our particles. The particles should be emitted from a variety of nozzle shapes and be affected by external forces like wind or gravity. These objectives should give us the flexibility to graduate from simple water fountain particle systems to tornado simulations. Before we jump straight into an F5 tornado, let's get a simple spray working.
Figure 2 is a subset of a design that satisfies our particle system objectives. It's probably easiest to describe it from the bottom up so let's start with the Particle object. This obviously represents a particle in the particle system and logically maintains its position, velocity, and acceleration. I used the word "logically" because I am fibbing a bit to make it easier to describe. A ParticleEmitter object emits particles and controls the movement of the particles as you might expect. The particle emitter delegates the initial position of particles to a GenerationShape object. During the animation cycle, ExternalInfluence objects such as Gravity affect the particles. All of these objects are independent of Java3D so they could be used in other environments as well. Now I'm going to fess up about the particle location. The location of a particle is actually maintained by the particle emitter. This is done so that the locations of all particles can be shared in one array for use in a Java3D specific Shape3D implementation of a particle system.
Do You Have a Point, Spock?
So far we have satisfied just a few of our objectives. Let's use the particle emitter to make a single Shape3D particle system. We can do this by making ParticleSystem a subclass of the Shape3D class and using a PointArray for the geometry. Luckily for us, the particle emitter has a float array of particle locations that will fit nicely into a PointArray. This geometry class is about the simplest supported by Java3D, accepting a float value for each x, y and z location of the point. The geometry needs to change as the particles move so this means that this particle system should implement the GeometryUpdater interface. If you're not familiar with how to change the geometry of a Java3D shape during runtime, refer back to my previous article ("Casting Perlin's Movie Magic in Java3D" [JDJ, Vol. 10, issue 3]) for an overview. The last piece of the design is the ParticleSystemManager that is responsible for notifying the particle systems to run through their life-cycle steps. Before we dig into the details of how it works, have a look at two of the examples included in the source code and shown in Figure 3.
The particle system is created in Listing 1. The particle emitter is created with a point generation shape having a spread angle of 45 degrees, and specific central and variance values for emission rate, initial velocity, and particle lifetime. We fade the particles by adding the FadePoint influence to the particle emitter (one of many influence objects included in the source code). This influence gradually changes the transparency of the particle as it ages. Now the particle system is created with the emitter and a green particle color. Adding the particle system to the scene graph is not shown due to space constraints, but it's added just like any other Java3D shape. Finally the particle system manager is added to the scene graph and the animation begins.
The ParticleSystemManager is a Java3D behavior that notifies all active particle systems after a specified time has elapsed. I covered behaviors and their use in animation in my previous article so refer back to it if you need a refresher. This implementation uses a combination of elapsed frames and time to create a stable animation cycle. The particle system manager starts and maintains the Reeves particle system life cycle.
Published July 31, 2005 Reads 98,131
Copyright © 2005 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Mike Jacobs
Mike Jacobs is technology architect and Technology Fellow focused on using technology to improve health care.
![]() |
mnjacobs 09/05/11 03:04:00 PM EDT | |||
The commercial version of this particle system is now available free including the source. Visit here. |
![]() |
indie technologies 08/31/05 06:26:58 PM EDT | |||
http://www.indietechnologies.com now has this Java 3D technology available as a commercial product. |
![]() |
indie technologies 08/06/05 07:05:33 PM EDT | |||
This technology is being commercialized for Java 3D game developers. Visit www.indietechnologies.com for more information. |
![]() |
Java Developer's Journal 07/31/05 06:45:05 PM EDT | |||
Star Trek Technology for Java3D. The Star Trek universe has inspired many technology ideas but I'm disappointed I don't have a transporter yet. One Star Trek technology that has been available for sometime is the particle system. No, this is not an exotic propulsion system for your flying car. The particle system was invented to animate the Genesis effect in Star Trek II: The Wrath of Khan. While the Genesis device was used to transform a barren planet into one full of life, we can adopt this technology for more modest effects in Java3D. |
![]() |
Mike Jacobs 07/11/05 09:04:30 AM EDT | |||
If you are looking for the source it is at the following link (my previous comment had a period at the end of the link). |
![]() |
David Morris 07/01/05 09:25:29 AM EDT | |||
Mike, the stated link to the source code is invalid. Could you please update this link. Thanks, David |
![]() |
Mike Jacobs 06/30/05 10:13:20 AM EDT | |||
The web editor decided to do things a bit different than the past. The first mention of the listings (Listing 1) is a link to all of the code. The link is http://res.sys-con.com/story/jun05/99792/source.html. |
![]() |
Michael Yankowski 06/29/05 09:57:32 PM EDT | |||
I can't find any links to the source code. Thanks, |
![]() |
Mike Jacobs 06/16/05 11:32:10 AM EDT | |||
The source code is now current. |
![]() |
Mike Jacobs 06/16/05 09:20:07 AM EDT | |||
It looks like the source for this article is slightly down level. JDJ is working on it. Mike |
![]() Apr. 23, 2018 07:00 PM EDT Reads: 6,013 |
By Liz McMillan ![]() Apr. 23, 2018 07:00 PM EDT Reads: 13,624 |
By Elizabeth White ![]() Apr. 23, 2018 05:45 PM EDT Reads: 5,801 |
By Elizabeth White Apr. 23, 2018 05:30 PM EDT Reads: 7,424 |
By Pat Romanski ![]() Apr. 23, 2018 04:15 PM EDT Reads: 7,031 |
By Pat Romanski Apr. 23, 2018 02:45 PM EDT Reads: 1,462 |
By Liz McMillan Apr. 23, 2018 02:15 PM EDT Reads: 1,781 |
By Elizabeth White Apr. 23, 2018 01:30 PM EDT Reads: 1,824 |
By Yeshim Deniz ![]() Apr. 23, 2018 01:15 PM EDT Reads: 2,100 |
By Elizabeth White ![]() Apr. 23, 2018 01:15 PM EDT Reads: 4,118 |
By Pat Romanski Apr. 23, 2018 12:00 PM EDT Reads: 2,419 |
By Liz McMillan ![]() Apr. 23, 2018 12:00 PM EDT Reads: 5,276 |
By Liz McMillan ![]() Apr. 23, 2018 12:00 PM EDT Reads: 13,267 |
By Elizabeth White ![]() Apr. 23, 2018 11:00 AM EDT Reads: 7,121 |
By Yeshim Deniz Apr. 23, 2018 10:15 AM EDT Reads: 1,094 |
By Pat Romanski ![]() Apr. 23, 2018 10:15 AM EDT Reads: 8,785 |
By Liz McMillan ![]() Apr. 23, 2018 10:00 AM EDT Reads: 9,922 |
By Pat Romanski Apr. 23, 2018 09:30 AM EDT Reads: 2,317 |
By Pat Romanski Apr. 23, 2018 09:30 AM EDT Reads: 2,182 |
By Elizabeth White ![]() Apr. 23, 2018 09:15 AM EDT Reads: 6,542 |