Particle Reality Project -Extremely Flexible Particle System

Started by tusaki, January 19, 2006, 15:57:39

Previous topic - Next topic

tusaki

Hia,

I'm proud to announce that I'm finally ready to present the project I've been working on for the last couple of weeks. It's Particle Reality, an extremely versatile open source java particle engine. It is based on the ideas of a commercial partical animation software package named Particle Illusion by wondertouch software. (You can download a demo version)

Basically, the library allows you to define all aspects of particle and particle emitter behaviour over their entire lifetime in xml, allowing for a very flexible particle system.

A good place to start would be:

Here is a webstart demonstrating the system.


It is very easy to use in your own programs:
   // Loads the file 'particleset.xml' using the classloader: 
   ParticleEffectsManager.loadEffectsResource("/particleset.xml");

    // Gets the emitter with the name 'myEmitter' from the manager 
   Emitter myEmitter = ParticleEffectsManager.getEmitter("myEmitter");

    // Initialize the emitter using the Renderer (Do once) 
   OpenGLRenderer renderer = new SimpleOpenGLRenderer();
   renderer.initialize(myEmitter);

   // Updating and drawing the particles from the emitter (Do every frame) 
   renderer.render(myEmitter);


Here is an example of how a particle is described in xml
          <particle blendingMode="intense" shape="/img/smallblurstar.png" name="trail" useEmittersRangeAndAngle="true">
			<angle type="specific">
				<key frameNum="0" angle="45"/>
			</angle>

...

			<motionRandomnessVariation>
				<key frameNum="0" value="44"/>
			</motionRandomnessVariation>
			<bounceVariation>
				<key frameNum="0" value="0"/>
			</bounceVariation>
			<sizeOverLife>
				<key life="0%" percentage="160%"/>
				<key life="42%" percentage="140%"/>
				<key life="63%" percentage="120%"/>
				<key life="80%" percentage="75%"/>
				<key life="100%" percentage="0%"/>
			</sizeOverLife>
			<velocityOverLife>
				<key life="0%" percentage="120%"/>
			</velocityOverLife>
			<weightOverLife>
				<key life="0%" percentage="100%"/>
			</weightOverLife>
			<spinOverLife>
				<key life="0%" percentage="100%"/>
			</spinOverLife>
			<motionRandomnessOverLife>
				<key life="0%" percentage="100%"/>
			</motionRandomnessOverLife>
			<bounceOverLife>
				<key life="0%" percentage="100%"/>
			</bounceOverLife>
			<color>
				<key life="0%" red="255" green="126" blue="152"/>
				<key life="25%" red="255" green="141" blue="35"/>
				<key life="65%" red="255" green="252" blue="165"/>
				<key life="90%" red="0" green="0" blue="0"/>
			</color>
			<alpha>
				<key life="0%" percentage="100%"/>
				<key life="25%" percentage="100%"/>
				<key life="65%" percentage="100%"/>
				<key life="90%" percentage="0%"/>
			</alpha>
		</particle>


I don't think there are any aspects of particles which cannot be changed or modified, allowing for tons and tons of particle behaviours. Even better, you can download the demo version of particle illusion and mimic their massive library of particle emitters for effects including text-fading, explosions, worm holes, dripping. Or design your own.

A few main points which will be adressed in the future of this project will be to create a particle editor, optimize the system, make renderers for java2d and bring the particle system into the realm of 3d.

Enjoy, please let me know what you think and if you happen to use the program in one of your own projects or create a particle emitter, let me know. Besides, the project page is a wiki, so you can all expand on it, if you like :)

Kind Regards,
- Vincent Vollers

kappa

wow this looks extremly cool, runs nicly too about 32fps on my system (gf4mx) at 1280*1024.

Since this particles uses a XML system one of the first thought that came into my mind was if this could be modified to represent bullet barrages in shumps? a bit like a BulletML alternative.

any way it looks pretty good, i especially like the explosion particle effect, very cool.

