Particle system - framerate dependant?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Particle system - framerate dependant?

Post by CuteAlien »

Turns out I already had written an example in the past to check such stuff. Had completely forgotten about that :-)

But I can't reproduce it. Lower FPS stuff obviously is less smooth, but I can't see a difference in the amount of particles. Check my particles.cpp from here: https://bitbucket.org/mzeilfelder/irr-p ... -micha/src
You can set FPS and all values etc, if you find some setting to reproduce your bug please tell me which one it is.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Foaly
Posts: 142
Joined: Tue Apr 15, 2014 8:45 am
Location: Germany

Re: Particle system - framerate dependant?

Post by Foaly »

If you want to have a trail, you can also try the motion trail scene node. http://irrlicht.sourceforge.net/forum/v ... =2&t=50765
It generates connected blades of geometry instead of separate particles.
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Particle system - framerate dependant?

Post by suliman »

Ill check the example code when i have time, thanks!

But regarding my earlier questions, does anyone know? I iterate:

1. Where is the particles and/or emitters updated? I dont place any function for this manually in my loop. Hidden? Baked into something like drawAll()? Where are new particles created, moved, drawn to the screen?

2. (If i can read the function asked about above this might not be needed aswering) If the emission rate is 300 particles/sec and current fps is 30, will it create 10 particles per update (per tick) then?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Particle system - framerate dependant?

Post by CuteAlien »

The update happens in drawAll(). And 2. sounds correct.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Particle system - framerate dependant?

Post by suliman »

thanks, but what is the name of the update function then? How can i see the actual code that creates particles, moves them, changes their size etc.

I think i need to do that to see whats wrong in my game.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Particle system - framerate dependant?

Post by CuteAlien »

The actual code is inside each emitter class. So for SphereEmitter it would be CParticleSphereEmitter::emitt.

But check the example I posted. It's a little tool that allows playing with all particle settings + changing framerate.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Particle system - framerate dependant?

Post by suliman »

Where do i find this file CuteAlien, doesnt seem to be in the normal included paths:

fatal error C1083: Cannot open include file: 'irr_ptr.h': No such file or directory
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Particle system - framerate dependant?

Post by CuteAlien »

@suliman: Ah, right, I used that back then. You can find it in the same folder.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Particle system - framerate dependant?

Post by suliman »

I get some errors (see below, probably older version of irrlicht? Im running 1.8)

Anyway i think my problem is about fast movement and the inability to create particles more often than 1 times per main loop update. I reduce the uglyness in lower fps by setting the particles to travel with a factor of the airplane in each each update and prolonging their lifetime. So basically they are denser and overlap more, so when spread out due to low fps, the gaps between them are less obvious.

I will check out the motion trails by foaly, seems useful to me...

Code: Select all

