Tuesday, January 04, 2011

100 Mile Visibility

First, Happy New Year! As is typical, I've been quiet on the blog because things have been insanely busy here at work. Just to give you an idea of the insanity:
  • There will be a 9.63 relatively soon - the bug driving this is some Linux distros not finding the DVD. But we'll get a few new datarefs in there too.
  • We have new updaters and installers to get tested, again addressing Linux DVD issues, but also with updated web download code that should give a nice speed boost.
  • Chris has been working hard on Android. X-Plane for Android is pretty much the biggest APK anyone has tried to ship, and as a result we've hit a number of problems with the market that we are going to work around.
  • All that's just the side show; X-Plane 10 development is of course the meat and potatoes.
Now, about visibility. X-Plane 9 restricts ground visibility to 25 nm (about 46 km) in an attempt to prevent you from seeing off the edge of scenery tiles. Many users have expressed (some more persistently than I would have liked) an interest in longer range visibility. Austin recently posted a note to X-Plane.org discussing level of detail and distance management in the new weather system, and users immediately picked up on his mention of 100 nm visibility. Here's what we're thinking; all of this is subject to change as we keep working on the product.

First, visibility: you can come up with a formula for the distance to the horizon based on height above a sphere: d = sqrt((r+h)^2 - r^2) where r is the radius of the planet and h is the height above the planet. Since the Earth is roughly 6 million meters in radius, we get a visibility to the horizon of:
100 meters: 34.6 km
500 meters: 77.4 km
1000 meters: 109.5 km
10000 meters: 346.5 km
Clearly a little bit of altitude lets you see a long way.

But there's more to it than that: X-Plane has always changed the visible distance with altitude. The 25 nm limit applies to surface observations (which is what you get from a METAR). As you move up into orbit, that distance is scaled out to the horizon distance, so that you can see the whole planet from orbit. That scaling can reveal the edge of DSFs, which are blended into the planet when volumetric fog is enabled.

So here is what I think we really need to do:
  • We do need a larger 'surface level' maximum visibility, so that distant features are visible from the ground.

  • We need a scaling from ground to upper atmospheric visibility that gives us more visibility sooner; one of the problems with version 9 is that the increase of visibility is slow, which gives mid-elevations a hazy look.

  • In the long term, we need to load more DSFs, probably twelve instead of six. X-Plane 10 already has some improvements in how scenery shift is done, but my guess is that we can't productize this until we have a 64-bit build (since more DSFs chew more memory), so I expect this to happen in a patch.

  • We need to add elevation displacement to the whole-Earth planet render, so that the blend between DSFs and the planet don't have huge height gaps at high-elevation locations. I am hoping we'll have this in 10.0, but it is not coded yet. (Usually we recut the planet textures last, since they are cut off of the DSFs.)

  • We need to improve the quality of haze, fog and atmospherics. In real life, atmospheric scattering reduces the contrast of far away terrain. I believe that correct scattering could make a huge difference in the quality of the transition from DSF to planet, the required tex res (we need less if we scatter more), and generally it would be a big contribution to the realism of the image.

    I'm not sure how much of this we'll get into 10.0; I have a prototype of Sean O'Neil's atmospheric scattering shader from GPU Gems 2 running in the sim, but I don't think it's shippable. I do hope we'll get at least some scattering in place, with improvements in patches.

That's a road map, at least. If there's a take-away point, it's this: increasing visibility is complex and involves a lot of parts of the sim and there are still significant parts that need work. So I really don't know if we'll hit some kind of hitch or problem that requires us to back off visibility.

Austin's comments about 100 nm visibility reflect what the slider in the sim happens to be set to now. It's also a design goal of the new weather system - that is, we want the new weather system to handle significantly larger distances (and have better scalability) than the old one did.

13 comments:

Steve in Tucson said...

Thanks for taking time off from the code'n'coffee to share, Ben. The morsels of XP10 that we get these days are somewhat few and infrequent, but they are most tasty indeed!

After reading his post over on the .Org today, one question rises out of Austin's discussion of the new weather rendering system, and that involves a foible of XP9.

Just to recap, if I understand correctly: since the current weather textures are essentially single polygon billboards, they have to be rotated in various ways to always present their normals parallel to the line of sight. This has resulted in a curious perception of cloud texture rotation *around* the line of sight axis when one's viewpoint is tilted quite far above the horizon, and is then turned left of right around the vertical. It's akin to instantaneously being assaulted by a horde of mad, fluffy pinwheels.

Austin describes a similar texture presentation for the new weather rendering system, and frankly I can't think of any other way to represent clouds.

I'm just wondering if this particular annoyance of XP9 that I described will be erradicated by the weather code rewrite for XP10?

Thanks again -

Steve

Anonymous said...