Fool Running

Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

darkprophet

you might want to modify the JNLP so that people with 1.6 betas can run the demo too.

Simply change the lines that read:
    <resources>
       <j2se version="1.5" initial-heap-size="128M" max-heap-size="128M"/>
       <j2se version="1.4" initial-heap-size="128M" max-heap-size="128M"/>
       <jar href="particlereality.jar"/> 
       <jar href="lwjgl.jar"/>
       <jar href="lwjgl_util.jar"/>
     </resources>


to:

    <resources>
       <j2se version="1.4+" initial-heap-size="128M" max-heap-size="128M"/>
....


notice the 1.4+.

DP

tusaki

Quote from: "darkprophet"you might want to modify the JNLP so that people with 1.6 betas can run the demo too.

....

notice the 1.4+.

DP

done. tnx. :P

tusaki

Quote from: "javalwjgl"wow this looks extremly cool, runs nicly too about 32fps on my system (gf4mx) at 1280*1024.

Since this particles uses a XML system one of the first thought that came into my mind was if this could be modified to represent bullet barrages in shumps? a bit like a BulletML alternative.

any way it looks pretty good, i especially like the explosion particle effect, very cool.

Yes, it could. Because a bullet is nothing more than a particle anyway. (or the other way around). Particle Reality is intended for use in games. But you'll have to do your own collision detection. I'm glad you enjoyed it. Please have a look and contribute :)

darkprophet

heh, forgot to comment on the coolness of the demo :)

Its very cool, i have to say, the explosion is probably the best looking one and the most realistic. The gathering energy one is cool too, although i felt that it should have gone black instead of white in the centre...

FPS wasn't bad...but it could use some optimisation for the relatively small number of particles there. Im getting 30ish FPS.

Pver all, awsome! :D
DP

tusaki

great  :D

I have a GeForce 6800 GT + 2.4 Ghz Intel and get max FPS with any of the emitters. (refresh rate). I wonder if its the particle calculations or the simple drawing (just a loop with GL_TRIANGLE_STRIP to draw the particles) which causes the slowdown. It should be possible to get maximum fps out of a lesser system. What I'm doing is not -that- complicated. Any ideas?

Fool Running

QuoteI wonder if its the particle calculations or the simple drawing (just a loop with GL_TRIANGLE_STRIP to draw the particles) which causes the slowdown
That might cause some (if not all) of the slowdown. My sugesstion would be to enable vertex arrays (and other arrays you need) create arrays and Buffers and use the arrays for all of the particle rendering information and in the rendering loop put() the arrays into the Buffers. Then render the particles using glDrawArrays().
This is what I do and it works pretty fast (my texture coordinates don't change):
           
        vertexBuffer.clear();
        vertexBuffer.put(vertexes, 0, polyCount * 12).flip();
        colorBuffer.clear();
        colorBuffer.put(colors, 0, polyCount * 16).flip();
        texBuffer.flip();

        glVertexPointer(3, 0, vertexBuffer);
        glColorPointer(4, true, 0, colorBuffer);
        glTexCoordPointer(2, 0, texBuffer);
        glDrawArrays(GL_QUADS, 0, polyCount * 4);

I realize that there are faster methods for rendering, but this is the easiest of the fast methods  :lol:
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

darkprophet

you could create a single display list that holds the vertices, normals, texture coordinates. Then, rotate the modelview matrix to point towards the camera and do your math n stuff... (im supposing 1 colour for the entire quad)

That is probably the fastest method because most of the data needed to render are on the GPU anyway....

DP

tusaki

Yeah, I could do that. (The rendering is totally seperated from the animation anyway, in anticipation of a java2d renderer and/or different openGL renderers). I have only one problem, individual particles can have their own rotation. So, when using the method suggested above here, I have to do the rotations by hand, calculating the correct vertices. Mh. I'll go and make an example drawArrays renderer and do some benchmarks. Thanks again, Dark prophet, Fool Running.