1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(107) : error C2039: 'setEnabled' : is not a member of 'irr::scene::ISceneNodeAnimator'
1>        c:\dropbox\project\code\irrlicht-1.8\include\iscenenodeanimator.h(30) : see declaration of 'irr::scene::ISceneNodeAnimator'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(112) : error C2039: 'setEnabled' : is not a member of 'irr::scene::ISceneNodeAnimator'
1>        c:\dropbox\project\code\irrlicht-1.8\include\iscenenodeanimator.h(30) : see declaration of 'irr::scene::ISceneNodeAnimator'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(117) : error C2039: 'setEnabled' : is not a member of 'irr::scene::ISceneNodeAnimator'
1>        c:\dropbox\project\code\irrlicht-1.8\include\iscenenodeanimator.h(30) : see declaration of 'irr::scene::ISceneNodeAnimator'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(122) : error C2039: 'setEnabled' : is not a member of 'irr::scene::ISceneNodeAnimator'
1>        c:\dropbox\project\code\irrlicht-1.8\include\iscenenodeanimator.h(30) : see declaration of 'irr::scene::ISceneNodeAnimator'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(142) : error C2039: 'EPB_INVISIBLE_EMITTING' : is not a member of 'irr::scene'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(142) : error C2065: 'EPB_INVISIBLE_EMITTING' : undeclared identifier
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(144) : error C2039: 'EPB_INVISIBLE_AFFECTING' : is not a member of 'irr::scene'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(144) : error C2065: 'EPB_INVISIBLE_AFFECTING' : undeclared identifier
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(146) : error C2039: 'EPB_INVISIBLE_ANIMATING' : is not a member of 'irr::scene'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(146) : error C2065: 'EPB_INVISIBLE_ANIMATING' : undeclared identifier
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(148) : error C2039: 'EPB_CLEAR_ON_INVISIBLE' : is not a member of 'irr::scene'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(148) : error C2065: 'EPB_CLEAR_ON_INVISIBLE' : undeclared identifier
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(150) : error C2039: 'EPB_EMITTER_VECTOR_IGNORE_ROTATION' : is not a member of 'irr::scene'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(150) : error C2065: 'EPB_EMITTER_VECTOR_IGNORE_ROTATION' : undeclared identifier
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(152) : error C2039: 'EPB_EMITTER_FRAME_INTERPOLATION' : is not a member of 'irr::scene'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(152) : error C2065: 'EPB_EMITTER_FRAME_INTERPOLATION' : undeclared identifier
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(153) : error C2039: 'setParticleBehavior' : is not a member of 'irr::scene::IParticleSystemSceneNode'
1>        c:\dropbox\project\code\irrlicht-1.8\include\iparticlesystemscenenode.h(46) : see declaration of 'irr::scene::IParticleSystemSceneNode'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(237) : error C2039: 'setParticleBehavior' : is not a member of 'irr::scene::IParticleSystemSceneNode'
1>        c:\dropbox\project\code\irrlicht-1.8\include\iparticlesystemscenenode.h(46) : see declaration of 'irr::scene::IParticleSystemSceneNode'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(352) : error C2039: 'setEnabled' : is not a member of 'irr::scene::ISceneNodeAnimator'
1>        c:\dropbox\project\code\irrlicht-1.8\include\iscenenodeanimator.h(30) : see declaration of 'irr::scene::ISceneNodeAnimator'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(361) : error C2039: 'setEnabled' : is not a member of 'irr::scene::ISceneNodeAnimator'
1>        c:\dropbox\project\code\irrlicht-1.8\include\iscenenodeanimator.h(30) : see declaration of 'irr::scene::ISceneNodeAnimator'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(375) : error C2039: 'setEnabled' : is not a member of 'irr::scene::ISceneNodeAnimator'
1>        c:\dropbox\project\code\irrlicht-1.8\include\iscenenodeanimator.h(30) : see declaration of 'irr::scene::ISceneNodeAnimator'
1>c:\dropbox\project\code\irrlicht-1.8\examples\04.movement\main.cpp(380) : error C2039: 'setEnabled' : is not a member of 'irr::scene::ISceneNodeAnimator'
1>        c:\dropbox\project\code\irrlicht-1.8\include\iscenenodeanimator.h(30) : see declaration of 'irr::scene::ISceneNodeAnimator'
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Particle system - framerate dependant?

Post by CuteAlien »

Hm, could be - I use trunk. And yeah - the thing with regular updates... we need some smoothing there. I've run into that one as well already. But don't want to do that per emitter - particle system needs a rewrite with a base-emitter first. Too much code identical over all emitters and attractors.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Particle system - framerate dependant?

Post by suliman »

another option might be to include spark engine or something similar if thats a quicker and possibly more robust solution. I dont know how hard that would be to integrate but it seems to have some nice stuff like multiplied colors combined with alpha channel and more modifiers.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Particle system - framerate dependant?

Post by hendu »

You can get that by writing a two-line shader, and likely it will be much more efficient that what Spark does too...
suliman
Posts: 379
Joined: Sat Sep 23, 2006 2:06 pm

Re: Particle system - framerate dependant?

Post by suliman »

Really? Care to help me out? I tried getting into shaders but failed miserably...

Im already using a hlsl-shader for texture splatting, but i didnt do it myself, but they wouldnt interfere with each other i guess...
couse right now i can have add/replace color OR alpha but not both with the built-in particle system.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Particle system - framerate dependant?

Post by hendu »

"Teach a man to fish" etc, and I don't do HLSL anyway. GLSL is somewhat simpler than HLSL, I can point to good books if you want.
Post Reply