Board index FlightGear Development Weather

Lightning

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

Re: Lightning

Postby Thorsten » Sat Sep 22, 2018 7:15 am

The cloud gets illuminated like this:


It's there in the code and various people see it - you can try to pause FG and set the lightning property (somewhere under /local-weather/lightning ) probably to 'true' and look around for the last bolt.

But otherwise, your system somehow seems to act up in unexpected ways (see the Shuttle or the CAT-IIIb thing), and I suspect there's one underlying common cause and you're reporting various symptoms - but if for some reason Nasal code isn't executed for you in the sequences the code says, then examining the particular code won't do much.

I guess you eventually need to delve into one of these things in detail, try to make the weird behavior appear and go away by changing the code and see what is really called and what not so that the underlying cause becomes apparent.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Lightning

Postby legoboyvdlp » Sat Sep 22, 2018 12:12 pm

If you wouldn't mind telling me where METAR is parsed by AW that would help - the problem with the CAT IIIB scenario is that FG is not parsed properly, at least in that scenario. So is METAR parsed in Nasal/local-weather, the C++ code, or elsewhere?

I realize AW doesn't use METARS as such according to something you wrote on another topic, but it instead translates them somehow to weather fronts, air masses, etc, correct?

Basically what I'm looking for is the code that reads the METAR string in Environment/environment.xml :) thanks!
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: Lightning

Postby Thorsten » Sat Sep 22, 2018 12:48 pm

METAR isn't parsed by AW, it's parsed by a C++ routine and AW picks up the individual properties the parser outputs. And it does use METAR as such, it applies some heuristics to determine what's not reported though.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Lightning

Postby legoboyvdlp » Sat Sep 22, 2018 1:09 pm

Ok - in that case, I want to look at what the C++ routine outputs for FG input. Thanks!
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: Lightning

Postby legoboyvdlp » Sat Sep 22, 2018 1:43 pm

I think I'll document this here, for anyone who might need this in the future:

metarproperties.cxx:

This code reads the METAR and gets the phenomenon, setting a boolean to true if it is present.

Code: Select all
if( phenomenon == "FG" ) isFG = true;
                if( phenomenon == "HZ" ) isHZ = true;
                if( phenomenon == "BR" ) isBR = true;
                if( description == "MI" ) isMI = true;
                if( description == "BC" ) isBC = true;


The ground cloud layer is disabled if 3D clouds are enabled by setting setGroundCloudLayer to false

Code: Select all
// fog/mist/haze cloud layer does not work with 3d clouds yet :-(
        bool setGroundCloudLayer = _rootNode->getBoolValue("set-ground-cloud-layer", false ) &&
              false == (fgGetBool("/sim/rendering/shader-effects", false ) &&
                        fgGetBool("/sim/rendering/clouds3d-enable", false ) );


So, none of those properties in /environment/params/fog-mist-haze-layer will be set if 3D clouds are enabled - i.e. FG is completely ignored, and Advanced Weather uses only visibility to create fog. At least, that's the impression I get from reading metarproperties.cxx, I'm not sure if its right or not. Now, I need to see why it ignores visibility when FG is in the METAR string.

As for visibility, the minimum visibility is tied to min-visibility-m and the maximum to max-visibility-m - I assume therefore, that is what those properties under environment/ are.

Code: Select all
_tiedProperties.Tie("min-visibility-m", &_min_visibility );
  _tiedProperties.Tie("max-visibility-m", &_max_visibility );


Those _min_visibility properties are set as such:

Code: Select all
_min_visibility = m->getMinVisibility().getVisibility_m();
    _max_visibility = m->getMaxVisibility().getVisibility_m();


And of course, I need to test in FlightGear with a few custom METAR strings.
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: Lightning

Postby wkitty42 » Sat Sep 22, 2018 2:03 pm

legoboyvdlp wrote in Sat Sep 22, 2018 1:43 pm:So, none of those properties in /environment/params/fog-mist-haze-layer will be set if 3D clouds are enabled

really? i ask because i understand that AW forces 3D clouds to be on regardless of their setting in the dialog...
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9123
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 20.04

Re: Lightning

Postby legoboyvdlp » Sat Sep 22, 2018 2:22 pm

Ok, so the results of a few tests:

You can skip this section and jump down to conclusions, this is how I came to those conclusions :)

Basic Weather, ALS / shaders and 3D clouds off
Image

ALS on, still basic weather
Image

Notice that despite the same effective-visibility, ALS renders much, much farther.
A climb reveals this:
Image
One tap of end reveals this:
Image

Let's say that I can see clearly from here to the storage tanks, even though I can see further. Using phi, that's a distance of 2.5 miles, or 4000 meters. That's significantly more than the 800m reported.


Ok, this might be to do with the bug that wkitty is talking about actually. When I hit z / Z it said Max Visibility, not Visibility!. However, once I had made sure I was definitely in basic weather by opening the dialog again and hitting apply, the actual visibility was 20km. When switching ALS off, the actual visibility reduced to 800m (confirmed in Phi using landmarks about 800m away).
ALS off
Image
ALS on
Image
ALS on, visibility reduced manually to 800m.
Image


