Frederic BOUVIER writes:

 > I discovered that only textures with an alpha channel are glowing
 > at night, and only when the c172 is in the view. Try the 4th view (
 > free tower view ) and the magic fdm. When the 172 is viewed, trees
 > around are emitting light but when you move to clip it away, trees
 > stop shining.
 > 
 > I modified my tower-hexa-2.rgb texture to remove the alpha channel
 > ( export to bmp and reimport ) and the tower stopped glowing.

OK, here's how plib sets up the states in src/ssg/ssgLoadAC.cxx.  In
AC3D format, textures and materials are separate: each object in a
model can have only one texture, but it can use a different
material for each surface.  Each materials is defined with a line like
this near the top of the file:

  MATERIAL "NoName" rgb 1 1 1  amb 1 1 1  emis 0 0 0  spec 0 0 0 shi 72  trans 0

The static get_state function actually builds the ssgState for each
part of the model.  It immediately sets the specular, emissive, and
shininess properties directly from the parameters in the line (but
they have no apparent effect in FlightGear).  Next, it enables colour
material with GL_AMBIENT_AND_DIFFUSE, together with lighting and
smooth shading.

If there is a texture defined, it then sets GL_TEXTURE_2D.  Finally,
it checks the alpha value (1.0 - transparency), and if it is less than
1 *or* the texture file has an alpha channel, it disables
GL_ALPHA_TEST and enables GL_BLEND.

The rgb value is copied to the vertex table for each of the vertices.

So what's the interaction?  Frederic identified the difference between
a texture with and without an alpha channel.  Why does enabling
GL_BLEND seem to have this effect?

In any case, I also have alpha channels in the textures for a couple
of the buildings, and they don't start glowing unless the C172 is
visible as well.  Here's a different possibility -- the C172 has one
texture with an alpha channel (which would cause GL_BLEND to be
enabled), and one without (which would cause GL_BLEND to be
disabled).  Could that be the culprit?


All the best,


David

-- 
David Megginson, [EMAIL PROTECTED], http://www.megginson.com/

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

Reply via email to