Friday, November 26, 2010

Using Glass Objects in Planes

X-Plane 9 allows you to categorize objects as being on the plane's outside, inside, or glass. X-Plane depends on these flags being right for a few things:
  • The draw order of the airplane is determined by the object types - glass is drawn last to avoid translucency artifacts.
  • Interior light from the plane is only spilled on the "inside" objects.
  • Glass objects are excluded from shadow calculations to avoid having opaque windows in the airplane shadow.
It is important that you use these flags as intended; X-Plane 10 depends on this information as well, and X-Plane 10's global spill and global shadowing algorithms are more sensitive to incorrect categorization of objects than X-Plane 9's forward renderer.

In particular, you should have glass for the airplane windows in an attached object tagged as type 'glass'; do not attach your glass to the cockpit object, which cannot be categorized as glass. If you have an old plane with glass in the cockpit, consider cutting the object in half in a 3-d editor and attaching the glass separately.

(You should also use our prop disc animation, rather than use an OBJ for prop discs; the OBJ format doesn't contain the z-buffer tricks necessary to make the prop look right.)

4 comments:

Jack Skieczius said...

This is interesting. I am having some problems with Transparent parts on my Q400 right now. It is more or less an issue regarding transparent objects over polygons in the cockpit object. I believe I found a solution to my problem, but wonder now if this solution will work in XP10. I may in fact wind up dumping my idea for lighting just to make things easier.

Steve In Tucson said...

Is using "glass.png" for the texture and "glass.obj" for the object file name the only way that X-Plane knows that the glass.obj is a glass type object? Since there doesn't appear to be a change to the Obj8 format for a TYPE statement, I want to be sure to implement this technique correctly. I've had bunches of draw order problems with various glass elements of my custom private jet. It's working pretty well as it is now, but if there's a better, more proper way to do it, that's what I think I should be doing. I've studied the stock Cessna 172SP as an example to this point and can probably "get there" with that info alone, but I thought a peek under the hood would be interesting. After all, you can't code and drink coffee *all* the time, can you? ;-)

Benjamin Supnik said...

"Is using "glass.png" for the texture and "glass.obj" for the object file name the only way that X-Plane knows that the glass.obj is a glass type object?"

No - in fact, they are NOT a way that an object is marked as 'glass' on an ACF...the name is just coincidence.

"Since there doesn't appear to be a change to the Obj8 format for a TYPE statement, I want to be sure to implement this technique correctly."

The option "inside/outside/glass" is an option for ATTACHED objects to an ACF only, in Plane-Maker's "misc objects" dialog box. See the popups next to each object with these 3 options.

"After all, you can't code and drink coffee *all* the time, can you? ;-) "

You'd be surprised. ;-)

Steve in Tucson said...

Oh....there it is! Well, I learned something new today, Ben. Thanks! (Now I wonder what else I've missed spelunking through the depths of Planemaker....)! Maybe I should try that coffee stuff sometime....