I woke up this morning to one of those funny coincidences that defines the experience of working on X-Plane: two users had emailed me. One was asking whether we’d be extending water reflection technology to airplane fuselages (like some other programs have) and the other made the case that such an extension was not necessary. The two emails arrived in sequence! (Perhaps there was a forum debate on the subject somewhere.)

First, I can tell you that if we ever have reflective airplanes, it won’t be that soon. I have a number of features for version 9 that are in progress and need to be finished off before I can start anything new.

Reflective airplanes are on my “investigation list”…that is, a feature where we want to do the initial research to see if it could be implemented in a way that makes sense (for X-Plane this means: would it look good and not kill fps too badly for at least some segment of our users).

I believe the X-Plane 9 version run will start to contain more features for serious 3-d modeling of airplanes. Version 9 already features 3-d lighting in the 3-d cockpit, key frames for animation, and a ton of new datarefs to drive that animation. We’re going in the direction of being able to model the plane in absurd detail.

We’re also looking at the lighting model in X-Plane. We’ve only started this work for version 9, but consider pixel-shader-based water. Even in the “no reflections” case, the pixel-shader based water is a reflection of the real sky (as rendered) with a procedural texture to create waves. When you compare this to the version 8 water, you can see how having really close alignment of the coloring scheme for all parts of the sim creates more of a sense of realism.

So reflective airplanes are at least on my list of things to try. I have seen users do wonderful amazing “metal” textures on airplanes, but the one thing that I think holds them back is that all metal airplanes have some kind of tinting assumption to them based on the reflection used…typically these are “blue-based” (meaning they look right on a sunny day) or “gray based” (meaning they look right on a cloudy day). But if you put the plane in the other environment the texture looks a lot less convincing. Reflective textures would let authors really use the real sky color on the plane, for consistent lighting (especially when the plane’s orientation changes and the blue side isn’t up anymore).

On the other hand, reflections are expensive. Planes reflect light from all sides, so we would need to take reflections from all angles (the water always reflects up, which is a huge savings). For low-quality settings for water, we drop the terrain, and since the terrain only reflects at the water’s edge, this is a pretty tolerable omission. An airplane reflection with “sky on the bottom” would look absurd. (Similarly, the water tends to only reflect things that aren’t on camera, so the total rendering load of water + the world tends to be static. The plane would pick up a lot of 3-d objects even in orientations where they don’t do much good, so plane reflections would become expensive.) And the plane reflection isn’t usable for any other plane…do we build them for all planes or just the user’s plane?

Certainly right now it’s still too soon to tell. Not only have I not done the research into this feature, but we still don’t have comprehensive performance data on the water across lots of hardware. A number of users are reporting huge framerate loss on the lowest water settings. This implies that our “render-to-texture” code is slow on some hardware but not others. (The fps loss on my laptop with the lowest water setting is less than 4%.) Render-to-texture is new to v9 and used heavily, so we need to understand how it scales for all users before we go further.

Finally, there is a whole area of 3-d techniques that X-Plane does not yet use that could make sense for airplane modeling: artist controlled fake lighting.

For example, imagine if the airplane contained a single “reflection” texture – this texture would contain a fake ground texture and alpha transparency where the sky color goes. X-Plane could then fill in the sky color (where there is transparency) only when the weather conditions change, and then apply the texture keeping the plane’s orientation in mind. Such a proposal would give the plausibility of reflections (correct coloring on all parts of the plane across lighting, orientation and weather conditions) for a fraction of the cost of “real” reflections. I’m not saying this is the best idea, just that there’s a lot of intermediate ground between “full reflections” and “make a static texture”.

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.

