Board index FlightGear Development Weather

New thunderstorm AI scenario alpha release

Everything related to weather simulation, visuals should be discussed in the shader subforum.

New thunderstorm AI scenario alpha release

Postby Thorsten » Sun Feb 07, 2010 3:13 pm

The purpose of my interest in clouds in the other thread is to generate a bit of interesting local weather patterns - as an example, I've been working on a decent thunderstorm as AI scenario. The result looks like this so far (and yes, it has lightning)

Image

which is not so bad as long as you don't get too close or try to view it from above (which doesn't work with most planes anyway, as the cloud tower is 34.000 ft high). What I would now like to happen when one gets close is that the visibility decreases and that rain fades in. For this, I'd need to implement some kind of distance/altitude condition between plane and storm. I guess it must be possible - turbulence is only inside the storm radius, the outer, middle and inner markers for IFR approach implement a distance condition, or air-air-refueling must do so - I just don't exactly know to implement that. Any help will be greatly appreciated and returned eventually in the form of interesting weather AI scenarios.

Edit: The latest package updated to accomodate FlightGear 2.0.0 can be obtained here. It should be unpacked in the Flightgear root directory and writes content into AI/ , Docs/, Effects/ and Models/Weather/ subfolders. It can be called using --ai-scenario=local_weather_thunderstorm which should also take care of loading the nasal control scripts. I have mainly tested it with the standard 'Fair Weather' scenario. It *should* accomodate other weather conditions, but if not, please let me know.

README.local_weather:

This package contains the local weather AI scenarios 'local_weather_thunderstorm' and 'local_weather_cirrus'. Currently they populate the sky over San Francisco either with a thunderstorm or a Cirrus/Cirrocumulus sky. The thunderstorm comes with dynamical weather effects - rain, snow, turbulence and lightning inside the cloud tower. The packages contain more cloud models and textures than are actually needed in the scenarios, the scenarios are just to demonstrate what can be done using local weather AI models.

Known issues:

* AI model clouds seem to interfere with the standard layered clouds, thus for best effect any layered clouds need to be off - a low 3-d Cumulus layer on the other hand works well.

* Currently, the Cirrus and Cirrocumulus cloud models use the Aircraft AI system. Presumably, this (dependent on visibility) leads to their sudden (dis-)appearance with distance, and a better solution should be found.

* In tests, the rain inside the storm did not switch on in spite of /metar/rain-norm being set properly. This has nothing to do with the scenario as such, even without the scenario, the rain does not switch on when the menu slider is moved. Deactivating and immediately reactivating shader effects in the Rendering Options menu solves the problem.


The package should be extracted in the Flightgear root directory.

The package is developed and tested using Flightgear 2.0.0, it may or may not work properly on other versions.

Thorsten Renk, Mar. 2010
Last edited by Thorsten on Fri Mar 05, 2010 8:15 pm, edited 3 times in total.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Thunderstorm - how to switch on rain?

Postby Thorsten » Tue Feb 09, 2010 1:27 pm

Anyone?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Thunderstorm - how to switch on rain?

Postby glazmax » Tue Feb 09, 2010 2:30 pm

Sorry but I am not very familiar with AI scenarios but I give it a quick shot:

1.)You have your current position, alt in the property tree
2.)You have to create a new property node, could be something like environment/thunderstorm (edit:environment/weather-scenarios is already there) where you place the coordinates of your thunderstorm center
3.)Now with some nasal you can get the distance:
First get the properties, then set the coordinates, then with the geo. distance_to you get the distance in m (example from tanker)
--> look at Nasal/geo.nas for other possibilities

Code: Select all
var clat = getprop("position/latitude-deg");
var clong = getprop("position/longitude-deg");
var tlat = getprop("ai/tanker/prop-latitude-deg");
var tlong = getprop("ai/tanker/prop-longitude-deg");
var cpos = geo.Coord.new().set_latlon(clat, clong);
var tpos = geo.Coord.new().set_latlon(tlat, tlong);

var tdist = cpos.distance_to(tpos);#in m


4.) Then you could set the properties for visibility (environment/visibility-m or similar) and
precipitation (from 0 to 1 in 1/3 steps if I remember correctly)
edit: environment/metar/rain-norm and environment/metar/snow-norm are the rain/snow properties

