Particle Engine

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki

Should i develop this further? Any interessted at all?

Yes!
59
57%
No!
3
3%
Yes and will this be added to Irrlicht?
42
40%
 
Total votes: 104

serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Re: Particle Engine

Post by serengeor »

Abraxas) wrote:If I understand the source correctly (and I'm an engineer not a programmer :/ ) after creating the pointers with "new" they get destroyed automatically by the system? no need to keep track of all the effects running?

I really like how well this is implemented into irr, which lacks a good particle system. I'm in the process of writing some middle level code which I'll release when I'm done.

Can I use this code in a commercial release?

Thanks.
Usually everything you create with new method you have to delete yourself. If you are talking about sudi's particle system, than I don't know for sure.
Working on game: Marrbles (Currently stopped).
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Particle Engine

Post by Abraxas) »

I was referring to the sample code that does this:

Code: Select all

    irr::scene::particle::IParticleAffector* affector = new ColorAffector(irr::video::SColor(0,100,50,0));
    drawer->addAffector(affector);
    affector->drop();
But now I see it works like the standard referencecounted of irr.

nice!
xirtamatrix
Posts: 219
Joined: Fri Feb 19, 2010 4:03 pm
Location: Estonia

Re: Particle Engine

Post by xirtamatrix »

Very impressive but...

I suggest you create an Editor where you can easily make these particle effects, then save them and then load into your irrlicht app.
For inspiration, take a look at Particle Universe, its a similar example for Ogre: http://www.fxpression.com/

This would increase the usability and popularity of your work a hundred-fold ;)
to live, is natural; to die, is not!
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Re: Particle Engine

Post by RdR »

I created a small patch to make the system relative to its parent (so particles moving along with the parent).

Code: Select all

 
--- CParticleDrawer.cpp 
-------------------------------
@@ -64,5 +64,5 @@
 void CParticleDrawer::drawParticles(irr::core::matrix4& transform, irr::video::IVideoDriver* driver)
 {
-    driver->setTransform(irr::video::ETS_WORLD, irr::core::IdentityMatrix);
+    driver->setTransform(irr::video::ETS_WORLD, transform);
 
     driver->setMaterial(getMaterial());
@@ -97,5 +97,4 @@
     rellocateBuffer();
 
-    irr::core::matrix4 viewMatrix = camera->getViewFrustum()->getTransform( irr::video::ETS_VIEW );
     irr::core::vector3df campos = camera->getAbsolutePosition();
 
@@ -133,5 +132,5 @@
             irr::core::vector3df view = particle->Position-campos;
             view.normalize();
-            createParticle(idx, particle, view, viewMatrix);
+            createParticle(idx, particle, view, transform);
 
             idx++;
 
 
CParticleSystem.cpp
-------------------------------
@@ -60,5 +60,5 @@
                     //view.normalize();
                 }
-                Drawer[i]->doParticles(SceneManager->getActiveCamera(), getAbsoluteTransformation(), timeMs, Paused ? 0.f : diff);
+                Drawer[i]->doParticles(SceneManager->getActiveCamera(), irr::core::IdentityMatrix, timeMs, Paused ? 0.f : diff);
             }
         }
@@ -120,5 +120,4 @@
             irr::f32 diff = timeMs-LastTime;
             diff /= 1000.f;
-            updateAbsolutePosition();
             update(timeMs, diff);
             ISceneNode::OnAnimate(timeMs);
@@ -128,7 +127,8 @@
         void CParticleSystem::render(void)
         {
+               core::matrix4 trans = getAbsoluteTransformation();
             for (u32 i=0;i<Drawer.size();++i)
             {
-                Drawer[i]->drawParticles(AbsoluteTransformation, SceneManager->getVideoDriver());
+                Drawer[i]->drawParticles(trans, SceneManager->getVideoDriver());
             }
         }
 
 
