Chapter 22. Flocking Boids


Other Java 3D Approaches

The particle systems in this chapter were coded with BY_REFERENCE geometries and GeometryUpdater, but what other ways are there of writing particle systems?

One possibility is to represent each particle by a separate transformGroup and Shape3D pair and have the particle system move the shapes by adjusting the transformGroups. This coding style is utilized in an example by Peter Palombi and Chris Buckalew, which is part of Buckalew's CSc 474 Computer Graphics course (http://www.csc.calpoly.edu/~buckalew/474Lab5-W03.html). It has the advantage of being simple to understand but isn't scaleable to large numbers of particles.

Another technique is to store all the particles in a GeometryArray as before, but do the updates directly without the involvement of a GeometryUpdater. Synchronization problems can be avoided by detaching the Shape3D from the scene graph before the updates are made and reattaching it afterward. The detachment of the shape removes it from the rendering cycle, so synchronization problems disappear. There seems little advantage to this approach since the overhead of removing and restoring scene graph nodes is large.

If the application uses mixed mode or immediate mode rendering, then the programmer gains control of when rendering is carried out and can avoid synchronization problems.

The excellent Yaarq demo by Wolfgang Kienreich (downloadable from http://www.ascendancy.at/downloads/yaarq.zip) is a mixed mode Java3D example showing off a range of advanced techniques such as bump mapping, reflection mapping, overlays, and particle systems. It utilizes a BY_REFERENCE TriangleArray and a GeometryUpdater. The particle attributes include size, position, direction, gravity, friction, alpha values for transparency, and a texture applied to all the particles.

There are three particle systems available at the WolfShade web site (http://www.wolfshade.com/technical/3d_code.htm), coded in retained, mixed, and immediate modes. They don't use BY_REFERENCE geometries for storing the particles.



Killer Game Programming in Java
Killer Game Programming in Java
ISBN: 0596007302
EAN: 2147483647
Year: 2006
Pages: 340

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net