PDA

View Full Version : Small lights on fire effects



Mick Derevnin
06-20-2011, 08:55 AM
Hi guys. Recently I made a simple fire particle effect, which you can add into a world through a simple tile editor.

The next thing i wanted to do was improve the look of the fire by giving it a lighting effect. So i have two main questions:

1. What is the best way to go about doing this? Keeping in mind there could be heaps of tiny fires on the screen.

2. What about if i wanted to make the light have a "pulsing effect", like what most lights around a fireplace has?

Thanks!

Edit: I'm not sure if this would be classified as a more advanced thing, sorry in advanced if it is in the wrong section.

ZbuffeR
06-20-2011, 10:22 AM
Well it depends on what you want to achieve... For 2D tile game I would go for a simple trick which is to render a larger halo with additive blending,
glBlendFunc(GL_ONE,GL_ONE);

and randomize the intensity each frame, ie :

float intensity= 0.5+0.5*rand(); // intensity from 0.5 to 1
glColor3f(intensity,intensity,intensity);
// draw textured quad (texture is a radial gradient from white to black)

If you want actual per pixel lighting, then something like deferred rendering maybe a good solution, even if more complex.