I now set ALS off, visibility to 20km again (although visibility remained at 800m with ALS off), and enabled AW.

Image

Notice that effective visibility is 20km!

With ALS on,
Image

I then removed FG from the metar string:
Notice that effective-visibility is now 800m, which it never was when FG was reported.
Image

Conclusions
Therefore, I conclude that with ALS on, the visibility reported in METAR is ignored in favour of visibility set by the user using the z/Z key. That's bug number 1 - or maybe intended behaviour?

I also conclude that AW simply cannot parse fog as set by the "FG" parameter, since it uses 3D clouds, and fog is disabled when 3D clouds are enabled.
Code: Select all
// fog/mist/haze cloud layer does not work with 3d clouds yet :-(
        bool setGroundCloudLayer = _rootNode->getBoolValue("set-ground-cloud-layer", false ) &&
              false == (fgGetBool("/sim/rendering/shader-effects", false ) &&
                        fgGetBool("/sim/rendering/clouds3d-enable", false ) )


The real bug here is that when FG is reported, visibility, in this case 800m, is ignored in favour of trying to render fog - which AW cannot do by design, since it uses 3D clouds!


Under every combination of AW on / off, ALS on / off, visibility was 800m when FG was removed - I only got 800m visibility with FG in the METAR with ALS and AW off.

The fix to me seems simple - set effective-visibility to the reported visibility when FG is in the METAR? But then perhaps that is not done for some reason I am missing?





wkitty42 wrote in Sat Sep 22, 2018 2:03 pm:really? i ask because i understand that AW forces 3D clouds to be on regardless of their setting in the dialog...



Precisely my point - AW can't render fog when FG is present in the METAR, because it uses 3D clouds. When FG is NOT present in the METAR, it renders fog perfectly, because it sets effective-visibility to 800.
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: Lightning

Postby legoboyvdlp » Sat Sep 22, 2018 2:48 pm

If anyone wants to test this,
1. Set Morning Fog scenario
2. Disable AW / ALS
3. Is visibility as you would expect 800 meters?
4. Enable ALS
5. Is visibility increased to 20km, and can you control it with z/Z?
6. Enable AW
7. Is visibility back to 800 meters or is it 20km again?
8. Change scenario to manual input, then remove "FG" from the METAR
8. Is visibility now 800 meters?


If anyone on Windows 10 in particular could check this, it would be good.

Also @moderators, this isn't really the right topic, maybe it could be split to "Debugging Weather / visibility"?
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: Lightning

Postby Octal450 » Sat Sep 22, 2018 3:36 pm

I will do it later today.
Skillset: JSBsim Flight Dynamics, Systems, Canvas, Autoflight/Control, Instrumentation, Animations
Aircraft: A320-family, MD-11, MD-80, Contribs in a few others

Octal450's GitHub|Launcher Catalog
|Airbus Dev Discord|Octal450 Hangar Dev Discord
User avatar
Octal450
 
Posts: 5565
Joined: Tue Oct 06, 2015 1:51 pm
Location: Huntsville, AL
Callsign: WTF411
Version: next
OS: Windows 11

Re: Lightning

Postby Thorsten » Sat Sep 22, 2018 4:23 pm

Here it's 800 m in all cases (both /environment/visibility-m and the visuals agree). The only thing is that BW + ALS gets the fog lit much more brightly.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Lightning

Postby legoboyvdlp » Wed Nov 07, 2018 4:48 pm

It looks like someone 'fixed' the METAR string by removing FG:

Image

so thanks for that :)

Early morning fog still has the issue - although seemingly only on my computer?
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: Lightning

Postby legoboyvdlp » Mon Jan 07, 2019 6:02 pm

The simple solution to all the problems is to enable 3D clouds and exit FlightGear via File > Exit in order to save the option... Without the option for 3D clouds enables you don't get lightning bolts, rainshafts, rainbows... I just had a flight with all three ;)
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Re: Lightning

Postby Thorsten » Mon Jan 07, 2019 7:05 pm

Okay... I am somewhat surprised - for the heck of it I'm not sure how 3d clouds and lightning (which are like totally different technology) are connected.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Lightning

Postby legoboyvdlp » Mon Jan 07, 2019 8:04 pm

I was equally surprised, but it's a fact - when I disabled 3D clouds in the autosave and restarted I saw the visibility bug, and saw neither lightning nor rainshafts with the thunderstorm scenario - when I enabled and restarted I saw them (and visibility worked correctly) :?

I always assumed that the 3D clouds option would conflict with AW so never used it (just enabled AW) - so when I saw it0uchpods used them and also had correct visibility I enabled them and got not only working visibility but as an added bonus, lightning and rainshafts!
User avatar
legoboyvdlp
 
Posts: 7981
Joined: Sat Jul 26, 2014 2:28 am
Location: Northern Ireland
Callsign: G-LEGO
Version: next
OS: Windows 10 HP

Previous

Return to Weather

Who is online

Users browsing this forum: No registered users and 2 guests