I just committed a set of changes relating to environment map based
runway lighting.

One warning, right off the bat.  The current runway lighting direction
vectors are completely hosed due to a bug in the terragear airport
generator (now fixed.)  So your milleage may vary with the current
scenery.  Essentially you may see the lights dimmer than they should
be, or the brightest spot may be in the wrong direction.  The bug in
terragear is fixed, so this problem will go away next time the
airports are regenerated.

Here's a brief outline of the scheme:

A runway light is defined by a point and a direction.

The point is textured automatically using OpenGL's environment mapping
feature.  Essentially, this maps the view offset direction into a
texture with direct, head on viewing coinciding with the center of the
texture.  We carefully create a texture which represents the proper
light color/intensity for the given view offset.

Now, environment mapping get's inverted when you view a point from the
backside which is bad.  So instead of drawing just the point, we draw
a triangle, but in glPolygonMode(GL_FRONT, GL_POINT) mode which means
only the corner points of the triangle are actually drawn.  This
allows us to use OpenGL's backface culling to make the point go away
when we view it from behind.

The light position and direction are combined with the local up vector
to create a small triangle orthogonal to the light direction vector.
The two ficticous corners of the triangle are given an alpha value of
zero, the orignal corner is given an alpha of one.  This way, only the
original point is drawn in the scene.

And, when we turn on environment mapping with our carefully created
texture, we get a light that changes intensity/color based on our
relative view angle as compaired to the direction the light is pointed.

This means we make runways nearly invisible when viewed from the side,
bright when viewed on final approach, with a smooth transition in
between.

For taxiway lights we could point the direction up, and create a
texture which is brighter closer to 90 degree view offset and dimmest
head on.

Regards,

Curt.
-- 
Curtis Olson   IVLab / HumanFIRST Program       FlightGear Project
Twin Cities    [EMAIL PROTECTED]                  [EMAIL PROTECTED]
Minnesota      http://www.menet.umn.edu/~curt   http://www.flightgear.org

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel

Reply via email to