Category: Development

CSI: Joystick Edition

[Scene opens with a joystick being thrown across the room in frustration. Camera angle is from the ceiling looking down. A rotating and twisting view creates tension as it centers on the joystick, laying abandoned on its side as the dust settles. Cut away to a different angle. In the background is an iMac with Google Chrome open in the background just barely in focus.]
[In walks developer Chris Serio wearing a pair of Ray-Ban sunglasses. He nudges the joystick with his boot before crouching down and removing his sunglasses to get a closer look.]

Chris: “Looks like someone really had it out for this Joystick”
Ben: “Yeap…tossed it like a salad at Denny’s. What do you think ticked them off?”
Chris: “I bet Google’s behind this somehow…”
Ben: “Google? Really? I thought their motto was to do no harm?”
Chris: “On the contratry…They’re involved in everything!”
[Chris stands up and walks over to the computer…the camera zooms in as Google Chrome comes into focus on the screen]
Chris: “You see this? Chrome…that’s not a coincidence. I want the computer’s ip address…run it through CODIS. Bag it and tag it”
[The camera moves back and zooms out as Chris pulls his sunglasses from his pocket, placing them on his face as he pauses to speak]
Chris: “This Joystick killer’s about to get…..yoked”
[Cut to opening credits as The Who’s “Won’t Get Fooled Again” plays loudly]

Ok so perhaps I’ve seen too many episodes of CSI in my time…but sometimes I must say I do feel like more of a detective than a developer.

The latest weirdness with joysticks is that on Mac only, sometimes they do not seem to work at all. In the log, you’ll see an error message stating that the device could not be opened. I’ve seen it myself before and it’s odd because typically device access is shared between processes. Imagine if your keyboard only worked in your word processor because it demanded exclusive access and none of the other applications on your computer could use it once the word processor was opened. That’d be silly right?

I started killing processes on my system one at a time until the joystick finally started working again. Killing Google Chrome is what did it. Why on earth would a web browser be touching my Joystick hardware?!

After a bit of research and a run through Chrome’s source code (isn’t open source great?), I discovered a new system in HTML5 compliant browsers like Chrome called Gamepad. Gamepad allows new HTML5 pages to access your joystick hardware! Because of the Olympics, the daily Google Doodles have been little mini games which are stealing Joystick access! So Olympics + HTML5 kills Joysticks in X-Plane….amazing.

The solution is a simple change for them. They just need to pass a different flag so that they share the device with other applications. I’ve already filed a bug and spoken with the developer and the fix will likely be in Version 22 of Chrome but for now, make sure your browsers are closed if you appear to be having intermittent Joystick issues on Mac.

Sometimes reality is stranger than fiction…

***EDIT*** I do have to say, I got an immediate response from the engineer in charge of this Chrome feature and within an hour the bug was fixed and checked in for release in future versions. I can’t ask for better support than that.

Posted in Development, Hardware by | 13 Comments

Light Groups for Fun and Profit

Conventional 3-d games like first-person-shooters and racing games are just full of cheats in the rendering engine.  And that is not a bad thing!  By cheat I mean they find clever ways to optimize performance that make the game look good while doing less work.  The result: better framerate, better graphics.

I look at these games with a bit of envy because those cheats are often inapplicable to general purpose flight simulators for two reasons:

  • The unrestricted viewpoint of a flight simulator is incompatible with a number of optimizations that on-the-ground or movement-constricted games can apply.
  • Since a lot of our content comes from a third party, we can’t apply restrictions and optimizations across the entire set of content for the sim.

Despite these limitations, rendering-engine specific optimizations are beginning to creep into X-Plane as the engine becomes more powerful.  These options and optimizations are unsurprising to anyone used to making 3-d game content but new to X-Plane itself.

What Is a Light Group?

Light groups are a cheatoptimization available in many 3-d rendering engines.  The basic idea of a light group is that the author of 3-d content can create 3-d lights, meshes, and then specify which lights apply to which meshes.

There are two big advantages to light groups:

  1. Lights are expensive in traditional (non-deferred) rendering engines; by restricting which lights affect which objects, an artist can reduce the average number of lights applied to their 3-d meshes, which is good for framerate.  (Using light groups to remove lights from objects that are out of the light’s range can be done automatically by a pre-processing tool.)
  2. Lights in games often do not cast shadows, either because the engine can’t support this (this is the case for X-Plane now) or just because shadows are expensive to generate.  With a light group, artists can get correct results without shadows by simply marking geometry that is shadowed by the light as not in the light group.

As an example of the second case, imagine that you have two rooms separated by an internal wall and a powerful light source in one room.  If the light source casts shadows, the unlit room will be dark because the entire room is shadowed by the internal wall.  But if the lights do not shadow, the light from the lit room will “leak out” into the second room.