--- CBillboardParticleDrawer.h
-------------------------------
+void drawParticles(irr::core::matrix4& transform, irr::video::IVideoDriver* driver);
+void doParticles(const irr::scene::ICameraSceneNode* camera, const irr::core::matrix4& transform, irr::u32 timeMs, irr::f32 diff);
 
 
--- CBillboardParticleDrawer.cpp
-------------------------------
+void CBillboardParticleDrawer::drawParticles(irr::core::matrix4& transform, irr::video::IVideoDriver* driver)
+{
+        irr::core::matrix4 newTransform = irr::core::IdentityMatrix;
+        newTransform.setTranslation(transform.getTranslation());
+        CParticleDrawer::drawParticles(newTransform, driver);
+}
 
+void CBillboardParticleDrawer::doParticles(const irr::scene::ICameraSceneNode* camera, const irr::core::matrix4& transform, irr::u32 timeMs, irr::f32 diff)
+{
+        irr::core::matrix4 newTransform = transform;
+        irr::core::matrix4 viewMatrix = camera->getViewFrustum()->getTransform( irr::video::ETS_VIEW );
+        newTransform.setRotationDegrees(viewMatrix.getRotationDegrees());
+        CParticleDrawer::doParticles(camera, newTransform, timeMs, diff);
+}
 
void CBillboardParticleDrawer::createParticle(const irr::u32& id, const Particle* particle, const irr::core::vector3df& view, const irr::core::matrix4& transform) {
        irr::f32 f = 0;
-       if (particle->Rotation.X != 0) {
+   if (false) {
 
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: Particle Engine

Post by sudi »

Reuploaded the ParticleEngine linked seamed to be deleted.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: Particle Engine

Post by sudi »

Added option to make the particles follow its own node origin.

Just call:

Code: Select all

 
particleEngine->setLocalParticles(true);
 
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Re: Particle Engine

Post by Virion »

Sudi wrote:Added option to make the particles follow its own node origin.

Just call:

Code: Select all

 
particleEngine->setLocalParticles(true);
 
nice. this is especially useful for fast moving objects.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: Particle Engine

Post by sudi »

Bugfix: now the rotation of particlesystem that are local works correct.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: Particle Engine

Post by sudi »

Bugfix: now the trail and oriented particle drawers work as well in local mode
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
ikam
Posts: 46
Joined: Sun Jun 24, 2007 4:46 pm
Location: France

Re: Particle Engine

Post by ikam »

I am interested in your work, link is broken ?
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: Particle Engine

Post by sudi »

Yeah rapidshare seams to delete files after some time.
updated the link in the first post
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
ikam
Posts: 46
Joined: Sun Jun 24, 2007 4:46 pm
Location: France

Re: Particle Engine

Post by ikam »

thanks lot ;)
christianclavet
Posts: 1638
Joined: Mon Apr 30, 2007 3:24 am
Location: Montreal, CANADA
Contact:

Re: Particle Engine

Post by christianclavet »

Hi, @Sudi. I'll host your file on my web site if the link dies then this should help maintain the availability. I'll will try to follow your updates and update the link as it's change.

(From post with compiled example, assets and MSVC project, old source.)
http://www.clavet.org/files/download/Sudi_PARTICLES.zip 4.97Mb

(New updated source with example)
http://www.clavet.org/files/download/Pa ... ne.tar.bz2 2.55Mb
Last edited by christianclavet on Wed Feb 27, 2013 11:38 pm, edited 1 time in total.
RdR
Competition winner
Posts: 273
Joined: Tue Mar 29, 2011 2:58 pm
Contact:

Re: Particle Engine

Post by RdR »

Maybe its better to also add it to the IrrExt project
http://sourceforge.net/projects/irrext/
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: Particle Engine

Post by sudi »

RdR wrote:Maybe its better to also add it to the IrrExt project
http://sourceforge.net/projects/irrext/
Better not. The ParticleEngine is part of a bigger project of mine and if it would be in IrrExt i would have to update two code sources when i add features in the future.
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by renovation:tinkering,improving,planting flower beds.
Post Reply