AdvancedParticleSystem with IrrEdit plugin

Post those lines of code you feel like sharing or find what you require for your project here; or simply use them as tutorials.
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

AdvancedParticleSystem with IrrEdit plugin

Post by Brainsaw »

I spent the last week creating an "Advanced Particle System Node" for Irrlicht. It's based on the original Irrlicht particle system node, but this node has some drawbacks:

- bad (de)serialization
- no cloning

I have written a node and plugin that adresses both of these. With the plugin you have some sort of a basic particle system editor in IrrEdit, and you can clone those nodes.

It's available for download at http://bulletbyte.de/products.php?sub=irr&show=aps.

If you want to see it in action you can grab the latest version of my IrrOde wrapper and try the IrrOdeCar demo (you know ... the demo with the misleading name ;) ). Just take the helicopter, the plane or the tank and shoot around and you'll see cloned particle systems.

Note: if you want to recompile the IrrOdeCar demo you also have to grab the advanced particle system. It's not part of IrrOde.[/list]
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

Just uploaded a new version: you can now (de)activate emission of particles and get the number of particles currently in.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

Nice one. Will take a look at the code whan have some time, I know its just a quick test, but would be better if the demo was just a little bit more interactive- switch emmiters in realtime, draw fps, draw number of particles (you did this already, but I ran the first version), being able to increase/decrease the number, and please Esc-to-quit. One copy-paste of a event receiver and adding those will be 15 minutes, but will improve the "experience" a lot. :)
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

OK, I modfied the demo. Now no particles are emitted initially, but there are a lot of buttons on the left that let you choose the emitter you want, and there are buttons to clone the node, remove the clone and deactivate the original (but the isActive method will return "true" as long as there are particles). Some info text is also there.

New version can be downloaded from the URL in the initial post.

Btw: I'm having problems with getting any particle emitter but the point one working in IrrEdit. Anyone got an idea?
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

I finally got the IrrEdit plugin with the advanced particle system working, and I added a new emitter: the "explosion emitter".

Take a look at the (updated) IrrOdeCar demo of my IrrOde wrapper. Now there are explosions whenever you shoot something. I like the changes (flew around with the airplane about an hour yesterday and did nothing but shoot at all dynamic objects in the scene :D ).
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
cookie
Posts: 83
Joined: Sun Aug 23, 2009 9:30 pm

Post by cookie »

How can I use this with Irrlicht 1.7.2?
When I compile my project and the CAdvancedParticleSystem.h is included the compiler can't find these files:

Code: Select all

 
  #include <CParticleSystemSceneNode.h>
  #include <CAttributes.h>
  #include "os.h"

  #include <CParticleAnimatedMeshSceneNodeEmitter.h>
  #include <CParticleCylinderEmitter.h>
  #include <CParticleSphereEmitter.h>
  #include <CParticlePointEmitter.h>
  #include <CParticleMeshEmitter.h>
  #include <CParticleRingEmitter.h>
  #include <CParticleBoxEmitter.h>

  #include <CParticleAttractionAffector.h>
  #include <CParticleRotationAffector.h>
  #include <CParticleFadeOutAffector.h>
  #include <CParticleGravityAffector.h>
  #include <CParticleScaleAffector.h>
Did I forget something?
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Post by shadowslair »

cookie wrote:Did I forget something?

Um, probably to link them properly?!
Try some of these:
1) add them to the irrlicht/include folder (I wouldn`t)
2) add them to separate folder and add it to the include directories` list
3) add them to your project and replace the < > with ""
4) some other way here
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
cookie
Posts: 83
Joined: Sun Aug 23, 2009 9:30 pm

Post by cookie »

The problem is: This files doesn't exist, so I can't link them to my project...
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

Hi,

the files do exist, but that are Irrlicht files. You have to search the Irrlicht directory for those files, add them to your project and also include the folder in the header search path. Unfortunately this is quite a hack, but it was the only way I found to get the system working (and it works quite good for me).
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
cookie
Posts: 83
Joined: Sun Aug 23, 2009 9:30 pm

Post by cookie »

The files doesn't exist in my Irrlicht Include folder .__.

There are just a few with a "IParticle..." prefix and not with a "CParticle..." and there are not all the files which I listet in a post before with an "IParticle...." prefix.

I'm using Irrlicht 1.7.2
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

You can find those files in the source/Irrlicht folder. These files are normally hidden from Irrlicht users (as you do normally not need them).
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
cookie
Posts: 83
Joined: Sun Aug 23, 2009 9:30 pm

Post by cookie »

Ah, thank you.

But now I get many Errors like this:

Code: Select all

bla|549|undefined reference to `irr::scene::CParticleAnimatedMeshSceneNodeEmitter::CParticleAnimatedMeshSceneNodeEmitter(irr::scene::IAnimatedMeshSceneNode*, bool, irr::core::vector3d<float> const&, float, int, bool, unsigned int, unsigned int, irr::video::SColor const&, irr::video::SColor const&, unsigned int, unsigned int, int, irr::core::dimension2d<float> const&, irr::core::dimension2d<float> const&)'|
I added the sourcecode path of Irrlicht to my include-directory-list.
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Post by Brainsaw »

Hmm ... that's strange. It got it compiled with Irrlicht 1.7.2 without any problems.
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
Brainsaw
Posts: 1176
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Re: AdvancedParticleSystem with IrrEdit plugin

Post by Brainsaw »

I have uploaded an update for the "AdvanceParticleSystem" scenenode. It fixes an issue I've been struggling with for quite some time: in my main project (the IrrOdeCar demo of the IrrOde wrapper) the particle systems that simulate the exhaust of the cars looked strange:

Image

This comes from the fact that the simulation is stepped, there are 60 frames per second. Between these steps the position is not updated, so the smoke is generated in these positions between. As a solution I have added two ways to solve this:

- interpolated: the velocity of the last position change is recorded and if the position is not changed an interpolation is done. There is an attribute threshold that defines the maximum interpolation time
- stepped: depending on the time the position is not changed and the velocity of the last change the new particles are emitted on a line from the current position in the direction of the new MoveDirection attribute


Here is an image of how it looks with the second option:

Image
Dustbin::Games on the web: https://www.dustbin-online.de/

Dustbin::Games on facebook: https://www.facebook.com/dustbingames/
Dustbin::Games on twitter: https://twitter.com/dustbingames
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: AdvancedParticleSystem with IrrEdit plugin

Post by hendu »

Maybe I'm missing something, but the second pic looks just as bad as the first?
Post Reply