12 comments on “Reflective Airplanes

  1. When you talk about “fake lighting” I assume you’re referring to the standard cubic environment mapping? IMHO it IS currently the best solution, realistic enough and as you said with a negligible hit on performance.

    With regard to future features of the lighting model: other than realistic sun-projected ground shadows for airplanes (that I guess a lot of people are asking for), there’s another one I’d like to see, that is 3-d lighting on the external of the aircrafts. For example, a rotating beacon would illuminate with its shade the belly (or the top) of the fuselage, and nav lights would illuminate wing tips.

    This is done in The-Other-Flight-Simulator, and very nice to see. I don’t know the technical details, but I assume a pre-calculation on external lighting is done when compiling the 3d model of the a/c.

  2. >> The fps loss on my laptop with the lowest water setting is less than 4%.

    I find that hard to believe.

    LOWI RW08, my prefered rendering settings: 70FPS
    Turn on shaders: 65 FPS – this is already 8% loss

    Turn on low Water: 58fps – this is in total 17% loss

    Nvidia 8800GT , WInXP, latest driver (which btw. improved FPS test run from 80 to 110)

  3. Anonymous: believe it – this was done on my Mac Book Pro – the one that has a 256 MB X1600 in it.

    Now…I would like to hear what your system does when you set yours the way I did…in particular, I want to identify how much the “baseline” cost of reflective water (ignoring the cost of building the complex reflection texture) varies from machine to machine.

    First, note that the lowest setting of reflective water is, in my mind, “none”, NOT “low”, or whatever Austin called it. The reason is this: when shaders are on, you ALWAYS get reflective water – it just may be that the reflection texture has only the sky dome in it. My speculation was (having seen only a 4% fps hit) that this was a tiny price to pay for much more accurate sky-water color matching.

    So the 8% number, not the 17% number, is the one I am comparing! If I go to the next level, I am sure the cost will go up — the sim has to render more into the reflection texture. (The sky gets put in when you go to that next level.)

    Please set the following settings:
    1. No anti-aliasing.
    2. 1024×768 res.
    3. Then crank up the 3-d objects enough to have about 30 fps without pixel shaders.

    Under those conditions, what is the fps loss to turn pixel shaders on (with the reflective water on “none” so you have only sky reflections, or whatever Austin called the very first menu pick, and volumetric fog OFF)?

    That object loading matters too…I’ll explain why in another blog post.

  4. Murmer, yes, something like a cube-map, perhaps dnyamic, perhaps faked a bit.

    I would like to see shadows in more places – we already have some code started for that but it’s not ready for prime-time yet. Shadows are murderously hard to get right. 🙁

    Regarding the illumination on the airplane body, is this a light whose focus/halo moves over time, or is it just the intensity that is changing?

  5. I’m also seeing a large drop in framerate when I enable pixel shading. I’m just running the demo right now at LOWI (dvds in the mail 🙂 )

    System:
    Beta 6
    Win XP
    Opteron 165 (dual core 2+ghz)
    2 Gig PC3200 RAM
    NVidia 6800GT, 256meg

    Settings:
    Resolution: 1680 x 1050
    AA: OFF
    Water on, reflections none.
    Volumetric fog off.

    I’ve got trees and objects cranked up a fair bit and run at a smooth 30 fps. If I enable the water pixel shaders I drop down to 19. I wonder if this is an NVidia related problem. I’m pretty sure the hit was much smaller with an earlier beta but I can’t say for certain.

    If there’s any sort of profiling you’d like me to run I can give it a shot when I get home (I’m a programmer so know a bit about this stuff).

  6. Yeah…
    Cube maps vs Sphere maps 🙂
    well, sphere maps are more efficient than cube maps and totally sufficient if used correctly.
    you must update both in the sphere map:
    the ground and the sky. the ground is dark at night…

    but another approach is just to put a bright spot (the sun) onto the sphere map (without the ground or sky). this gives some good reflections of the sun on the plane. it is better to use normal maps on this approach because this will give more precise reflections, than just with specular light.

  7. “The fps loss on my laptop with the lowest water setting is less than 4%.”

    With all due respect Ben, I find this hardly believable. On my Radeon X1950 Pro, activating the lowest water detail makes my system loose as much as 25% fps! A scene running at 40 fps with standard water will easily drop down below 30 fps at the lowest pixel shader setting. From then, enabling any level of reflection will lock down the sim to 19 fps!

    By comparison (if such a comparison can be made), Crysis at high detail runs at a steady 25 fps in HDR (shader 3) on my rig. I can fairly assume that something doesn’t work quite right in XP9. Such a simple water shading can’t be that taxing on my card.

  8. >> Please set the following settings:
    >> 1. No anti-aliasing.
    >> 2. 1024×768 res.
    >> 3. Then crank up the 3-d objects enough to have about 30 fps without pixel shaders.

    Let’s see

    AA off, rendering settings turned up, getting about 32 FPS at LOWI08

    Turn shaders on, no Fog, Water None: 30-31 FPS

    Low: 29 FPS
    Default: 24 FPS
    Advanced: 20 Fps (the plane starts to stutter while sitting parked on the runway)

    thanks for your explanations!

  9. yea, somebody figured out about the shadow switch in the prefs. But in it’s current state this is “murderously” on the performance 😉

    Keep on trying!

  10. Murmer and aMaLaHaMa: I will take a look at those links.

    Anonymous: that’s what they get for hacking the prefs! 🙂 The shadow feature is not ready to be used yet, that’s why it’s not posted. The performance you might see hacking that switch isn’t even remotely predictive of how the feature will work – anything could happen because the code is just in an experimental stage.

    Anonymous: those posted FPS with water at various levels is exactly what I would expect.

    Kaminari: this blog isn’t a great forum for perf troubleshooting. Anonymous was able to see my results (low cost for low-geometry reflections) with some rendering settings. Please email me to follow up –
    I would have expected the X1900 series to do what my X1600 does but faster. If it does not, perhaps we can isolate why. I consider a comparison to the X1600 useful but not the comparison to a first-person
    shooter game…that kind of rendering engine is totally different from what a flight-sim does. It’s Apples to Oranges.

    Josh: please email me – you should not be seeing this kind of fps loss and I would like to investigate what your card is doing.

Comments are closed.