How to build a better fire?

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.
Post Reply
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

How to build a better fire?

Post by Asimov »

Hi all,

I have been experimenting with particles to make fire. However I have something that could be loosely described as fire, but a long way from realistic.
I didn't write all this code, I borrowed it from a book, and started modifying it for my own needs.

Basically I have the fire the right size, and the right location, but I want it more realistic.
Also how to add random swirls and stuff, and less robotic looking.

If I was using particles in 3ds max I would think about making the particles smaller, and increasing the amount of particles to give a better effect, but I am not exactly sure what I am doing, using trial and error. heh heh mind you if was trying to create fire in 3ds max I would probably use fumefx, but that is another story.

Anyway here is the current code, and a picture to show the fire I have already.
So if anyone knows how to make a better fire, then let me know, and lend me your matches.

Code: Select all

IParticleSystemSceneNode* ps = smgr->addParticleSystemSceneNode(false);
IParticleEmitter* em = ps->createBoxEmitter(aabbox3d<f32>(55, 0, -5,5, 1, 80),
vector3df(0.0f, 0.1f, 0.0f),50, 200,SColor(0, 255, 0,0),
SColor(0, 255, 255, 255),650, 650, 0,dimension2df(20.f, 20.f),dimension2df(20.0f, 20.0f));
ps->setEmitter(em);
em->drop();
ps->setPosition(vector3df(-320, 30, -30));
ps->setScale(vector3df(1, .1, 1));
ps->setMaterialFlag(EMF_LIGHTING, false);
ps->setMaterialFlag(EMF_ZWRITE_ENABLE, false);
ps->setMaterialTexture(0, driver->getTexture("data/fire.bmp"));
ps->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
Image
Ovan
Posts: 70
Joined: Thu Dec 18, 2008 12:41 am
Contact:

Re: How to build a better fire?

Post by Ovan »

yes more particle
better texture like
Image
would be better if you use createSphereEmitter + createFadeOutParticleAffector + createScaleParticleAffector + createAttractionAffector
for reducing size, alpha and collapse particles at end
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: How to build a better fire?

Post by Asimov »

Hi Ovan,
createSphereEmitter + createFadeOutParticleAffector + createScaleParticleAffector + createAttractionAffector
Tried your texture, and that is an improvement.
Now I am going to be googling those to find out how they work.
I suppose an Affector is like a 3ds max deflector.
Ovan
Posts: 70
Joined: Thu Dec 18, 2008 12:41 am
Contact:

Re: How to build a better fire?

Post by Ovan »

affector & deflector look like the same thing
be careful again this texture copyright, found on google image ...
if I remember <<spark particle engine>> as a good fire texture with a better copyright for you

edit:
probabily interesting for you
http://www.gamerendering.com/2009/09/16/soft-particles/
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: How to build a better fire?

Post by Asimov »

Hi Ovan,

I kept with the box emittor, but added the createFadeOutParticleAffector.
The fire is looking much better, now. I know it is harder to see from the picture though.

However I know how to make the particles smaller by changing this bit
dimension2df(20.f, 20.f),dimension2df(20.0f, 20.0f)); to a lower value, but what I don't know is how to increase the amount of particles so that I have more.
I can't increase this bit (650, 650) as it increases the hieght of the fire, so if that is the bit that increases the particles I am stuck there LOL.
Also after adding the createFadeOutParticleAffector it is much better, but I don't know how to add settings to it so that I can change the effect.

Here is my current code

Code: Select all

IParticleSystemSceneNode* ps = smgr->addParticleSystemSceneNode(false);
IParticleEmitter* em = ps->createBoxEmitter(aabbox3d<f32>(55, 0, -5,5, 1, 80),
vector3df(0.0f, 0.1f, 0.0f),50, 200,SColor(0, 255, 0,0),
SColor(0, 255, 255, 255),650, 650,10,dimension2df(20.f, 20.f),dimension2df(20.0f, 20.0f));
ps->setEmitter(em);
em->drop();
 
scene::IParticleAffector* paf =
ps->createFadeOutParticleAffector();
ps->addAffector(paf);
paf->drop();
 
ps->setPosition(vector3df(-320, 30, -30));
ps->setScale(vector3df(1, .1, 1));
ps->setMaterialFlag(EMF_LIGHTING, false);
ps->setMaterialFlag(EMF_ZWRITE_ENABLE, false);
ps->setMaterialTexture(0, driver->getTexture("data/fire.png"));
ps->setMaterialType(EMT_TRANSPARENT_ADD_COLOR);
 
Image
Ovan
Posts: 70
Joined: Thu Dec 18, 2008 12:41 am
Contact:

Re: How to build a better fire?

Post by Ovan »

no I don't think to reduce all particle size
but reduce particle size with affector, is not the same
affector affect each particle from a time value

always look on api reference !
http://irrlicht.sourceforge.net/docu/cl ... cbb44e1675
http://irrlicht.sourceforge.net/docu/cl ... 389bb24888
http://irrlicht.sourceforge.net/docu/cl ... 6975b3bc74
http://irrlicht.sourceforge.net/docu/cl ... f69a9ed963
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: How to build a better fire?

Post by sudi »

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.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: How to build a better fire?

Post by Asimov »

Hi Sudi,

I couldn't see many of the pictures in that thread. They have all disappeared.
I won't need a particle engine in this project, but I will in the next.

You see in this project the fire is only background, and not the focus of the game, but in my next project I will be needing explosions.

I will be wanting to port my Dalek Draughts game from XNA to irrlicht, if I ever finish this game heh heh.

As you can see from my Avatar I am quite adept at particles in 3ds max, but not in irrlicht. I am using a plugin call fumefx to get that fire on the ring effect.
I have attached fumefx to max's particle engine to get the look I wanted.
thanhle
Posts: 325
Joined: Wed Jun 12, 2013 8:09 am

Re: How to build a better fire?

Post by thanhle »

Search for spark particle. I think they are upto version 2.x something.
Regards
Thanh
sudi
Posts: 1686
Joined: Fri Aug 26, 2005 8:38 pm

Re: How to build a better fire?

Post by sudi »

The particle engine i posted is a little bit inspired by spark and employs some of the concepts. And the best part it performs better than irrlichst native particle engine.

Asimov: no matter if you need explosions or not, but its probably still a better fit than the irrlicht standard particles. Btw check my youtube channel to see the engine in action: https://www.youtube.com/user/SudDani
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