View Full Version : Realistic fire
06-10-2005, 05:12 PM
I have a program that shows fire, but to show it I use 3 quads all rotated differently to show it. What I want is to create realistic fire without have to put thousands of particles where every fire is.
06-10-2005, 05:43 PM
To create releastic fire you should use from many particles. creating a fire with only 3 quads seems too bad. you should use from the small quads to create the fire. Take a look at this site. there are many particle systems here:
06-10-2005, 05:50 PM
Well thats what I mean. I use many particles made of 3 quads so I can view them from all directions.
06-10-2005, 06:27 PM
Originally posted by Terminatore3:
Well thats what I mean. I use many particles made of 3 quads so I can view them from all directions.If you want to see it from all directions, you should use from the effect called *billboarding*. In this case you use from the right and up direction of the viewer to rotate the quads.
06-10-2005, 06:42 PM
Ok, but I don't know the math for how to do that and even so my program still wouldn't be able to run moree than 10 fires at once without jumping all over the place. I need realistic fire that runs on a 256 MB ram and a 16 MB vid card with 30-40 fires at once.
06-10-2005, 07:19 PM
Translating the particles that consist of the quads isn't so expensive. So something is going wrong in your code. But here's some suggestions about the billboarding:
The idea is that you use from the up and right directions to rotate each particle. Assum that what does happen when you rotate the camera. your up and right directions will change. So your particles also should roatate. In this case you can ensure that the particles directions are parallel to your direction.
In this case you need a simple vector class with overloaded operators. *please wait until i find that vector class for you*
Now we should find the up and right vectors of the viewer. We can extract these vectors from the modelview matrix and then use from the vector classes to create the up and right vectors:
glGetFloatv( GL_MODELVIEW_MATRIX, matrix );
vector3_t right( matrix, matrix, matrix );
vector3_t up( matrix, matrix, matrix );
Now for each particle, we should use from these directions. also we need to know the center point of each partcile.
Here's the code:
//Center point of each particle:
vector3_t p( x,y,z );
//Now create each particle:
glBegin( GL_QUADS );
glTexCoord2f( 0.0f, 0.0f );
glVertex3fv( (p + (right + up ) * -size ).v );
glTexCoord2f( 1.0f, 0.0f );
glVertex3fv( (p + (right - up ) * size ).v );
glTexCoord2f( 1.0f, 1.0f );
glVertex3fv( (p + (right + up ) * size ).v );
glTexCoord2f( 0.0f, 1.0f );
glVertex3fv( (p + ( up - right ) * size ).v );
Every time that you rotate the camera, the right and up vectors will be updated and So the particles will be rotated.
06-10-2005, 07:27 PM
You can find that vector class here:
Download the sample codes of chapter 15 and use from the file vectorlibe.h
06-11-2005, 01:24 AM
You could try to simulate only 2 or 3 particle systems and just replicate them over the scene multiple times. This way you save a lot of performance but you will get some identical looking fires...
And I just had another idea. I did never test it, but in theory it could work:
Simulate 8 particle systems with each having 1/4th of the particles needed to have good looking fire. Then for each fire you need, draw any 4 of these particle systems together. This way you only have to simulate two times the particles you need for one particle system, but it will give you 70 (=binomial 8 over 4) distinct fires.
They would be not as distinct as having one particle system per fire, but perhaps it is enough to fool the user ;)
06-11-2005, 10:27 AM
I'm not sure what you mean about simulating one particle system. I have one particle system that is divided among all of my points of fire so if I have 1000 particles divided by 50 points of fire then thats 20 particles for every point of fire. I'm not sure what your saying, do you want me to copy what one fire lookes like in a display list or something and move it somewhere else?
P.S. Ehsan I am still working on your idea
06-12-2005, 01:23 AM
Yes, basically that's what I am proposing. You can simulate just one or two particle emitters and draw the result multiple times to save performance.
That way you can get much more fires and still get the visual quality of particle systems, but with the disadvantage that every fire will look similar...
06-12-2005, 10:53 AM
I don't know how to implement this though. Do you mean instead of finding the position of every particle like normal I use the positions of another system and just translate it?
06-12-2005, 02:35 PM
Yes. Calculate the particle system with the emitter at the origin, and translate the whole thing to where the emitter should really be.
06-12-2005, 05:36 PM
Thank you Ehsan for your help, my program now runs very well with lots of fire and Overmind your idea was great as well.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.