are the updaters already available?
and will you get mad if i suggest to have raibows in the sim? imagine how nice is to see a rainbow in a rainy day in xplane :)

Madine said...

wohhh increasing loaded DSF to 12 would maybe be a good idea but with the DSF becoming larger and larger, and so harder to load for XP, I don't know if it would be really great.
As you know, there have already been some test that crash XP with just 6 DSf with orthosceneries and lots of objects and facades (and those 3D "things" are really important to have the best feeling while flying)
I hope that the load system and memory system will be also improved largely .... ;o)

Madine (s├ębastien)

dancepuppy56 said...

I am probably one of the biggest commentators on this altitude issue, and thanks Ben for putting to print the issues, and i do understand that it is a very hard issue to fix, and really hope and like i have mentioned would even wait longer for Xplane 10 if it can be better in this area (moans and groans), It is a world class product, however flying along at 35,000ft some scenery is like a postage stamp, "oh that is so and so", but you can't see it, its just a jaggy, i even don't mind if it becomes just a haze in the distance, but not a jaggy, why because it is the only major issue in the sim from making it really worldclass, and i want Xplane to the very best sim on the market, Ben and this Blog is god to me, and i don't understand a lot of it, but it is very clever stuff, and thank Ben immensely for trying to fix the issues, I hope he can succeed, I wish him well in doing so....and thanks also for your time & comments on the .org
Flightime56

Benjamin Supnik said...

Madine, there is one thing to consider in having more DSFs: the 3-d is only built for a region around the plane. So creating more DSFs would require more DSF storage in RAM, but the actual 3-d scenery areas are not built for the extra far away DSFs. Thus a large part of the rendering load and memory load would not increase at all.

(DSF files can be read in part, so some day we could further optimize and not load the OBJs _at all_ until one of the DSFs becomes one of the "middle six".)

Benjamin Supnik said...

Anon: updaters aren't out yet - some time later this week I hope.

Steve: the rotation artifacts will be DIFFERENT in the new code...we've modified the billboarding scheme for one that I hope will be less annoying.

But all billboarding schemes require the billboards to move at some point in some way, so it's always a question of minimizing weirdness.

Sam 36 said...

So, effectively, XP10 doesn't have 3d clouds (volumetric), just better 2.5d (billboarded), right? Of course that's fine as long as they look better -- I just wanted to get confirmation on that.

Regards, Patrick

Benjamin Supnik said...

What exactly do you mean by a '3-d cloud'? NOTHING in computer graphics is ever truly 3-d. Everything starts as 3-d data and becomes 2-d as it goes through the graphics pipeline. By rasterization time it's 2-d polygons with a depth attribute attached. So I'm not sure I agree with your labels of 3d and 2.5d.

The new system is:
- A 3-d weather physics simulation.
- 3-d visualization using billboarded particles.

alloycowboy said...

Wow great news Ben! Any news on getting a more accurate night sky with accurate levels of light pollution? "Hint: google light pollution and light pollution maps."

Anonymous said...

Hi Ben,

1. Could you consider loading:
-between the equator and 30Lat: 6DSF's (as at present)
-between 30 and 45Lat: 8 DSF's
-between 45 and 60Lat: 10 DSF's
-between 60 and 75Lat: 12 DSF's
-between 75Lat and the poles --if any-- 14 DSF's
This way we would always have a "playground" of 120NM X (about) 180NM.

2. Right now DSF's get loaded anytime you fly between sealevel and 100,000ft; from 100,000ft to infinity earth-1 and -2 get loaded. Would it make sense to have something inbetween? For example:
-from sealevel to 60,000ft: DSF's
-from 60,000ft to 150,000ft: some intermediate textures, less resolution than the DSF's but better than earth-1
-from 150,000ft and up: earth-1.

Better even, would be if in
"Rendering Options" we could select the lower edge of the intermediate textures between 10,000ft AGL to 80,000ft MSL.

Don't know if any of this makes sense. Just some ideas that have been stewing around in my head. Some people take their sightseeing very serious; others want to be able to do VFR cross-countries; and some could not care less about eyecandy.

Best regards,

Guy

robin said...

So ... I will be reproduce being able to sit on runway 13R at KBFI(Boeing Field, Seattle) and see Mount Rainier (about 60 miles away)? Great!

- Robin

Willzah said...

Hi there! Just thought I had, what if you combined the normal 6 Dsf files with an algorithm that reads more dsf files for just basic mesh data and then combines with the "need to add elevation displacement planet render" idea. It could utilize the blend of the Planet render to the dsf pretty well, perhaps with a LOD system. Could that happen?

Benjamin Supnik said...

Yep - that's one of the things I was thinking: since DSFs are layered we could pull in the mesh immediately for "outer" DSFs and the 3-d overlays later as they scroll in.