Board index FlightGear Media

FG vs Real life - Sunset

Screenshots, videos, sound recording etc. taken in/with FlightGear.

Re: FG vs Real life - Sunset

Postby Johan G » Sat Jul 03, 2021 3:00 pm

vnts wrote in Sat Jul 03, 2021 12:19 am:One thing I recall (?) reading is that sea salt aerosols (various molecules/particles released/nebulised in sea spray into the atmosphere that interact/react with things in the atmosphere like water or dust as well as sunlight to form aerosols) can make sunsets in costal areas more vivid - generally stronger scattering of bluer wavelengths making sunsets redder. It is also IIRC responsible for pink/purple-lish clouds at low sun after huge storms in coastal areas which increase sea aerosol concentration. IIRC sea aerosol generally causes stronger scattering at higher frequencies (?), but not sure of the distribution profile with altitude e.g. after storms - but sea aerosol might be covered under the smog slider which seems to simulate (smaller) particles that scatter the higher frequencies [...]

Interesting. :)
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: FG vs Real life - Sunset

Postby Zac » Tue Jul 27, 2021 4:06 am

I have experimented implementing a simple tone mapper over the sky and haze colors, the colors produced are certainly a lot more realistic during dawn and dusk and can be tuned quite easily to produce a desired effect. I have also experimented by altering the hazeColor variable in haze.frag and skydome.frag and I can say from experience that purely by editing the values within the current shader framework it will be very hard to achieve any sunset colors that are close to real life. It is tricky to manipulate it this way since this value is very sensitive and so quite hard to fine tune to make it look correct at all angles of the sun. Especially when you start incorporating dynamic variable such as pollution, I could imagine that the colors could "get away" from you very fast and all of a sudden the code is producing colors which were not intended. It is much easier to accept the value of hazeColor and use further post processing to tune the colors using something like a tone mapper.

The image below is my very first attempt to use a tone mapper to alter the sky and haze colors, just plugged and played from code found on the internet, though some undesirable effects were produced while the sun angles were high such as absence of blues primarily, though not to say this could be aided by adjusting the strength of the tone mapper relative to the sun angle. I was impressed with how this basic and very simple implementation dealt with the harshness of the reds at sunset and I think with some fine tuning even better colors could be achieved. I have seen a preview of the HDR pipeline which includes the ACES tone mapper and I am really looking forward to seeing more as from what I have seen it looks like a very good solution to adjust the sky colors and produce more realistic sunset colors overall, and definitely better than my simple implementation.

Image
Zac
 
Posts: 21
Joined: Mon Mar 09, 2020 2:15 am

Re: FG vs Real life - Sunset

Postby Thorsten » Tue Jul 27, 2021 7:22 am

I have experimented implementing a simple tone mapper over the sky and haze colors, the colors produced are certainly a lot more realistic during dawn and dusk and can be tuned quite easily to produce a desired effect


Again - the crux (as usual) is the definition of 'realistic' and 'desired'.

My claim to 'realistic' is a database of ~200 sunset pictures which I've color-mapped and analyzed, augmented by a lot of knowledge of the physics of light scattering - as well as augmented with knowledge what a camera actually images in a low-light setting and what the eye does differently.

The usual challenge of that is (as in this thread) a single picture against FG with the sentence 'FG doesn't reproduce that'.

Nature has a huge range of possible outcomes, and you'll take a large set of comparisons across (literally) hundreds of situations to do anything that's better than the current implementation.

As for 'desirable' - that's ill-defined. Some people like realism, others prefer gaming features and visuals which often are 'larger than life' - ALS is committed by design to do 'realistic' as in 'the eyes see it that way' - anyone who desires something else is using the wrong framework, that's all I can say to that.

Short version: I don't consider your screenshot more realistic than what ALS currently does anyway, I've certainly seen haze as depicted there plenty of times.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: FG vs Real life - Sunset

Postby vnts » Tue Jul 27, 2021 9:46 am

Zac wrote in Tue Jul 27, 2021 4:06 am: I have also experimented by altering the hazeColor variable in haze.frag and skydome.frag and I can say from experience that purely by editing the values within the current shader framework it will be very hard to achieve any sunset colors that are close to real life. It is tricky to manipulate it this way since this value is very sensitive and so quite hard to fine tune to make it look correct at all angles of the sun. Especially when you start incorporating dynamic variable such as pollution, I could imagine that the colors could "get away" from you very fast and all of a sudden the code is producing colors which were not intended.

Well shaders mean programmability, and if it's possible to define something mathematically it's possible to implement it. Doing another mapping pass is just changing the algorithm. There's nothing stopping changing of the algorithm/approximation based on sun angle - and environment irradiance is added in like that.

With regards to a definition of "realistic", and changing conditions, a quick google gives these articles for effects of sea salt concentration on sunsets and sky/cloud colours after massive storms in coastal areas. https://www.zmescience.com/other/pieces ... t-14102019 , https://www.bbc.com/news/uk-england-46467988 , http://ww2010.atmos.uiuc.edu/(Gh)/guides/mtr/opt/air/sun.rxml

But if the sunset look was hardcoded to always match one of these conditions, what happens when locations/conditions are different?

If it's possible to define the scientific cause of the reddishness you mean, it may be possible to add that in when appropriate - for example taking into account location and weather to put additional aerosol. Advanced weather is done in Nasal and has access to relevant data e.g. terrain and landclass data, and can create needed properties which can be sent to the shader as uniforms.

The way ALS seems to be done is having the math/understanding for a very detailed model, and then creating custom fast expressions to match what's seen on Earth and also include various extra factors that make a large visual difference - like dust/smog aerosol/moisture. There's also lot of code that's easy to miss in the vertex shaders for low sun cases specifically - so adjusting approximations to cover different cases/regimes not a big deal provided the cause is understood and modeled. The vertex shader covers, for each vertex, altitude/normal dependent irradiance from the skydome/haze layer/moonlight including HDR adjustments for surfaces facing away from the sun and shadows (there's a perceptual moonlight part that isn't filled in yet). I don't know what the detailed model behind the current version is, what factors could be refined, what things weren't added due to needing extra core functionality back then, and what factors aren't covered yet etc.

It's better to find what the exact cause of the reddishness is and improve the model if it's worthwhile. For example, to get a red sunset/sunrise colour, it is possible to just hack-in an increase the optical depth of the atmosphere by increasing the atmospheric density at the surface (the density higher up decreases with an exponential curve in the isothermal atmosphere approximation used by O'Niel). The extra density means there are more particles in the path of a ray of sunlight at sunset which goes low through the densest atmosphere. So there would be a redder sunset as the blues and greens get bounced off. But this would mean the colours outside sunset would be wrong as it's essentially depicting a non-terrestrial atmosphere, unless it was done for low angles of the sun and then the dust/smog/haze would need to be changed - and even then the sky might be too thick overhead or the wrong colours away from the sun unless another correction was done. And then there are things like the colours of ice halos, and the cloud lighting by the sun and skydome which also has to look correct. Moonlight has to be factored in, including the regime when the sun/skydome and moonlight compete. So it's better to find the proper cause and adjust the code.

I think the initial O'Neil scattering approximations matched the optical depths fairly well(?) , so there might not be much to improve (although the optical depth does increase really rapidly as the sun nears the horizon). Not sure if the density at the surface based on pressure/temperature to warrant dynamically changing the density, when the code for haze layers probably handles these cases. It's also possible to tweak the exponential curve by changing the scale height if the atmosphere meaningfully deviated from the isothermal model (e.g. the composition of the lower atmosphere and the a dry/wet adiabatic model being more accurate), but I don't think it would be much of a factor (?) at sunset as the light goes through the lowest part of the atmosphere before it thins out. The occasional reddish-ness might be more likely to be related to extra scattering particles combined with perceptual effects, or something.

Zac wrote in Tue Jul 27, 2021 4:06 am: I have also experimented by altering the hazeColor variable in haze.frag and skydome.frag [..] It is much easier to accept the value of hazeColor and use further post processing to tune the colors using something like a tone mapper.

I think the get_hazeColor function includes the spectrum of incoming sunlight, air pollution etc. Changing hazeColor after the function might be like prefiltering it through a layer of atmosphere before hitting our atmosphere or something - there's lots of other factors that are unaccounted for with this approach like calculations that might be tuned for a different sky colour like light contributions from smog/fog layers with different heights, cloud lighting, ice halo lighting, and the skydome/moonlight irradiance for each ground triangle which is calculated in the vertex shader.

Kind regards
vnts
 
Posts: 409
Joined: Thu Apr 02, 2015 1:29 am

Re: FG vs Real life - Sunset

Postby Zac » Wed Jul 28, 2021 2:35 am

Thorsten wrote in Tue Jul 27, 2021 7:22 am:Short version: I don't consider your screenshot more realistic than what ALS currently does anyway


That is fine, I am just sharing my experience and hope that others can take it onboard to improve the current sky colors.

vnts wrote in Tue Jul 27, 2021 9:46 am:So it's better to find the proper cause and adjust the code.


If you would like, experiment for yourselves in changing the parameters of hColor within the current shaders, skydome.vert and haze.frag...

Image

But a warning that you could be sitting there for hours achieving nothing but muggy unrealistic colors (by most people's definition) ...

Image

This is why I believe tone mappers become useful to aid this process, using the current framework it is really like playing archery and trying to hit a target half way around the other side of the world :lol: . In my opinion the current colors are as far as you will ever get to realism under the current shader framework.
Zac
 
Posts: 21
Joined: Mon Mar 09, 2020 2:15 am

Re: FG vs Real life - Sunset

Postby Thorsten » Wed Jul 28, 2021 7:09 am

If you would like, experiment for yourselves in changing the parameters of hColor within the current shaders, skydome.vert and haze.frag...


Well, these functions originate from rgb-mapping time series images of real sunsets with camera exposure kept constant- so it's unlikely that you get more realistic results by anything as crude as 'just trying'.

(If you like, they encode the wavelength-dependent absorption curve of light through the atmosphere as a function of sun angle - and before anyone asks, that's of course also altitude dependent, which is why the sunset colors are different at high altitude, there's a correction being done for high objects - such as spacecraft).
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Previous

Return to Media

Who is online

Users browsing this forum: No registered users and 4 guests