So you can have a little nasal script in the background to check for distance and altitude and turn rain into snow if you are higher in the thunderstorm.

I think you will have metar disabled as it regulary updates/overwrites the weather properties.

Just one question: Did you ever try to use particle systems in combination with clouds to make them more dynamic?

The thunderstorm already looks very frightening ;),
glazmax
XXX pilot of the caribbean - bones and porters XXX
User avatar
glazmax
 
Posts: 453
Joined: Sat Jan 27, 2007 11:38 am
Location: Austria
Callsign: jettoo/OE-JTO
Version: cvs

Re: Thunderstorm - how to switch on rain?

Postby Thorsten » Wed Feb 10, 2010 8:49 am

Thanks, that contained a number of useful pointers (although, as usual, the difficulties are in the smallprint...). It appears Nasal is quite handy - a bit like shell scripting :D So it looks like I may be able to do what I want.

Just one question: Did you ever try to use particle systems in combination with clouds to make them more dynamic?


You mean compose a cloud of many individual misty patches like the contrails are done? I'd probably need to arrange a million to get a decent thunderstorm... The trouble with cb clouds is that their texture and structure is given by turbulent airstream properties, so there is no simply way to make it look good, except take an actual cloud texture. In the early days of raytracing (when rendering a scene took minutes) I've been experimenting quite a lot with POVray to generate cloudy objects, and it's rather tricky.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Thunderstorm - how to switch on rain?

Postby Thorsten » Wed Feb 10, 2010 6:30 pm

Seems to work more or less so far... 8)

So, how do I load a nasal script only with the AI scenario rather than with everything in the Nasal subdirectory at startup?

For added eyecandy value - is there a way to decrease light along with visibility when in the clouds (other than cheating and simply changing the time)?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Thunderstorm - how to switch on rain?

Postby Thorsten » Fri Feb 12, 2010 5:41 pm

A bit of a progress report - I'm almost happy with the scenario, and I think it makes for some spectacular flight experience. I implemented a transformation using a nasal script to orient the model always towards the axis observer-cloud center (unlike the billboard animation not perpendicular the observer's direction of view which looks better as it does not move the cloud when changing the view axis). The main cloud layer is projected onto a sphere, which improves the look from directly above. Secondary cloud layers add some 3-d impression. Inside the storm there's heavy rain below 10.000 ft and snow above 10.000 ft, strong turbulence and two layers of reduced and essentially zero visibility. All weather conditions outsided are saved when entering the cloud and restored when leaving the cloud. Conditions inside the cloud are written continuously, thus the scenario should even be able to cope to some degree with --enable-real-weather-fetch. Right now, I'm mainly trying for clean coding so that the scenario doesn't interfere with other (weather) scenarios.

Here's the cloud tower seen from the Concorde cruise altitude:

Image

Seen from an intermediate altitude of about 20.000 ft.

Image

On the ground level, there is a curtain of rain and lightning.

Image

Finally, the ground underneath the cloud tower is in heavy rain. This, however, should be much darker with so much cloud blocking the light.

Image

Before making the scenario available, I'd need to find solutions to the following issues:

* how do I load a nasal script only with the AI scenario rather than with everything in the Nasal subdirectory at startup?

* how do I set a boolean property from a nasal script?

* is there a way to control the amount of ambient light other than dialing the time setting to dawn?

Please help!
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Thunderstorm - how to switch on rain?

Postby DFaber » Sat Feb 13, 2010 3:06 pm

Hi Thorsten,

this looks very impressive!

Thorsten wrote:Before making the scenario available, I'd need to find solutions to the following issues:

* how do I load a nasal script only with the AI scenario rather than with everything in the Nasal subdirectory at startup?


If there is a model xml file involved, you can embed the nasal skript in it. The skript will be executed once the Model is loaded and will be stopped when unloaded. An example:

Code: Select all
  <PropertyList>
    <path>typhoon-ai.ac</path>

  <nasal>
    <load>
         var self = cmdarg();

      var livery_update = aircraft.livery_update.new("Aircraft/eurofighter/Models/Liveries", 10);
    </load>
    <unload>
      livery_update.stop();
    </unload>
  </nasal>



This is from the eurofighter AI Model, here it handles the Livery sent over multiplayer, but it can of course do much more.

* how do I set a boolean property from a nasal script?


