Particle trails

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
Rush
Posts: 14
Joined: Wed Nov 24, 2004 11:00 am
Location: Hell

Particle trails

Post by Rush »

Because Irrlicht doesn't allow particles to leave trails, I've written a patch that implements it. Basically, it's adding an emitter that makes the particle system act as trail generator for another particle system.

These screenshots show a simple explosion-like particle system without and with trails:
Image
Image

The zip with the patch contains some usage information, but I'm posting here the code with which the second screenshot was generated:

Code: Select all

 IParticleSystemSceneNode *particle_node = scenemgr->addParticleSystemSceneNode(false);
 particle_node->setParticleSize(dimension2d<f32>(10.0,10.0));
 IParticleEmitter *emitter = particle_node->createPointEmitter(vector3df(0.0,0.1,0.0),10,20,
                         SColor(255,255,255,255),SColor(255,255,255,255),
                        4000,4500,180);
 particle_node->setEmitter(emitter);
 emitter->drop();
 particle_node->setMaterialFlag(EMF_LIGHTING,false);
 particle_node->setMaterialTexture(0,driver->getTexture("fire.bmp"));
 particle_node->setMaterialType(EMT_TRANSPARENT_VERTEX_ALPHA); 

 IParticleSystemSceneNode *trail_node = scenemgr->addParticleSystemSceneNode(false);
 trail_node->setParticleSize(dimension2d<f32>(10.0,10.0));
 emitter = trail_node->createTrailEmitter(particle_node,60,200,0.0,
                                                         vector3df(0.0,0.0,0.0));
 trail_node->setEmitter(emitter);
 emitter->drop();
 IParticleAffector *affector = trail_node->createFadeOutParticleAffector(SColor(0,0,0,0),200);
 trail_node->addAffector(affector);
 affector->drop();
 trail_node->setMaterialFlag(EMF_LIGHTING,false);
 trail_node->setMaterialTexture(0,driver->getTexture("fire.bmp"));
 trail_node->setMaterialType(EMT_TRANSPARENT_VERTEX_ALPHA);
Download the patch here: http://taidus.w.interia.pl/particle_trail_patch.zip
Mr_Bloodworth
Posts: 11
Joined: Thu Nov 04, 2004 4:26 am

Post by Mr_Bloodworth »

Nifty...

Question from a artest/noncoder...

Isnt this just making more "particles" that get smaller in size over time?

As in...insted of one "particle" its making like ten that over time get smaller (seconds whise)?

still cool.

As an artest im still wating on tool sets for all this stuff you guys are making for this engine. :lol:
Rush
Posts: 14
Joined: Wed Nov 24, 2004 11:00 am
Location: Hell

Post by Rush »

Not smaller in size, because in Irrlicht all particles in a system have the same size. It looks like that with the fadeout affector, which decreases a particle's alpha value over time so it appears more and more transparent.
Electron
Posts: 874
Joined: Sun Mar 14, 2004 12:05 am
Location: Massachusetts USA

Post by Electron »

Nice work
BTW something like this is already in IrrlichtNX.
You do a lot of programming? Really? I try to get some in, but the debugging keeps me pretty busy.

Crucible of Stars
Mr_Bloodworth
Posts: 11
Joined: Thu Nov 04, 2004 4:26 am

Post by Mr_Bloodworth »

Mr_Bloodworth wrote:Nifty...

Question from a artest/noncoder...

Isnt this just making more "particles" that get smaller in size over time?

As in...insted of one "particle" its making like ten that over time get smaller (seconds whise)?

still cool.

As an artest im still wating on tool sets for all this stuff you guys are making for this engine. :lol:
Is This being applyed to ALL particals?

When using particals for flames like a torch you need...direction (x,y,z and any angle inbetween),rotation (CCW,CW),size (px,%),transparency.

This could effect things of that nature...Is it self contained..as in some sort of "flag"...

I i diont make sence im sorry.

Just askin.
*if I stare at you Blankley its because I don't know hat you just said...im no coder*
Rush
Posts: 14
Joined: Wed Nov 24, 2004 11:00 am
Location: Hell

Post by Rush »

Um... I'm not sure if I understood the question.

It creates a new particle for each particle in the base system, in short intervals (e.g. 50 ms). This increases polygon count quite a bit, but I think the effect's worth it.

The variables it takes from the "base" particles is position and optionally color (including alpha). AFAIK, particle rotation doesn't work in Irrlicht.
Post Reply