With light groups, an artist simply marks the second room as not being part of the light’s group, and the rendering engine doesn’t even consider the light.  The dark room renders faster and has no incorrect light leakage.

Light Groups in X-Plane

X-Plane implicitly has two light groups: the exterior of the user’s aircraft, all AI aircraft and the entire world, and the interior of the user’s aircraft.  In X-Plane 9, landing lights don’t light up the cabin interior, and the 3-d lights inside the cockpit don’t light up the runway or the landing gear.

In X-Plane 10.05r1 HDR mode was not supporting these light groups correctly; one obvious example was the Piaggio tail landing light spilling light on the cabin seats.  This is now fixed in X-Plane 10.10.  Just like X-Plane 9, your choice of “interior” or “exterior” for Plane-Maker objects matters for lighting!

Light Groups and Spill

What if you include spill manually by attaching a named light that casts spill to an object?  What light group should the spill cast light on?

My idea to resolve this is:

  • Spill lights attached to “exterior” Plane-Maker objects will be part of the exterior light group and only light up the aircraft exterior and surrounding scenery.
  • Spill lights attached to “interior” Plane-Maker objects will be part of the interior light group and only light up the aircraft interior.
  • Scenery-attached spill lights will light up everything.  (Perhaps this should be “exterior” instead?  I am not sure!)

For a non-enclosed aircraft (E.g. an old biplane with no cabin) you would not use the interior light group at all – everything would be exterior and all lights would affect everything.

If an aircraft has two light groups (interior and exterior) and a light affects both, you can simply include the spill light in two objects; the spills are cheap.  This also means you could make effects.  For example, if the spill light does actually light up the interior a little bit, rather than having the actual landing light blast the cabin with directional light, you could include an exterior spill for the landing lights themselves and a second interior spill that is omnidirectional, dimmer, and tinted, to represent the reflected light that makes it into the cabin.

Posted in Aircraft, Development by | Comments Off on Light Groups for Fun and Profit

New OBJ Commands

I have updated the OBJ8 specification with the new X-Plane 10.10 commands.  This blog post explains why we added some of these commands.

Pixel-Space Drag Manipulator

The pixel-space drag manipulator is a new axis manipulator whose drag length is measured in screen pixels instead of meters; its drag axes are always screen aligned, but it works both horizontally and vertically.

The goal of this manipulator is to make draggable knobs that:

  • Have a good response speed for both slow and fast drags via a non-linear curve and
  • Have the same drag sensitivity no matter what camera angle.

The axis manipulator has the problem that it works in 3-d; depending on how you look at the manipulation target (both position and rotation) the sensitivity of the drag can change radically.

Recommendation: use the regular drag-axis manipulator for levers and other physically moving items.  Use the pixel-space drag manipulator for drags where the underlying target does not move, like knobs.  Use button-type clicks for anything that just toggles – it’s easier on the user.

No Shadows

Three new attributes (GLOBAL_no_shadow, ATTR_no_shadow, and ATTR_shadow) allow you to exclude part or all of your object from shadow casting.  Shadows can make certain types of geometry, like grass billboards, look silly; excluding them from shadows fixes artifacts.

Note that ATTR_no_shadow is different from ATTR_shadow_blend..

  • ATTR_no_shadow: the geometry simply does not cast a shadow!  This is meant to exclude objects like vegetation.
  • ATTR_shadow_blend: the geometry does cast a shadow, but only if the alpha is greater than a certain ratio.  This is meant to make windows with tint cast shadows correctly.

Recommendation: fix shadowing bugs using ATTR_no_shadow for non-instanced objects, and GLOBAL_no_shadow for instanced objects.  Use the Plane-Maker check-box for parts on aircraft.

GLOBAL_cockpit_lit

This attribute lets you have your cake and eat it.  In X-Plane 9, ATTR_cockpit gives you alpha blending, but ATTR_cockpit_region gives you correct 3-d lighting.  You have to pick one or the other.

In X-Plane 10.10, GLOBAL_cockpit_lit gives you both.  It makes ATTR_cockpit use 3-d lighting (while maintaining translucency) and it makes ATTR_cockpit_region respect alpha translucency (while maintaining cockpit lighting).

You can add this attribute to any airplane.  This attribute should make it easier for authors to adopt correct 3-d lighting in their airplanes.

Recommendation: use GLOBAL_cockpit_lit on any airplane that uses ATTR_cockpit to change to 3-d lighting for your panel texture.  Also see here for more guidance.

Posted in Cockpits, Development, File Formats, Modeling by | 11 Comments

Beta 5 Hinges on the Outcome of the Great War…

