Frederic Bouvier wrote:
Quoting Alex Romosan :
Erik Hofman writes:
Alex Romosan wrote:
still trying to figure out the real reason why the nvidia driver is
slow when we enable GL_POINT_SMOOTH in fgfs (and learning a lot more
about openGL then i ever wanted to know).
If I'm correct then you're not using points larger than one pixel in
this test application. Maybe that's the reason?
the point size is set to 5. that's not it.
FWIW, Curt doesn't draw points for the airport lights, but triangles in point
mode, where two of the three have alpha 0 and with an environment map / texgen
to make the points fade when not viewed in the runway axis.
That's a bit trickier than simple points ( the ground point for example )
Let me just add a bit more information so you all don't think I'm
completely nuts for doing it this way. :-)
1. Note that in real life, runway lights are directional. They are
mounted so they point up along the standard approach path. If you look
at a runway light from behind, you really don't see it. There is a
separate set of lights pointing in the opposite direction. As your
perspective becomes more perpendicular to the direction of the light,
the apparent brightness of the light fades. If you look at a runway
from directly above or from the side, they can often be very dim and
hard to pick out.
2. If you use a simple billboard or a simple point for a light, it will
look exactly the same from any direction.
3. You can use a neat environment mapping opengl trick to change the
color of the light based on what direction you are looking relative to
the 'sweet spot' of the light. By cleverly creating an environment map
that has brighter colors near the sweet spot, and dimmer colors near the
edges, we can give the effect of a directional light.
4. Unfortunately, the environment mapping effect happens even when you
look at the object from 'behind', it's just that the mapping gets
inverted from what it is when viewed from the 'front'.
5. To make our lights invisible from behind, I draw them as a triangle
and take advantage of back face culling. The triangle is created so it
faces the direction of the light's sweet spot. But this creates it's
own problems. Polygon objects start flickering in and out when they go
subpixel in size ... and there are other issues with drawing lights as
triangles too. So instead, we switch opengl into 'point drawing' mode
when we draw the triangles. This forces opengl to only draw the
verticies of objects (as points) rather than coloring them in with a
texture as we do normally. But we only want one vertex instead of 3 so
we set the alpha of two of them to be zero (or completely transparent.)
This is a really round about way to get to the end result, but it works
with simple, basic, well supported opengl features. Lights are
directional and lights disappeare when viewed from behind.
I'm sure it's possible to do something similar with shaders, but the one
person who did some work on runway lights with shaders, didn't do it in
a way that could be easily integrated with our code and still support
non-shader hardware so we weren't able to integrate his work into
FlightGear.
Perhaps we need to find someone with a bit of opengl knowledge to work
on better lights, the code is structured so it should be pretty easy to
call a different light generation function. But if you do want to
tackle this, please work closely with us core developers so we can
ensure compatibility and integratability. I hate turning down code
submissions, but sometimes the code is such a mess or would cause so
many problems to integrate, we just can't do it. But by working with
the core developers from the start we can usually avoid these problems.
Regards,
Curt.
--
Curtis Olson http://www.flightgear.org/~curt
HumanFIRST Program http://www.humanfirst.umn.edu/
FlightGear Project http://www.flightgear.org
Unique text: 2f585eeea02e2c79d7b1d8c4963bae2d
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel