Thursday, August 09, 2007

So Why Doesn't X-Plane Look Like This?

Every now and then someone sends us this:

The question is of course, why doesn't X-Plane look like that yet?

Now there's a lot of reasons why flight simulators don't look like first person can definitely optimize any game content for a specific viewpoint -- X-Plane's lack of constraints on the camera position (you can put the camera quite literally ANYWHERE on the Earth at any time of day, atmospheric condition, and orientation) means that there are going to be views that don't look so hot. And the global scope of X-Plane means that we have to focus on quantity to a certain extent over quality. (If we made KSBD look totally awesome and didn't ship any state but California in global scenery, where would we be.)

I've been working lately on pixel shaders and lighting...when you look at those shots, the total integration of a number of great lighting effects is responsible for a lot of the look. But...I think there's a more fundamental issue that pixel shaders and carefully made content wouldn't address.

Simply put, X-Plane's LOD system isn't scalable enough.

In order to get images that look that good you need to put a huge amount of detail up close near the camera, where the user can see it, but not put that detail in the background. (Imagine if every tree in those scenes was done in the detail of the foreground - the polygon count would be unmanageable.)

But X-Plane's scenery SDK (the interface by which scenery content is specified to X-Plane, in other words, "the file formats") lacks really strong LOD capabilities.
  • The terrain mesh is fixed - you can use LOD to eliminate overlay details, but you can't actually simplify terrain.
  • The cost of LOD in objects is high enough to prohibit really gradual LOD. No morphing is provided.
  • Textures are mipmapped but loading is not variable, so our VRAM budget doesn't benefit from LOD and locality of textures in X-Plane space.
  • Generated geometry (roads, trees, etc.) don't have any LOD except "eliminate whole feature".
  • There is no far view of 3-d clouds.
  • Airport layouts are tessolated at only one complexity.
I could go on and on...the bottom line is, X-Plane's rendering model is very static.

Why did we do that? Well, it seemed like a good idea at the time. In particular, recalculating LOD is very expensive on the CPU and at the time we had only one core. Recalculating LOD would cost more in lost fps than it would benefit in offloading the GPU. So we went for static meshes that we could blast out to the card "real fast".

What you might not know about those screenshots is what kind of hardware it's running on:

Yep...four cores, and overclocked by over a ghz. (I can only speculate that shortly after the clip ends the machine caught on fire. :-) In a multicore environment we can apply additional CPU resources to dynamically rebuild the environment to increase the "LOD range" (difference between the near and far view).

In fact, we already started to do that! In X-Plane 830 we modified the sim to build 3-d content (roads, forests, etc.) on a second core while flying, instantiating only the close ones. This saved RAM and improved the overall performance of the sim, and it increases our LOD range.

(Even if something isn't drawn, it has a cost just to exist - by saying that things that are really far away don't even exist we improve performance.)

As you can see from the above list, there's still a lot to do on the LOD front. But the scenery system is continually growing - new features for the various primitives and improvements to the engine will let us continue to improve sim efficiency.

No comments: