Board index FlightGear Development Effects and shaders

Sky and ALS shader needs tweaking during dawn and dusk

An exciting "new" option in FlightGear, that includes reflections, lightmaps, the particle system etc.. A lot is yet to be discovered/implemented!

Sky and ALS shader needs tweaking during dawn and dusk

Postby Zac » Wed Jun 10, 2020 11:59 am

I think the sky shader (skydome.frag) and atmospheric light scattering shader (hazes.frag) need fine tuning for dawn and dusk. As of current the lowest of colors in the gradient of the sky is too red during dusk and dawn. I've tried to fix this myself but got lost in the complexity of the light scattering shader or have been unable to adapt the skybox shader to blend between the reds of the light scattering to the yellows of sunset. Often I will just avoid flying when the sun is low since the colors don't look realistic. I've attached a screenshot that I took at dusk and another that I altered with photoshop to demonstrate the direction I think the sky lighting colors need to be pushed towards. By no means is my photoshopping accurate, and it did capture some other areas when I was trying to change reds to yellows, but at least I hope it demonstrates how prominent the issue is. I'm hoping the developers with more knowledge on how these shaders work mathematically can improve on this slight flaw.

Raw screenshot:
Image
Altered screenshot:
Image

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

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby Thorsten » Wed Jun 10, 2020 3:35 pm

This is a joke, right? The second pic doesn't look realistic at all.

Anyway - the shader works environment dependent, so 'red' isn't a given at sunset.

Image

Image

so it's sort of pointless to take a single picture and claim that it'd be 'too much of that and that color'. What you see depends on a handful of different factors, there's no single color which you can quickly change.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby D-ECHO » Wed Jun 10, 2020 3:47 pm

@Thorsten: Is it documented somewhere on which factors this does depend? I'd like to experiment a bit with it ;)
D-ECHO
 
Posts: 2462
Joined: Sat May 09, 2015 1:31 pm
Pronouns: Bea (she/her)
Version: next

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby GinGin » Wed Jun 10, 2020 6:00 pm

You can adjust also the smog level in advanced weather , parameters.
That has a huge impact on diffraction, and color at sunrise/set


but at least I hope it demonstrates how prominent the issue is


Is it an issue for you those reddish sunsets??
I can send you plenty of real pictures with those colors, like a fire at the horizon


Now, in Sim,

Clear sky and no pollution

Image


A bit more Smog

Image




Same with haze, humidity and smog

Image
GinGin
 
Posts: 1580
Joined: Wed Jul 05, 2017 11:41 am
Location: Paris
Callsign: Gingin

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby wlbragg » Wed Jun 10, 2020 6:33 pm

I about fell of my chair at the suggestion of changing the color calculations. Especially to what you show as examples.
I once made a comment to Thorsten about how accurate that dirty dark red band on the horizon is to a real life autumn sunset.
I spend a lot of time periodically at dawn and dusk with little else to do but notice the horizon and I assure you, at least in my part of the world, that those colors and more so that "feel" is spot on.
So if this change is ever suggested for the rest of us, I want no part in it. The colors generated in the atmosphere are perfect the way they are, IMHO.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7609
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby danielHL » Wed Jun 10, 2020 6:36 pm

I must say, for me it's also always red, independent of haze and pollution. I've also given up on flying during dusk or dawn. Because especially high up, all of the scenery disappears behind a solid-reddish-brown band. Maybe I'm setting it up wrong.

I've been out and up there in reality during all times of the day, and I've never seen so much brown and red between 13500ft and ground. I'd like to experiment with a few factors, too, as D-Echo asked.
danielHL / D-FMPW
danielHL
 
Posts: 280
Joined: Fri May 02, 2014 7:23 pm
Callsign: D-FMPW
Version: next
OS: Linux

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby wlbragg » Wed Jun 10, 2020 6:47 pm

FWI: the example of what you would change it to actually showed up as "green" or chartreuse on my monitor. I've never seen a sky like that before except maybe on Venus.
I'm not purposely trying to be a twit! Maybe monitor settings, type and age have something to do with this.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7609
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby danielHL » Wed Jun 10, 2020 6:56 pm

