Screen Space Ambient Occlusion Only Affects Exterior Stuff

This has been a point of confusion for third party developers, particularly ones who were in the private beta (and saw versions of the sim that...cough cough...didn't work right).

Screen space ambient occlusion (SSAO)*, when enabled by the highest rendering settings, only affects exterior objects. This means scenery and aircraft-attached objects marked "exterior" for lighting.

I tried SSAO in the cockpit interior, and it had a few problems:

  • The scale for occlusion in the interior and exterior of the cockpits is really different - I couldn't find one size for the effect that fit all cases.**
  • When I went to apply the effect to our fleet, I found that virtually all of our aircraft already had occlusion baked into the cockpit by the artists. The dynamic AO thus provided almost no value and made the cockpit even darker than it already was.***
  • SSAO only works at the highest rendering settings (and requires HDR to function at all), so if artists remove their baked AO, they're taking a pretty big visual loss in a bunch of settings.

So in net, it just wasn't worth going to dynamic AO in the cockpit. Our AO isn't as high quality as what you can bake in a 3-d program (given a few days of rendering time), and it's not always available.

The real win for SSAO is outside the aircraft, e.g. to cast AO around the wheels of the aircraft on the ground. That's an effect that you can't bake, and it helps a lot with lego brick scenery too.

* Nerd note: I'm pretty sure that what we do is actually HBAO

** We could, in theory, apply the effect twice with stenciling at two different scales.

*** The cockpit tends to be dark both due to errors in our approximation for indirect light (because most of the cockpit is in shadow, and thus only lit by indirect light) but also because cockpits are actually pretty dark compared to the great outdoors. But that's another post.


  • Facebook
  • Reddit
  • StumbleUpon
  • Twitter
  • Google Buzz
  • LinkedIn

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.
This entry was posted in Development, Modeling. Bookmark the permalink.

32 Responses to Screen Space Ambient Occlusion Only Affects Exterior Stuff

  1. Andrzej says:

    *** The cockpit tends to be dark both due to errors in our approximation for indirect light (because most of the cockpit is in shadow, and thus only lit by indirect light) but also because cockpits are actually pretty dark compared to the great outdoors.

    Hi Ben,
    I assume that it is going to be addressed so all cockpits are brighter in XP11.
    Is it going to happen in beta?

  2. Maurice Cohen says:

    SSAO is the one thing that brings my new nVidia Titan X Pascal to its knees (driving 3 32" 2560x1440 displays, fairly intricate scenery with almost 7 GB loaded in VRAM), fps drop from 45+ to below 19 when I change graphics setting from HDR to HDR+SSAO. It does look impressive if you zoom in on an airport building.

    • Ben Supnik says:

      That is -completely- bizarre. SSAO is a dirt cheap effect. My guess is, it's something else that's causing the cost. To check this, go to max settings, then use DRE to set ssao/enable to 0. If your fps don't come back, it's not SSAO.

      (I do admit, that's a huge number of pixels on a much bigger GPU than I test with. Still, HDR itself or HDR AA should be the big cost there.)

      • Tom Knudsen says:

        I would concure, SSAO does not affect my GTX770 that much, at least on my computer. I see minor to non difference between SSAO on or sliders back to HDR

      • Maurice Cohen says:

        It may be bizarre but real: just did what you suggested and the fps shot right back up from under 19 to over 45.

        It just might be that I have managed to fine-tune the settings to get the most out of the GPU; any added load, however small, overwhelms it.

      • Elios says:

        you really should use HBAO over the older SSAO as HBAO works inside AND outside and is faster and looks better

  3. Tom Knudsen says:

    I baked out some asphalt textures with normals and AO. Will XP11 be able to utilize
    this of the bat or would one need to define it somewhere in order for the sim to use all
    three textures? Under runway asphalt texture I do not see any normals,
    is there a reason? Isn't a exterior lit? As far as I know normals are used under 1000roads,
    so hens my curious question.

    Is it intended for most textures in XP11 at some point to be baked texture and
    will it be in regards to PBR include albedo and not just normals and ao?
    Reason for asking is that I am not sure what OpenGL actually can use as of PBR texture.

    We are starting the build of an new airport where PBR is the general workflow and It would be great to have a plan or a genuine guideline before we start.

    • Ben Supnik says:

      1. You can use an AO channel in the scenery system, but it doesn't do what you think it does - it acts as a proxy for shadows when the shadoing engine is off. So...that's confusing. We don't have a slot for pre-baked replacement for our SSAO in the lighting pipeline yet; that will go with a next gen modeling format.

      2. The runways are their own special thing in X-plane, so there isn't an obvious way to customize them the way you can a .pol. If making truly custom airpotrs, use .pol files for runways and use a 'transparent' runway to get the map to work.

      3. It is not intended that most textures be baked in X-Plane 11 - it's applicable in the same or fewer places as it was before - bake the interior of your plane, mmmaybe the exterior, mmmaybe some scenery.

      You can read about the PBR work-flow in detail here.

      http://developer.x-plane.com/?article=x-plane-11-material-model

      It is completely unrelated to OpenGL - at this point OpenGL is a method for implementation of rendering and places _no_ restrictions on how you use the game engine.

      • Tom Knudsen says:

        Thank you Ben, glad there is someone like you that bother to clear things up 🙂 Keep up the wonderful work.

  4. Gustavo says:

    *** The cockpit tends to be dark both due to errors in our approximation for indirect light (because most of the cockpit is in shadow, and thus only lit by indirect light) but also because cockpits are actually pretty dark compared to the great outdoors. But that’s another post.

    To me is the opposite. Cockpits are too bright compared to the real ones (they appear to be inside a photography soft box with virtually no shadow). One of the best cockpits ever is the IXEG.

    • Ben Supnik says:

      They can be both.

      The real life lighting difference between a cockpit and outside is HUGE. It's way more contrast than you see in the sim.

      But: your eyes have fantastic dynamic range and LCD monitors do not. So if we were to be 'accurate' to the photon, you'd either have a white outside or black cockpit. So we have to reduce contrast to get something closer to what a human perceives.

      With that in mind, the current lighting levels depend a ton on:
      - Weather - we're working on that.
      - Time of day - that's due to limits of the algorithm, and make me grumpy.
      - Contents of the cockpit - we need better authoring tech to cope with this one and
      - Calibration of your monitor!

      Austin's been complaining about dark cockpits to me for months now...when I was in SC a few weeks ago, he showed me some cases that were too dark. Some of them were real issues. So we set up the 'nominal' case: summer high noon on a clear day at KATL. And...his computer STILL looked dark and crappy!

      Turns out he's using a third party 4K monitor on his Mac Pro and the default color profile absolutely stank. Chris looked up a fixed calibration on TomsHardware and we dialed in their "this is what you should really do" settings and finally things started looking like thte Mac laptops that Alex and I were using.

      • Gustavo says:

        I understand the calibration part (my line of work requires me to keep it calibrated every 2 months with x-rite color munki) and also understand the limits of non HDR monitors, but I guess that you nailed with the lack of contrast on what some authors do and what the sim does before looking to artificial.
        I hope that I see an increase in the sim contrast to help offset what we have today.

      • Fred says:

        Perhaps you guys could set up a "contrast test/calibration screen" within x-plane?

  5. Vistek says:

    Ben do you you colorimeter for your monitor calibration? I think it should be must have for all the graphical team... Xrite I1 Display Pro is quite uninexpensive and popular theese days. We use them.

    • Ben Supnik says:

      My own work isn't particularly color-sensitive...virtually all of the color decisions are made by the art team. If you ever see RGB FF00FF, that's me. 🙂

      When I need to see what's going on, I usually use my iMac - the screen is big and bright, well calibrated, and most of the greasy finger prints from the kids are on the bottom half of the screen.

  6. Bob Marsh says:

    Here is my two cents worth of input on the subject of shadows in the cockpit. My interest in using XPlane is to be able to fly any plane that I have in my hanger at any time of the day or night. The shadows which appear in many of the cockpits of my aircraft during the day literally make reading the instruments in the shadows like reading a book by moonlight.
    I can't see why any X-Plane user would be in favor of having such a shadow handling state. If real aircraft were designed to make it impossible for pilots to see their cockpit controls, that would soon put their manufacturers out of business.
    I want to see my instruments.. even if that means unnatural shadows. And, in fact I would like to be able to eliminate them from the cockpit (if I wished) to make reading them easier while enjoying my flight operations (as in X-Plane 10.51).

    • Ben Supnik says:

      If you want your cockpit to be unshadowed, simply turn off the 'cast shadows' flag on all of your cockpit objects.

      • Bob Marsh says:

        Just what I wanted - set Other Objects/ cockpit shadows to "none" ---- daytime shadow problem resolved for my aircraft. Now , when the 2d panel flood lighting and spot lighting is fixed and produced as described in/by PlaneMaker, for the new panel file formats, the needed cockpit lighting will be complete. Thanks..

        • Ben Supnik says:

          What you consider to be a 2-d panel lighting "bug" is _not_ being fixed. Using the 2-d baked lighting directly mapped to the 3-d panel is gone forever in X-Plane 11. The X-Plane 11 lighting engine requires _source materials_, not _finished products_ to do its lighting. You can continue to use these techniques on your 2-d panel.

          • Bob Marsh says:

            I think that you are telling me that the quite extensive explanation that you gave regarding 2d lighting changes in this forum in late November is now not being supported as a method to upgrade legacy aircraft.
            Could you comment on whether this then requires a redesign of the aircraft to operate them in XP11.
            I own the aircraft (many) but I do not understand their internal design, nor can I legally make changes to them.

          • Ben Supnik says:

            "the quite extensive explanation that you gave regarding 2d lighting changes in this forum in late November" - do you have a link to that?

            I can tell you that this change (dropping support for 2-d pre-baked spills in 3-d cockpits is not new - it's been planned for a very long time.

            A v10 airplane that uses this technique will need _some_ kind of change, e.g. adding 3-d spill lights, adding a _LIT texture to the 3-d cockpit, adding lit generics to the 2-d panel - it's up to the author.

      • Günther Wittwar says:

        How to do this with all my 3rd party airplanes?
        Why not have one "no cockpit shadow switch" delivered by x-plane?

        For me too unreadable instruments are a no go.
        I use X-Plane as a flight simulator, all other aspects (shadow, 3d grass ...) are second.

        PLEASE make the cockpit readable in any circumstance.

  7. neucoas says:

    Hi Ben, something totally off topic but I was wondering for a while: Is there a plan to upgrade both Beechcraft B58 and C90 to the C172/737 visual/modelling standards ?

  8. Mike says:

    Hi Ben

    Somewhat related, but different: Do you have plans to address the jagged edges of shadows at some point? This is something that always bothered me in X-Plane.

    I achieved acceptable results with Percentage closer filtering in the fragment shader, and it's dirt-cheap 😉 The first GPU Gems book has a chapter on it.

    Cheers,
    Mike

    • Ben Supnik says:

      Did you achieve this by modifying X-Plane's shaders or in another project?

      The problem with X-Plane isn't the filtering, it's the resolution and distribution of cascades. This is on my list of things to tune, but it's a hard problem in x-plane becase the world is very open and unstructured.

      • Mike says:

        No, it was in another project. My shadow maps probably weren't as huge as the ones in X-Plane. True, cascading SM adds complexity as well, but you could definitely combine it with PCF.

        Glad to head it's on your todo list 🙂

        • Ben Supnik says:

          Right - the original CSM paper by NV showed a "huge" scene...5 km! I thought that was sort of adorable. 🙂

          The big problem they have right now is that it's hard to know the interesting content range - if you are looking down at the plane from 100m up in a free camera, if we could know that the entire scene is within the first N meters of Z (in camera space) we could tighten up our cascade in a big way and get a big res win back. Since we don't know the Z range, often shadow res is wasted "underground".

          • jörn-jören jörensön says:

            - Hope this is not totally stupid, as my last time programming realtime 3d was over 10 years ago. -
            I guess, there is no easy way to get min/max values from Z-buffer to get the Z range?
            (At least as an approximation for the next frame.)

          • Ben Supnik says:

            There are easy ways to get them, but getting them 1. fast and 2. without latency is tricky.

            You can read them back later, or do an on-GPU resample and use them as guesses. Some engines do a very crude low-res rasterization to get culling and Z information up front.

  9. John says:

    Ben,

    This is related to shadow comments above, but not a response to any of them in particular:

    How are the shadows "lit"? Ie, are they just kinda black, or do they get lighting from the sky color (like happens in real life?) some of the day time darkness of shadows would be mitigated by that huge blue area lamp hanging in the air 🙂

    Secondly, and I don't have the hardware for it and won't for years, so don't think this is a "me now, feature request now now!" sort of thing - but are there thoughts about not fading shadows out near sunset? Thats kinda when they should be most prominent, but I can also imagine it not being fun to try to render shadows across miles of scenery or calculate the proper blurring you'd get in those situations.

    • Ben Supnik says:

      The shadows occlude direct sunlight but not ambient light. So the 'color' of the shadows is "Everything but the sun."

      For the GL nerds: the sun is an analytic light in X-Plane, as are all HDR "spill" light sources and any pre-defined lights on the plane from plane-maker (e.g. 3 inside spots, or a landing light).

      Everything else is image-based.

Comments are closed.