930 will have some new options for attached objects.  One is to declare a “glass” object.  When an object is declared to be glass, it is moved to the very end of the drawing order – even after the cockpit object.

The idea of glass objects is to let you make translucency that works from any view angle.  To make multiple layers of glass, the trick is to use pairs of one-sided triangles.  The glass (visible from the inside only) goes first, then the glass (visible only from the outside) goes second.  All of this goes into the object with the “glass” property in Plane-Maker.
One side benefit of the two-triangle approach is that the inside and outside of the windows can be tinted differently.
Having glass objects does three things for us architecturally:
  1. It takes pressure off the interior cockpit object.  The interior cockpit is the only object that can have manipulators, so texture space in the interior cockpit object is quite valuable.  By allowing translucency in an attached object, you can put your window textures somewhere else and save texture space for the cockpit object.
  2. It gets around the current weirdness where the interior cockpit object is drawn last but the exterior cockpit object is drawn first.  The glass object is always drawn last.  Period.
  3. It sets us up someday for some kind of shadowing scheme in the cockpit.  This is a bit pie in the sky, but most pixel-based shadowing algorithms go a bit bonkers on translucent geometry; by flagging the whole object as “glass” we can simply omit it from shadow calculations.

The 921 draw order has the exterior cockpit object drawn first (if drawn) and the interior cockpit object drawn last (if drawn).  This made sense at the time – the exterior cockpit object was being used primarily for a pilot figure, with windows in the ACF paint – so it had to be drawn before the ACF fuselage.  The interior cockpit object has to be drawn last because the coordinate system is changed to a super-close-to-the-user coordinate system that has to be drawn last.

Now that there are attached objects, people are modeling a lot more of the airplane, the usual approach is to have all 3-d present all the time, so that a roaming camera won’t reveal missing parts of the airplane.

About Ben Supnik

Ben is a software engineer who works on X-Plane; he spends most of his days drinking coffee and swearing at the computer -- sometimes at the same time.

5 comments on “Glass Objects

  1. When you say “pairs” of objects, same object duplicated with normals flipped on one of them? Two separated objects? and what about glass that is say 80mm thick, (and the inside edges are visible?

  2. Not entirely related to cockpit windows, but would it be possible to extend this feature and allow scenery designers to define an area on a model, a number of faces, with attributes that define transparency, color and most importantly, reflections?

    By being able to add reflections, much like the beautiful water in v9, it would add a lot to the dynamics of the sim world, something that is not possible to achieve with texture baking on such a large scale. If scenery designers use this feature sensibly, it should not be to much of a drag on the system.

    What is your thought on such a feature?

  3. Anonymous: sorry I meant to say – you duplicate the geometry in the one glass object, keeping the inward facing glass earlier in the list of triangles. You don’t need to use two objects.

    Dan: no. The “glass” capability works for airplanes because airplanes are basically objects as a whole in themselves – extending translucent draw order to all scenery globally is a much, much more complex problem, because it requires correct sorting of all sceney elements against all other scenery elements. We may have this some day, but there is certainly no way to extend what I did for airplanes out into the scenery system – there’s no general purpose mechanism, only something specific to airplanes.

    Reflections have similar problems: the reflections against the water are somewhat special-cased. We may have general purpose reflections some day, but if we do, they’ll require different code and a lot more complexity; the water gets a huge advantage for being relatively flat. (For GL nerds, this means they can be reflected with a single reflection, not a cube map!)

    Color – maybe I don’t understand the feature request, but my general reaction to color is always the same: use the texture. If we have reflections we may have some kind of tinting some day, but certainly for the current lighting model, the diffuse color should be managed with the texture, because that is orders of magnitude faster than any kind of attributes.

  4. Hi,
    How does this feature relate to the issue of obj rotors and propellers ‘erasing’ clouds in the sky? Would these be drawn after the clouds if declared as glass?


  5. Nils – it doesn’t. Glass objects can ONLY be set for ATTACHED objects because it’s part of the AIRCRAFT, not part of the OBJECT! So….this can’t solve the larger-sim translucency issues with clouds, rotors, etc.


Comments are closed.