by Thorsten » Tue Mar 02, 2010 9:27 am
With version 2.0.0 now available, I've finally had the chance to look at the AI weather scenarios to see where the problems are and why the thunderstorm isn't working properly. I've identified four different problems:
* Fading of distant objects
First have a look at reality: In the real world, faraway objects tend to vanish from view for two different reasons. The first one is attenuation - there is dust and moisture in the atmosphere. Usually, they are most pronounced close to the ground, which is why an empty sky is blue (or even almost black) when looking straight up (not much dust in the line of view), whereas towards the horizon there is a white hazy band. Due to this effect, faraway objects show less contrast and their color shifts to a uniform bluish-white which eventually blends into the horizon. However, huge objects (like mountain ranges or thunderstorms) may reach out of the main dust and moisture - then they can be seen from very far (hundreds of kilometers) away, seemingly floating above the dust band at the horizon. They eventually become invisible due to the second effect, the curvature of the earth, which sooner or later moves everything into the haze at the horizon. Objects which are not in some way tied to the ground and therefore don't follow the curvature of the earth never vanish from sight until much later (the moon is 300.000 km away and can clearly be seen).
No computer can really render dust and moisture attenuation in real time, so Flightgear uses some effect to simulate it.
In Flightgear 1.9.1, the way this is implemented for AI objects is that they whiten out (lose contrast) with distance, until they reach some range, at which point they are simply removed from the simulation. Thus, approaching a thunderstorm cloud model, you'd first see the outline in white popping up from the background, and subsequently contrast appears when you approach. The sudden appearance isn't a particularly pleasant feature, but worked sort of okay.
In Flightgear 2.0.0, faraway AI objects don't whiten out, instead textures fade from black to white to transparent. Since clouds are naturally white, they fade rapidly to transparent even for small distances, so you never get to see the towering outline from the distance. For clouds, this behaviour looks extremely unrealistic, a semi-transparent thunderhead isn't really something you get to see every day... One can play with the fading using 'z' and 'shift-z' to appreciate what happens.
This has nothing to do with my scenario - the cloud models are just fine. I've tried the thermal_demo and the bigstorm_demo AI scenarios, and they fare no better, thermal cap clouds also are transparent in distance, looking extremely strange.
I suppose the rational for the new fading is more apparent for AI objects like ships or aircraft which would seem to emerge from distant haze that way - but for any larger scale AI models, it just fails to create a good appearance.
* Shading:
Flightgear 2.0.0 has very strong shading of surfaces away from the sun, overriding the ambient settings in the Material declaration of the ac model file. As a result, some cloud surfaces (again, this holds for thermal cap clouds as well as the bigstorm demo) appear almost black. Probably worse, also Cirrus cloud models appear black when they are between sun and observer (when in reality they would shine brilliant-white under these conditions).
I suppose the shading looks really good on ships or aircraft - but for any type of cloud model, it is way too strong.
* Restructured property tree
One of the Nasal scripts taking care of weather effects inside the thunderstorm model crashes because something in the property tree has changed between 1.9.1 and 2.0.0. I haven't actually tracked down what it was, but I'm confident I can fix that. But that doesn't really matter so much because...
* AI objects are now solid (i.e. users can collide with them)
Yeah, I think you can guess what happened - I smashed a Tomcat colliding with the cloud. I sort of understand the rational for aircraft AI models, there it's a feature, but I guess for the thunderstorm AI model that's a bug... Works fine with the thermal cap clouds by the way, they are not solid, but again it's not my scenario - bigstorm_demo kills you as well when you try to get into the clouds. Well, we know thunderstorms are dangerous and you shouldn't fly in, don't we?
So, all in all, Flightgear 1.9.1 provided an environment in which AI weather looked great - I've only been experimenting a bit, and I can create the most amazing skies with all sorts of cloud types and 3-d Cirrus and other high-altitude clouds. By some unfortunate chance, Flightgear 2.0.0 has introduced a series of (aside from AI weather) well-motivated changes, which just happen to provide an environment in which AI weather generally looks bad. I don't see a way that any of the scenarios will look good and work in 2.0.0 - that requires C++ coding, so that means that a possible bugfix 2.0.1 or a future CVS may or may not show AI weather skies properly. I don't think the glider pilots are too happy with the thermal caps right now though...
(If I may be permitted a private interlude - I honestly feel like screaming <censored> from the top of my lungs, wiping Flightgear from the harddisk, and getting X-Plane instead and throw the whole cloud work into garbage. Thanks for indulging.)
Well, I'm out of ideas, and I'm simply down to asking for help. Hooray has already indicated that he might be willing to give it a try on the C++ side - if anyone else has any useful ideas, please let me know, there's a lot of my work in these projects, I believe the concept of AI weather is really powerful and capable of creating better weather effects than the system as it stands (even in 2.0.0) and I'd hate to see everything lost.
Apparently one can now control shaders via an XML tag - maybe that would help (maybe not) - if anyone knows where this is documented, please let me know. Thanks.