Maybe we shouldn't focus on the second screenshot too much. Zac himself said he was unsure of his photoshop edit. I suppose the goal was to somehow make it "lighter"?

Some sky colors I have yet to see in FG are bloody red or violet skies during sunset. Forgive me for being blunt - but most screenshots show shades of brown.
danielHL / D-FMPW
danielHL
 
Posts: 280
Joined: Fri May 02, 2014 7:23 pm
Callsign: D-FMPW
Version: next
OS: Linux

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby Thorsten » Wed Jun 10, 2020 7:08 pm

Because especially high up, all of the scenery disappears behind a solid-reddish-brown band.


I'm vaguely guessing you use METAR which reports 10 NM visibility even when often it's 150 NM, so you get lots of dense ground fog. The weather system of course does as instructed and draws that, and ALS renders it - which isn't very realistic as compared with nature, but for some reason people like to fly with METAR weather and think it's realistic.

Whereas once you instruct it to draw to large ground visibilities, that's what you get.

GinGin has some really nice examples at really high altitude and good visibility:

Image

Maybe we shouldn't focus on the second screenshot too much.


If we do not, we're at an unactionable 'I think something is wrong' - to which I have as answer (literally) several dozen of real sunset pictures under vastly different weather conditions which I can map 1:1 in hue with ALS rendered pictures (largely because I have assembled a huge library of sunset pics to create the system in the first place).

So unless you come with close to the same number of real life to FG comparisons, I'm going to dismiss any critique as unsubstantiated. There's a lot of effort - both physics as well as color comparisons - invested in verifying the scheme works accurately.

@Thorsten: Is it documented somewhere on which factors this does depend? I'd like to experiment a bit with it ;)


On the wiki, on my website, on the main FG page, on an flightsim.com article,... take your pick.

Forgive me for being blunt - but most screenshots show shades of brown.


Forgive me for being blunt, but that's nonsense

Image

Image

Image

Image

Image

Image

Image

Image

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

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby icecode » Wed Jun 10, 2020 7:46 pm

@Thorsten: Is it documented somewhere on which factors this does depend? I'd like to experiment a bit with it


I'll try to provide a bit more insight. Thorsten's articles provide a good overview but lack the implementation details required for someone willing to dive on the shader itself.

The shader is basically an implementation of O'Neil's atmospheric scattering, with a few additions on top (haze, auroras, etc). You can ignore most of these as they are not responsible for the majority of the sky color. This leaves these uniforms, mostly set by the weather engine:

Code: Select all
uniform float overcast;
uniform float saturation;
uniform float visibility;
uniform float avisibility;
uniform float scattering;
uniform float terminator;
uniform float cloud_self_shading;
uniform float horizon_roughness;

uniform float hazeLayerAltitude;
uniform float terrain_alt;
uniform float air_pollution;
uniform float radius_modifier;


The vertex shader (skydome-ALS.vert) also contains some constants you can play with (around line 33).