…between myself and X-Plane’s deferred rendering engine.  It is a battle to get correct alpha blending behavior when scenery objects fade with distance.  Current casualties include a good chunk of the existing HDR shader code and my sanity. Once there is a victory (no guarantees it will be me) we’ll cut beta five.

Posted in Development by | 12 Comments

Not A Bug, Apparently

When I saw this near KMSY in New Orleans my first thought was: oh hell, what bug created that?  All of the roads seemed to run over these channels of water, as if someone had created mini-rivers for them.  I assumed bad OSM data.

Then I looked the area up on Google and…no, they actually built the road over water intentionally.


View Larger Map

 

Posted in Blooper Reel, Scenery by | 10 Comments

1000 Crashes…Sweet!

Just a few quick notes on the 10.10 beta process…

First, we have received well over 1000 automatic crash reports.  For those who have not figured it out from reading forum posts, 10.10b1 crashes on startup with some combinations of joystick hardware and its associated software.  Chris has a fix for this which will ship in beta 2, some time this weekend.

Thank you to everyone who has clicked “send to Laminar”.  Receiving such comprehensive and complete crash data is really really helpful.  We get a very clear picture of what’s happening with complete details.  Clicking “send to Laminar” is better for us than filing a bug (because the crash reporter is very thorough in grabbing forensic crash data and the crash submission system pre-processes the crash for us, saving us labor) and hopefully it’s easier for you too.

Also, thank you to everyone who has filed bugs on the bug report form!  We really do read every one of them, even though we do not reply to all of them.  We try to list fixes in the release notes so you can see what’s going on.

Overall behavior re: posting bug reports on the comments section has been quite good, but I will continue to trash bug reports here.  I apologize for the inconvenience, but my fear is that if I start responding to bug reports here, it will encourage other users to “file” bug reports on the blog too and then we’ll have a mess on our hands.

To be clear: my goal is not to snuff out negative feedback.  This is not “if you have nothing nice to say”.  But…most negative feedback really should be a bug report, e.g. “X used to work and now it is broken” really belongs on the bug report form.

I am fixing my last bug for beta 2, which I hope to have cut over the weekend.

***CHRIS’S EDIT*** We’re aware that having a joystick plugged in destroys frame rate…That’s already fixed and will also be in Beta 2.

Posted in Development, News by | 23 Comments

Safe Mode

Here’s another thing that’s new in 10.10: safe mode on startup.

One of the most common sources of tech support is users who can’t start X-Plane because their previous rendering settings crash the sim when restarted.  This often happens from maxing out system VRAM or process address space, but it can also happen due to driver incompatibility.  The problem that hoses users is that the setting change takes effect on restart, causing a “lock-out” condition.

X-Plane 10.10 knows if it shut down cleanly or crashed; if upon start, it realizes that it crashed, it will offer to run with default rendering settings.  This makes it easy to restart an rebuild rendering settings without losing all preferences.

This is not a replacement for improvements in rendering engine stability and 64-bit but it should help for now and will always help for edge cases where a particular hardware combination crashes in a way we’ve never seen.

Posted in Development by | 23 Comments

Consistency and HDR

At this point the only thing holding up a public beta of 10.10 is, well, me.  I am currently working on a set of related aircraft rendering bugs, and as soon as I can get the car off of jacks, we can go beta.

One of my goals or 10.10 is to close out the issues that stop payware authors from releasing final conversions of their aircraft to 10.10.  By final, I mean conversions that won’t need any additional future editing.  Right now X-Plane 10.05r1 has a few bugs that cause v10 to look different from v9, different depending on rendering settings, or just wrong.  I want to fix those problems in a permanent manner so that authors can release aircraft and not worry about having to update.

Here are my goals for 10.10, roughly in priority order:

  1. Rendering should be consistent from X-Plane 10.10 onward through the rest of the v10 version run.
  2. Rendering should be consistent between HDR and non-HDR mode.  Authors should not have to create two versions of textures where the HDR and non-HDRs offer the same capabilities.  (In other words, while you might have to make two textures to bake lights when in non-HDR mode, you shouldn’t have to make two textures to correct for differences in color-correction between the two renderers.)
  3. Where possible, non-HDR mode should match X-Plane 9.

The switch of priority between item 2 and 3 is a fundamental change in priority from what I originally intended for X-Plane 10.

Originally I thought that the best thing to do would be to keep non-HDR rendering as close to v9 as possible, so that at least content would look correct with HDR off.

My new thinking for 10.10 is that we should aim for consistency between HDR and non-HDR modes.  Realistically, an author is going to have to make at least a few adjustments in moving v9 content to v10; better to have the cost of rendering engine changes be borne out in a v9->v10 upgrade than to have every v10 airplane require double authoring to cope with HDR vs. non-HDR differences.  In the long term, it’s best to not have v9 haunt v10 like a ghost years after authors are making exclusive v10 content.

