next up previous contents
Next: 17.8 Other Atmospheric Effects Up: 17. Natural Phenomena Previous: 17.6 Water

   
17.7 Light Points

OpenGL has direct support for rendering both aliased and antialiased points, but these simple facilities are usually insufficient for simulating small light sources, such as stars, beacons, runway lights, etc. In particular, the size of OpenGL points is not affected by perspective projections. To render more realistic looking small light sources it is necessary to change some combination of the size and brightness of the source as a function of distance from the eye.

The brightness attenuation a as a function of distance, d, can be approximated by using the same equation used in the OpenGL lighting equation

\begin{displaymath}1 \over {{k_{c}} + {k_{l}d} + {k_{q}d^2}}\end{displaymath}

Attenuation can be achieved by modulating the point size by the square root of the attenuation

\begin{displaymath}size_{effective} = size \times \sqrt{a}\end{displaymath}

As the point size approaches the size of a single pixel the resolution of the raster display system will cause artifacts. To avoid this problem the point can be made semi-transparent once it crosses a particular size threshold. The alpha value is proportional to the ratio of the point area determined from the size attenuation computation to the area of the point being rendered

\begin{displaymath}alpha = \left ({size_{effective} \over size_{threshold}} \right )^2\end{displaymath}

More complex behavior such as defocusing, perspective distortion and directionality of light sources can be achieved by using an image of the light lobe as a texture map combined with billboarding to keep the light lobe oriented towards the viewer. An advantage of using texture mapping is that the quadrilateral or other geometry that the texture is applied to is automatically scaled by the perspective projection so rendering the correct size is less of an issue. To effectively simulate distance attenuation it may, however be necessary to select different texture patterns according to distance from the eye.


next up previous contents
Next: 17.8 Other Atmospheric Effects Up: 17. Natural Phenomena Previous: 17.6 Water
David Blythe
1999-08-06