Friday, September 19, 2008

The Future of Triangles Part 2: X-Plane 8

X-Plane 8 provides a useful baseline for rendering technology:
  • It is finished and unchanging.
  • Its use of shaders is very minimal, so even lower-end hardware can show the "X-plane 8 model" of lighting.
  • X-Plane 8 rendering is completely supported in X-Plane 9.  (That is, turn off shaders, and OBJs should look the same in X-Plane 8 and 9.)
So what do we have, and is it any good?  Well, we have:
  • Per-vertex lighting.  Lighting is calculated per vertex, and interpolated between vertices.
  • Very limited materials.  Basically you can use attributes to set emissive lighting (so your day texture stays bright when back-lit, like taxiway signs) and shininess (to induce white specular hilites).  The shininess ratio isn't very flexible, but it does match what the built-in ACF shiny property does.
  • Very fast vertex output within a batch.
I looked at some nice third party planes before writing this up, and one thing became clear: X-Plane can output a lot of vertices in an object if they are batched, and authors are using this aggressively.  The advantage of just using a lot of vertices is: curved surfaces look round, the errors that are induced by per-vertex lighting are less ugly, and the object looks the same everywhere (because this path isn't dependent on having pixel shaders).

The big weakness of the current situation is that you have to burn a lot of vertices to get close to per-pixel lighting, particularly for very shiny surfaces.  I saw at least one plane (I do not recall who authored it) that just had more triangles in the engine nacelles than you could imagine.  They look beautiful even in X-Plane 8 - great specular hilites.  But that eats into your vertex budget pretty severely - it's not a technique that you could use for every static airplane on a tarmac at LAX.


Kaminari said...

Looks like there's some ongoing work on complex lighting for XP9. Sounds good to me.

But does that cover projected shadows as well? Really, this is long overdue. I was perusing through MobyGames today and stumbled upon a screenshot of Flanker (1995) which made me silently cry out of despair and humiliation.,243171/

That's the terrible truth. We're in late 2008 and XP is still incapable of stencil shadows. The old shadow map looks terribly obsolete (and it's not even properly scaled/projected).

Benjamin Supnik said...


Stenciled shadows are immensely problematic for flight simulators. I will comment on this in more detail in a future blog post when I round up all of the technologies that have been tossed around in comments. I will only say now that we probably could have some kind of shadows on JUST the user's plane, and that shadowing for a wider variety is very, very difficult. Most shadowing techniques that work well in a FPS don't work in x-plane because our world is 300x200 km and theirs is less than 1x1 km at a time.

Anonymous said...

Some kind of shadows on objects would be very cool and I'm rather thinking of cockpits than entire planes, although the latter would be nice too. Currently, it's very hard to get the light correct in a 3D pit where there are huge areas that never get any sun (panels under glareshields, pedals and legroom etc...) and yet every surface is lit up like the fuselage was transparent.