There are also some fixed constants in the fragment shader, mostly to make the sky look good without proper HDR (O'Neil algorithm will originally provide HDR values that have to be tonemapped). I'd recommend having a look at a basic O'Neil implementation and trying to identify the parts that are also implemented in FG, so you can have a look at the differences and play around with the fixed values.
icecode
 
Posts: 710
Joined: Thu Aug 12, 2010 1:17 pm
Location: Spain
Version: next
OS: Fedora

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby danielHL » Wed Jun 10, 2020 8:43 pm

No, I don't use METAR mode. I've tried all weather scenarios at different altitudes and times of day. Is there also some location or hardware dependency on how it is rendered?

I love your screenshots, really do! I love most visuals of the sky in FG and would defend them against anything else. Sadly, I never manage to get screenshots like yours or GinGins. Especially the enormous visibilty range without any haze eludes me.

Regardless of setting, I get this band of brown haze at the horizon. For some weather scenarios it's obviously bluish gray, because of cloud layers or fog. But anything with longer visibility results in this red-organge-brown band.
Image
danielHL / D-FMPW
danielHL
 
Posts: 280
Joined: Fri May 02, 2014 7:23 pm
Callsign: D-FMPW
Version: next
OS: Linux

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby GinGin » Wed Jun 10, 2020 10:20 pm

danielHL wrote in Wed Jun 10, 2020 8:43 pm:
Regardless of setting, I get this band of brown haze at the horizon. For some weather scenarios it's obviously bluish gray, because of cloud layers or fog. But anything with longer visibility results in this red-organge-brown band.


Hey Daniel, what settings do you have in game ( Metar, visibility, LOD, etc)


300 km visibility no smog

Image



Same time, same position but with smog and reduced visibility ( 60 km)

Image

Your brown haze might come from visibility which is too low , like explained by Thorsten above
GinGin
 
Posts: 1580
Joined: Wed Jul 05, 2017 11:41 am
Location: Paris
Callsign: Gingin

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby Zac » Wed Jun 10, 2020 11:41 pm

Okay if you are happy with the sky colors this is fine, sorry for my misunderstanding.
Zac
 
Posts: 21
Joined: Mon Mar 09, 2020 2:15 am

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby vnts » Thu Jun 11, 2020 12:27 am

Environment > Weather > Detailed weather > Advanced settings > Enable realistic visibility, tweak ground haze (moisture), smog (fine particles), terrain effects etc. for nice clouds, convective conditions and turbulence affect physics and visuals. Environment settings > dust cover matters too. Rendering > Cloud settings can be turned up.

For the moment this wiki page on screenshots covers turning up settings and using FG's environment & weather sim too (feel free to add hints & tricks if anyone knows more): http://wiki.flightgear.org/Howto:Make_nice_screenshots

People have been able to get scattering like in screenshots above. This wiki category has the high settings screenshots that have been uploaded (a lot of nice shots haven't been as it's mostly SOTM entries): http://wiki.flightgear.org/Category:Scr ... h_settings
danielHL wrote in Wed Jun 10, 2020 6:56 pm:Some sky colors I have yet to see in FG are bloody red or violet skies during sunset.

What do you mean by bloody red exactly? The very red rembrandt sunsets common in screenshots are just a dated renderer. Is it possible to link a photo from google image search or somewhere.. (Photos depending on camera & post-processing will have various filters, HDR approximations, balancing, and fictitious post processing effects to make them grab attention). FG has the ability to render different scattering particles, so it should cover a lot of cases.

In addition to the screens Thorsten posted, I found it's possible to get purple during daytime with thin clouds and smog scatterers (thread). I believe higher concentration of salt molecules that scatter shorter wavelengths is said to be partially? responsible for the rare strongly pink skies associated with big storms near coastal areas (IIRC).
...
Part of the ui/ux problem of people not finding various settings can be sidestepped, if the full list of CPU/RAM/GPU/HDD-SSD speed specs could be used to turn on AW settings as well as the existing graphics card profile settings - at least for the systems with a "safe" margin of performance where everything could be turned up.

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

Re: Sky and ALS shader needs tweaking during dawn and dusk

Postby Thorsten » Thu Jun 11, 2020 6:24 am

The shader is basically an implementation of O'Neil's atmospheric scattering, with a few additions on top (haze, auroras, etc).


Actually in terms of code, the 'few additions' are probably 90% of the total :D

The O'Neil part provides the background for a clear atmosphere. The rest deals with haze layers which do not follow the exponential density distribution and haze self shading, clouds and their ability to shadow or scatter light, downward scattering from high illuminated layers, lighting on terrain and clouds, haze being in shade by terrain features,...

As I said, it's all described in quite some detail in the resources I mentioned, but a statement like 'with a few additions' falls short of reality by a pretty wide margin.
Last edited by Thorsten on Thu Jun 11, 2020 7:00 am, edited 1 time in total.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Next

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 3 guests