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.

AdvancedParticleSystem with IrrEdit plugin

Postby Brainsaw » Fri Nov 12, 2010 6:33 am

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]
User avatar
Brainsaw
 
Posts: 1038
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Postby Brainsaw » Sat Nov 13, 2010 2:31 pm

Just uploaded a new version: you can now (de)activate emission of particles and get the number of particles currently in.
User avatar
Brainsaw
 
Posts: 1038
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Postby shadowslair » Sat Nov 13, 2010 6:43 pm

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. :)
Image
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
User avatar
shadowslair
 
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Postby Brainsaw » Sun Nov 14, 2010 8:43 am

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?
User avatar
Brainsaw
 
Posts: 1038
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Postby Brainsaw » Fri Nov 19, 2010 6:41 am

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 ).
User avatar
Brainsaw
 
Posts: 1038
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Postby cookie » Thu Nov 25, 2010 6:24 pm

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?
cookie
 
Posts: 83
Joined: Sun Aug 23, 2009 9:30 pm

Postby shadowslair » Thu Nov 25, 2010 6:44 pm

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
Image
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
User avatar
shadowslair
 
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Postby cookie » Thu Nov 25, 2010 10:11 pm

The problem is: This files doesn't exist, so I can't link them to my project...
cookie
 
Posts: 83
Joined: Sun Aug 23, 2009 9:30 pm

Postby Brainsaw » Fri Nov 26, 2010 6:24 am

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).
User avatar
Brainsaw
 
Posts: 1038
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Postby cookie » Fri Nov 26, 2010 1:01 pm

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
cookie
 
Posts: 83
Joined: Sun Aug 23, 2009 9:30 pm

Postby Brainsaw » Fri Nov 26, 2010 1:45 pm

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).
User avatar
Brainsaw
 
Posts: 1038
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Postby cookie » Fri Nov 26, 2010 2:45 pm

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.
cookie
 
Posts: 83
Joined: Sun Aug 23, 2009 9:30 pm

Postby Brainsaw » Mon Nov 29, 2010 6:37 am

Hmm ... that's strange. It got it compiled with Irrlicht 1.7.2 without any problems.
User avatar
Brainsaw
 
Posts: 1038
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Re: AdvancedParticleSystem with IrrEdit plugin

Postby Brainsaw » Tue Nov 29, 2011 6:56 am

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
User avatar
Brainsaw
 
Posts: 1038
Joined: Wed Jan 07, 2004 12:57 pm
Location: Bavaria

Re: AdvancedParticleSystem with IrrEdit plugin

Postby hendu » Tue Nov 29, 2011 9:29 am

Maybe I'm missing something, but the second pic looks just as bad as the first?
hendu
 
Posts: 1556
Joined: Sat Dec 18, 2010 12:53 pm

Next

Return to Code Snippets

Who is online

Users browsing this forum: No registered users and 1 guest