Have a look at the descriptions in the Nasal/props.nas file. You can set a whole property tree from Nasal and remove it again.

Hope to see this soon!
Detlef Faber
FlightGear Development:
http://flightgear-de.net

my 3D-Art:
https://www.sol2500.net
DFaber
 
Posts: 709
Joined: Fri Dec 01, 2006 8:51 pm
Location: Aachen, Germany
Version: GIT
OS: Linux

Re: New thunderstorm AI scenario alpha release

Postby Thorsten » Mon Feb 15, 2010 10:44 am

Thanks for the pointers. Things were not exactly straightforward, but I guess it works now.

The alpha release of the package is available for testing now - see first post in the thread.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: New thunderstorm AI scenario alpha release

Postby HHS » Wed Feb 17, 2010 1:19 pm

I did try it, but it don't work.
The clouds are nearly invisible, inside they are flickering.

Maybe a problem with the driver as the new stencil lights in CVS aren't working as I can see on the screenshots.... I will investigate.
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Re: New thunderstorm AI scenario alpha release

Postby Thorsten » Wed Feb 17, 2010 4:49 pm

I can't test CVS, I developed under 1.9.1 :(

The flickering of the clouds looks like a malfunction of the 'select' animation tag which is supposed to move all of the cloud model when you're inside and the visibility is reduced - then flying through the texture layers looked odd, so I decided to remove them. So you may want to look at the 'in-cloud' property set inside the AI model property tree which should trigger that.

It beats me why the clouds would be invisible though - they are just surfaces painted with texture layers, so why they shouldn't be shown properly beats me. I've had some issues with transparent layers though - for example, the cloud doesn't render properly seen through a Cirrus layer - but that is generic for me, I see the same problem when looking through the Cirrus layer at the standard 3-d clouds.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: New thunderstorm AI scenario alpha release

Postby Thorsten » Fri Feb 19, 2010 6:31 pm

I wonder if anyone else could test run the scenario and reproduce either my working solution or the bug?
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: New thunderstorm AI scenario alpha release

Postby fatty » Sat Feb 20, 2010 6:16 am

Sorry Thorsten, but I'm having the same problem as HHS, using CVS.
fatty
 
Posts: 202
Joined: Sat Jan 13, 2007 4:41 am
Location: Pennsylvania, U.S.

Re: New thunderstorm AI scenario alpha release

Postby 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.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: New thunderstorm AI scenario alpha release

Postby wookierabbit » Tue Mar 02, 2010 10:38 am

(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,...



I know exactly how you feel. Take it easy now.
-Wookierabbit (Founder, former CEO, and former webmaster of the original Virtual Star Alliance website)

Youtube site: http://www.youtube.com/user/Wookierabbit
VSA.

Contact either by PM or via my former website at http://www.starallianceorg.webs.com
User avatar
wookierabbit
 
Posts: 1221
Joined: Wed Apr 01, 2009 3:44 am
Location: Dallas - Ft. Worth, TX
Callsign: ---805, ATC
Version: 191
OS: Windows

Re: New thunderstorm AI scenario alpha release

Postby glazmax » Tue Mar 02, 2010 11:09 am

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.


As you stated, you have done some very valuable work on weather system layout and cloud rendering and now the next logical step will be to get that into the simulator. One advise from me for you is to switch to flightgear cvs to be able to monitor positive and negative changes "on the fly". So you can react and report broken things when they happen, and thus are easier to fix.
Now for me the next step would be to chat with the developers on IRC, state your intentions to get a brief overview what is possible and what is not. As flightgear managed the step to OSG succesfully, I expect lot of development regarding shaders the next year, so just communicate with the devs and try to find a solution for your ideas.
Nothing is lost at the moment but everything can be won, so let the development take some time, "Rome was not build in one day", annoying but true.

For the solid clouds, there was a property setting "hot" enable/disable solid objects (used on the carrier before), but I don't know if it still works.

Thanks for the development so far and keep it up.
All the best,
glazmax
XXX pilot of the caribbean - bones and porters XXX
User avatar
glazmax
 
Posts: 453
Joined: Sat Jan 27, 2007 11:38 am
Location: Austria
Callsign: jettoo/OE-JTO
Version: cvs

Next

Return to Weather

Who is online

Users browsing this forum: No registered users and 2 guests