View Full Version : Lense Flare

03-25-2002, 05:39 AM
I'm looking for an idiot proof lense flare example/how to. The only one i can find is an old example by Mark Kilgard, on the opengl.org site, and i cant really follow it.

Any other links/pointers/advice would be apprechiated.


03-26-2002, 04:46 AM
An EASY (not the fastest) method could be to draw the whole scene, get the pixel value where the Light is with gluUnproject, check that pixel's Z and if it is farther than the light Z then draw the lens flare, otherwise the light creating the flares is ocluded by something in the scene.

To render the flares just use billboarded textured quads, or (better looking but slower) draw directly a combination of blended shapes that looks like the falres you need.

There should be an example on Romka's web site usign this method (maybe).


03-26-2002, 10:30 AM
the thing about a lens flare is to think of it as 'occuring on the 2d near plane of the screen ie not in the 3d world' thus its a 2d effect drawn after the 3d stuff.
all u need is to draw various quads on the line from the light source through the center of the screen