Why is HDR Mode So Weird

This begs the question: why is HDR rendering so weird?  Why does it look different from non-HDR rendering, and why doesn’t it look the same as v9?  What did you guys do?

There are a number of changes to how we render in X-Plane 10, some specific to HDR rendering, and some sim-wide.

  • The entire sim now works with a linear lighting equation.  Basically when the sim performs lighting  calculations on the GPU, it thinks in terms of photons and not colors, which produces more realistic results in most cases.  With lots of light sources, linear lighting is absolutely necessary for combining those lights.
  • The order of rendering operations is very different between HDR and non-HDR mode, and the formats that they render into (24-bit RGB vs. floating point, etc.) are very different.  HDR is fundamentally a two-pass format.

X-Plane maintains two separate rendering paths for HDR vs. non-HDR and they are quite different in both what happens at each stage and when the stages occur.

Fixing some of the authoring bugs has required further changing the HDR pipeline to allow for correct rendering.  The up-side of this change in pipeline is that the new one supports better HDR tone mapping and possibly even better fill rate performance.  The down-side is that it’s a lot of complex code to touch and it may take a few betas to work out the bugs.

Posted in Aircraft, Development, Modeling by | 43 Comments

We’re Still Here, Really!

So I just realized that it’s been a full month since I’ve posted anything on the dev blog, which is a bit ridiculous since we’re working on a ton of stuff for 10.10 and a number of announcements have also come out in the computer industry.  I’ll try to catch up on various topics over the next week.

Where Is 10.10???

I’m pretty sure that that’s the money question: where is 10.10?  The answer is: we are working on it, mainly fixing bugs pre-beta.  When will the public beta program start?  I don’t know – that will be determined by how quickly we can knock out some of the current bugs.  My view is that it’s a waste of everyone’s time to go beta on 10.10 with known bugs that we can fix without going beta – going beta too soon means users waste their own time reporting bugs we know about, and we are distracted from fixing those bugs with the task of going through the duplicate reports.

64 Bit – Not Yet!

I think we’ve described this road map before, but in case there is any confusion let me be absolutely clear:

X-Plane 10.10 will not be 64 bit!

We have already made significant progress toward a 64-bit X-Plane and we will continue working on this front.  But the plan was never to ship 10.10 with 64 bit support.  Rather, X-Plane 10.10 ships with a number of changes to our compilers (as well as a ton of other stuff).  The next major patch (10.20) will support 64 bit on all three platforms at once, and we will know that any problems will be due to the 64-bit-ness (and not the changes to compiler, runtime, makefiles etc.) because those will have been vetted in 10.10.

The reason to ship 10.10 in 32-bit is to get out all of the other changes we’ve made so far.

What’s In 10.10

This is not a complete feature list – when we do the first public beta we’ll run through our source control log to scrape out all changes.  But here are some fairly big things:

  • Austin is putting new UI into the sim for flight setup and airplane selection.
  • Roads don’t shoot up in the sky anymore – crazy road grids was always a problem in how X-Plane showed the data, not the data itself.  This change may also improve the stability of the sim.
  • Chris has integrated “breakpad“, an open source automatic crash reporting system.  The vast majority of the bug reports we receive are crash reports, and of them, the vast majority are missing critical files we need to understand what crashed.  Automatic crash reporting should both save users time in reporting (you just have to click “ok” when X-Plane asks you if you want to send the bug to LR) and let us dig in with complete file information.
  • 10.10 includes faster clouds on ATI hardware on Windows.
  • This build moves us to new compiler setup – while this is an internal change, it should mean faster load times on Windows.
  • 10.10 fixes some stability problems in 10.05r1.  I don’t think the early betas will be great for long flights, but I think 10.10 will in total be better on this front.  (But note: a lot of the crash reports we get are due to running out of memory.  You can’t run X-Plane at the edge of your memory limits for 10 hours of flight – at some point it will go over.  This particularly applies to Mac users.)
  • Chris has rewritten the low level joystick code; while this was suppose to be ‘just the hardware’ code (with new UI coming in 10.20) it looks like one aspect will go live in 10.10: you can plug and unplug your joysticks while you fly without restarting the sim.

The artists have been working this entire time and we’ve built up a pretty good pile of art assets to ship too – I’m not going to try to enumerate them right now because I’m not up to date on what they’ve created.

Third Party Airplanes

One goal I have for 10.10 is to close out all of the bugs that are stopping authors from converting their payware add-on planes from X-Plane 9 to 10.  Some of these are already fixed and some are still on my todo list.  I’ll post more about some of the stickier remaining issues in another post.

Posted in Development, News by | 60 Comments