Syd wrote:
Hi all
I guess my point was not understood ..
Object order is apperently different in the latest plib...
So visible objects that appear in the latest plib do not show in the
previous version and visa vera
So Im going with the latest plib until I figure out a solution.
Hi Syd,
I think what people are trying to say is there are ways (between ac3d
and flightgear xml animation tags) to have complete control over the
object ordering.
You probably know all this, but here is why object sorting with alpha
objects is important.
When you draw a 3d scene, it's important that the nearer objects obscure
the further objects. This can be done by drawing the objects from
furthest to nearest, and just drawing over the top of whatever is
already there. But sorting objects by depth is expensive and slow.
What opengl does is maintain a depth buffer. The depth buffer is the
same dimension as your screen size, so every pixel on screen has a
corresponding entry in the depth buffer. For every pixel of every
triangle of every object that is drawn on the screen, opengl computes
the depth or distance from the viewer. The depth of that pixel is
compared to the corresponding value in the depth buffer. If the new
pixel depth is less than the existing value in the buffer, the pixel is
drawn and the buffer is updated. If the new pixel depth is further than
the existing value, the pixel is ignored. This can all be done in
hardware in parallel to other operations so it is *very* fast.
Now the problem comes with objects that have partially transparent
objects. OpenGl doesn't check if a pixel is transparent when it renders
it and always updates the depth buffer. (It has to do this because
pixels could be partially transparent.) So if you draw a nearer
partially transparent object before a further object, that further
object may never get drawn (because of the depth buffer is already
update for the nearer object) so the further won't be drawn and won't
show through the transparency.
The solution is to keep all your transparent objects separate, sort them
from back to front, and draw them last in back to front order. If you
are just dealing with transparent objects, usually the back to front
sort is doable (unless there get's to be a ton of objects.)
Plib separates out transparent objects and draws them last, but doesn't
sort them. You can manually control the sort order with animation tags
and by grouping and ordering objects within your AC file. But that
isn't always a perfect solution because moving your view point can
change the front to back sort order. Fortunately, cockpits are almost
always viewed from a perspective that lets you precompute a sort order
that works.
If I understand your problem correctly, you just need to make sure that
you sort your objects so that the instruments are drawn first before the
panel, and all should work. If you do that, you shouldn't even need to
build transparent holes in the panel.
(There are a few other issues to consider as well ... There are cases
where you can't actually compute a perfect front to back ordering ... 3
or more objects could form a chain to obscure each other, or objects
could partially intersect. The ultimate solution is to break up your
objects until there can be a perfect sort order, but in practice we try
to avoid/ignore those situations and hope we never run into them or that
they happen so infrequently or at such a distance from us, that the user
will never notice.)
Regards.
Curt.
--
Curtis Olsonhttp://www.flightgear.org/~curt
HumanFIRST Program http://www.humanfirst.umn.edu/
FlightGear Project http://www.flightgear.org
Unique text:2f585eeea02e2c79d7b1d8c4963bae2d
___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d