Re: [Flightgear-devel] alpha layers ...again

2005-01-09 Thread Jim Wilson
Syd said:

 Hi all me again
 I understand about alpha layers and the drawing order , but the problem 
 I had was it would work for one version of plib and not for another. I 
 had to rearrange the object order in the ac file to get the gauges to 
 show when I switched plib versions. Does the dhc-2 that Jim modified 
 work with the standard plib ?
 Im redoing the gauges for the Beaver for testing ( I hate recompiling 
 just to test this problem :) .
 And crossing my fingers.Trying to eliminate the transparent panel.If it 
 works I  can carry on with the Citation and B1900D.
 Anyway ... any other problems ,tips, optimizations would be helpful. I 
 was trying to keep polygons to a minimum ... as some planes are barely 
 flyable on my system  especially the Concorde ( not sure why ).
 

Does anyone know what he's talking about?  Is there anything going on in plib
currently that would change the order of the objects being loaded from single
ac3d file from what it has been for many years in plib?

I'm all for having an alpha sorting option, but AFAIK it is not in yet, and
even if it was it would not be causing the problems people are reporting.

Syd, if you just get rid of the parenting and put the panel object with the
glass down the end of the file on those models you'll be right.   If there
are any problems after that it won't be a fault with your models.  Breaking
them up into pieces won't help.  If anything changed it'd be to the worse
since the whole problem with _not_ having alpha sorting in plib and only
sorting manually is the sorts don't span multiple models and scene
components.  You probably won't need to worry about that happening here, but
just the same I think you may be wasting time making those changes.

Best,

Jim


___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


[Flightgear-devel] alpha layers

2005-01-07 Thread Syd
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.

Syd
___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


Re: [Flightgear-devel] alpha layers

2005-01-07 Thread Curtis L. Olson
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


[Flightgear-devel] alpha layers ...again

2005-01-07 Thread Syd
Hi all me again
I understand about alpha layers and the drawing order , but the problem 
I had was it would work for one version of plib and not for another. I 
had to rearrange the object order in the ac file to get the gauges to 
show when I switched plib versions. Does the dhc-2 that Jim modified 
work with the standard plib ?
Im redoing the gauges for the Beaver for testing ( I hate recompiling 
just to test this problem :) .
And crossing my fingers.Trying to eliminate the transparent panel.If it 
works I  can carry on with the Citation and B1900D.
Anyway ... any other problems ,tips, optimizations would be helpful. I 
was trying to keep polygons to a minimum ... as some planes are barely 
flyable on my system  especially the Concorde ( not sure why ).

___
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d