Particle effects.

Started by
9 comments, last by GameDev.net 19 years, 7 months ago
Hi, I have create an cave for my 3D game and I want to add some torch on the walls, I have loaded the models for the torchs and now I whant to add some particle effets to them, like fire. If anyone knows about tutorials or can write me an example on how to create 3d fire that looks nice and can be useful to the torchs I will be glad, hope you guys have some time. thx.
-[ thx ]-
Advertisement
'Looks nice' is pretty much your own guess-and-check, but there are tons of articles on the net about particle systems. I remember one at DevMaster.Net, there are many at GameDev.Net, and there was a link to one (first one written, I think) from some magazine that I forget, but it should be in one of the GameDev links.

Hope it helps, and happy coding!
- fyhuang [ site ]
A game team I was in last year used a system out of one of the Game Programming Gems books (Gems 3 IIRC, but I could be wrong.) We had to speed it up by changing how memory was allocated, but it worked great after that. We had fire, weather and magic effects as well as using it in the items menu and start screens as a cursor.

throw table_exception("(? ???)? ? ???");

Fire is pretty simple. Setup up your particles as billboards (of course), and construct a particle emitter that will release particles from a point and give them an upward velocity. You can randomize the paths of the upward-moving particles a bit to diffuse the flame pattern a bit. Randomize the lifetime of the particles to keep the flame ragged, and tweak the average lifetimes to keep the flame compact and concentrated. Use a particle texture that blends out softly from the center to the edges, and use additive blending so that particles layered on each other consecutively increase the overall color. Specify values of color for the particles such that as they are added together the color will increase from red through orange to yellow and white, and perhaps have them slowly change in color over their lifetime, dimming toward red as they 'die'. The particles used in the fire effect shown here:


use colors that blend from (R=0.7, G=0.7, B=0.2) to (R=0.2, G=0.0, B=0.0) over the lifetime of the particle.

There are a lot of ways you can tweak the particle system. For a torch, you could use smaller-sized particles with shorter average lifespans. With such a small flame, you would only need a relative handful of particles; the bigger the flame, the more particles you need. If you are curious as to how a general purpose particle system might be designed, you might take a look at the particle effects usable in the 3D modeller Blender. Take note of what options are customizable and what data can be specified, and think about how you might implement a similar system in your own game.
I've got some dx8.1 source with an editor app that'll let you see your emitters working.

Download Editor-Editor screen shot-Source Download

- Matt
One more Question, If I create particle effets in 3D Do I render the particles as cubes? not in single Quads to get the feeling? you kow whant I meen? well hope so,

thx
-[ thx ]-
As vertex normal says, render them as billboards [quads that always face the camera]. Why render 6 faces when only 1 matters?
Hi,
MMMM cubes... depending what you are looking for.

You have two types of particle systems. Basic particle systems are formed of points. Each point is transformed using a specific movement function and the resulting point is used to render a billboard sprite (billboard sprite is a sprite that is always aligned with your screen, facing you). In modern hardware you do this using Point Sprites, but you can render each quad by hand if you wish. This kind of particle system is commonly used to render systems with small particles like rain, smoke, fire or a dust explosion.

Now, you have a second type of particle that is a 'big' particle. This is the kind of particle you get when a missile hits a spaceship and you get big pieces of the ship everywhere. Or when you hit an asteroid and it cracks into smaller chunks of rock. In this case you must control movement and rotation. Each object is created with independent movement but all with a similar behaviour. As a fire is composed of many tiny particles, rendering a cube would be overkill (12 quads against 2 in a sprite) but you may use them in case of a volcano eruption where rocks fly everywhere... and the dust and ashes may be modelled by a sprite particle system.

Luck!
Guimo


In GPU Gems, a NVidia demo was detailed where they used bigger billboards with animated fire textures so 1000000s of particles weren't required.
Pity they didn't make the textures accessible though!

EDIT:

I made an enhanced version of the particle system described in 'Special Effects Game Programming' by Mason McCuskey. It's based on DirectX 8 though EDIT:(the book was based on DX8, not my ps).
How can I setup billboards in an god way? know any tutorials/samples about this?
-[ thx ]-

This topic is closed to new replies.

Advertisement