Home | Business News | Browse by Publication | J | Java Developer's Journal

Star Trek technology Java3D: building a particle system for Java3D.

Publication: Java Developer's Journal
Publication Date: 01-JUN-05
Format: Online - approximately 4962 words
Delivery: Immediate Online Access
Full Article Title: Star Trek technology Java3D: building a particle system for Java3D.(FEATURE)

Article Excerpt
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 Java3 D.

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 + Random0 *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:

[FIGURE 1 OMITTED]

1. New particles are initialized and emitted using varying attributes.

2. Particles past their life expectancy die and are removed.

3. Surviving particles are updated based on external forces, velocity, etc.

4. The particles are rendered.

This cycle is repeated until the particle system has no more particles or lives beyond its lifetime. That's all you need to know to get started building a particle system, so let's build one for Java3D.

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...

View this article FREE - Now for a Limited Time, try Goliath Business News
Free for 3 Days!



More articles from Java Developer's Journal
OSS: the market landscape: why the OSS industry can--for the first tim..., June 01, 2005
Jtest 7.0.: by Parasoft.(LABS), June 01, 2005
MKS integrity suite 2005.(Labs), June 01, 2005

Looking for additional articles?
Search our database of over 3 million articles.

Looking for more in-depth information on this industry?
Search our complete database of Industry & Market reports by text, subject, publication name or publication date.

About Goliath
Whether you're looking for sales prospects, competitive information, company analysis or best practices in managing your organization, Goliath can help you meet your business needs.

Our extensive business information databases empower business professionals with both the breadth and depth of credible, authoritative information they need to support their business goals. Whether it be strategic planning, sales prospecting, company research or defining management best practices - Goliath is your leading source for accurate information.