[osg-users] Creating a flame of rocket

Suraj Paul suraj at isac.gov.in
Sat Sep 24 23:46:20 PDT 2016

Hi all,

I am trying to create a exhaust flame of a moving rocket similar to one shown in attached image 1. I need only the exhaust plume of the rocket. The rocket is moving [b]fast[/b]. To do so,
I used osgParticles to make the particle system as shown below in code:

sg::ref_ptr<osgParticle::ParticleSystem> ps =    new osgParticle::ParticleSystem;
 ps->getDefaultParticleTemplate().setShape(    osgParticle::Particle::QUAD); 
 ps->getDefaultParticleTemplate().setLifeTime( 0.50f ); 
 ps->getDefaultParticleTemplate().setSizeRange( osgParticle::rangef(0.5f, 0.1f) ); 
 ps->getDefaultParticleTemplate().setAlphaRange( osgParticle::rangef(0.5f, 0.0f) );
 ps->getDefaultParticleTemplate().setColorRange(osgParticle::rangev4(osg::Vec4(45.0/255.0f,179.0/255.0,217/255.0f,1.0f), osg::Vec4(172.0/255.0f,225.0/255.0f,240/255.0f,1.0f)) );
 ps->setDefaultAttributes("smoke.rgb", true, false );

 osg::ref_ptr<osgParticle::RandomRateCounter> rrc =  new osgParticle::RandomRateCounter;
 rrc->setRateRange( 100, 200 ); //200-800
 osg::ref_ptr<osgParticle::ModularEmitter> emitter =    new osgParticle::ModularEmitter;
 emitter->setParticleSystem( ps.get() );
 emitter->setCounter( rrc.get() );
 osg::ref_ptr<osgParticle::RadialShooter> shooter = new osgParticle::RadialShooter;
 shooter->setThetaRange(osg::DegreesToRadians(-0.50), osg::DegreesToRadians(0.50) );
 shooter->setInitialSpeedRange( 1.5f, 1.0f );
 emitter->setShooter( shooter.get() );

 osg::ref_ptr<osgParticle::ModularProgram> program =   new osgParticle::ModularProgram;
 program->setParticleSystem( ps.get() );

I observe that this creates a flame good for a stationary rocket. But as the rocket is moving fast, it leaves patches of Quad particle behind on it trail. Shown in attached image 2.

I reuced the lifetime of particles, but it didn't help.

I want to avoid making the trail. I need the particles to appear as in image 1, even when the rocket moves forward.  How to do it??

I feel i need to make the emitted particles to also move along with rocket. 
The particle system is already a child of MatrixTransform that supplies motion to rocket. 

i read the osgparticleffect.cpp but the customization shown der didn't help much.. Any help on creating this effect???

Thank you!


Read this topic online here:


More information about the osg-users mailing list