Board index FlightGear Development Effects and shaders

Sunrises (version 1.3 available)

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

Re: Sunrises (version 1.2 available)

Postby Thorsten » Thu Mar 08, 2012 6:11 pm

*sigh* Seems my attempt to fix one issue has created a subtle-to-spot second one - currently the light dims the wrong way. Will have a fix by tomorrow.
Thorsten
 
Posts: 11578
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.2 available)

Postby fredb » Thu Mar 08, 2012 6:48 pm

I am waiting then
User avatar
fredb
 
Posts: 756
Joined: Fri Dec 01, 2006 10:41 am
Location: Paris, France

Re: Sunrises (version 1.2 available)

Postby Gijs » Thu Mar 08, 2012 7:49 pm

Not sure if this is correct behaviour, but it doesn't look as nice as your screenshots at daylight (dusk/dawn look absolutely brilliant!). Note that this screenshot is at a slightly larger than default FOV, so I could capture the sky well. But the effect is the same with normal FOV...

Image
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9417
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Sunrises (version 1.2 available)

Postby Thorsten » Thu Mar 08, 2012 8:10 pm

Fixed, tested for an hour from pre-dawn to morning, seems to be fine, repackaged and uploaded again - should be fine now.

@Gijs: Apart from the skydome 'crack' (the funny reflection in the upper right) which has been with the scattering shader since I know it and which nobody so far has managed to trace I can't see anything really odd - what do you mean?
Thorsten
 
Posts: 11578
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.2 available)

Postby Gijs » Thu Mar 08, 2012 8:33 pm

I meant the sinusoid pattern of darker/lighter blue above/around the sun. The bump gets larger when the sun gets higher, until a certain angle, when the sun "breaks out" of the bump. This picture shows it better (if you move your head slightly down, it's easier to see):

Image

It may be realistic, but I don't remember ever seeing something like that in RL.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9417
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Sunrises (version 1.2 available)

Postby Thorsten » Fri Mar 09, 2012 7:14 am

That's Mie scattering in the lower, dense part of the atmosphere. It is actually realistic, and I've observed it a few times.

The problem is that when you look into the sun in real life, it's a blinding light intensity, so automatically your pupils close and you start closing your eyes into slits, and all sorts of funny optical effects appear (and in essence, you can't see the rest of the scene any more). If you look into the sun on a computer screen, it can never be blindingly bright (the screen simply doesn't have the power to generate that much light), so all it can do is make it white. But you're never blinded when looking into the sun in Flightgear, which is what is not realistic in the first place.

In reality, for clear skies, if you obscure the sun with your thumb, you can see the bluish 'blob' of light beneath the sun as blindingly white haze (you can't really see it without obscuring the sun, because the direct sunlight outshines everything else). I have seen it a couple of times in the last week when we had clear weather.

So the actual problem is mapping the as such correct physics output of the shader in terms of light intensity > 1 to perception. Which is tricky, because high intensity light perception is different from the 'normal' logarithmic law of light intensity perception which I have used elsewhere, and I couldn't really find any solid science on that. I have some filters for that on my 'to try' list, but it's not flagged as an urgent problem.
Thorsten
 
Posts: 11578
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.2 available)

Postby Sealbhach » Fri Mar 09, 2012 9:26 am

I think I have this working OK. Just want to check: do we need to have local weather enabled and the skydome shader enabled too?

.
Sealbhach
 
Posts: 942
Joined: Wed Jun 30, 2010 9:17 am

Re: Sunrises (version 1.2 available)

Postby Thorsten » Fri Mar 09, 2012 9:29 am

At present, Local Weather needs to be running, yes. (It doesn't have to in principle, but it supplies all control properties - altitude dependence of Rayleigh and Mie parameters, camera altitude above MSL, density and extension of the haze layer, overcast haze, light intensity at altitude...).

The skydome shader flag switches the whole scheme on and off, so if you switch skydome shader off, also the rest of the lightfield is off.
Thorsten
 
Posts: 11578
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.2 available)

Postby Thorsten » Fri Mar 09, 2012 1:28 pm

I meant the sinusoid pattern of darker/lighter blue above/around the sun. The bump gets larger when the sun gets higher, until a certain angle, when the sun "breaks out" of the bump. This picture shows it better (if you move your head slightly down, it's easier to see):


You can try if you like an exposure filter better.

* Open Shaders/skydome.frag
* find the block

Code: Select all
// reduce the whiteout near the horizon generated by the single scattering approximation

if (ct > cthorizon) color = mix(color, black ,smoothstep(0.2+cthorizon, -0.2+cthorizon, ct));
else color = mix (color, black, smoothstep(0.2+cthorizon,-0.2+cthorizon,  cthorizon));


* replace it by

Code: Select all
// a different exposure filter 
color.x = 1.0 - exp(-1.3 * color.x);
color.y = 1.0 - exp(-1.3 * color.y);
color.z = 1.0 - exp(-1.3 * color.z);


That maps the high intensity light white in a less prominent way, but it also takes some brilliance out of the sky-blue elsewhere. I'm not completely happy with either solution. There's also a variant filter commented out in the code which has a threshold behaviour (i.e. leaves the color-mapping in the low intensity region largely as it was)

Code: Select all
// an overexposure filter, the log() seems to be pretty expensive though

//  if (color.x > 0.8) color.x = 0.8 + 0.8* log(color.x/0.8);
//  if (color.y > 0.8) color.y = 0.8 + 0.8* log(color.y/0.8);
//  if (color.z > 0.8) color.z = 0.8 + 0.8* log(color.z/0.8);


you can activate it and see what that gives you.
Thorsten
 
Posts: 11578
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.2 available)

Postby curt » Fri Mar 09, 2012 4:18 pm

Hi Thorsten,

I just tried your v1.2 changes that Fred committed to git "master". Great work!

One thing I noticed with the most recent "git" version is that I lose the nice ocean sun glint reflections, sea foam, and carrier wake effects when I switch over to "advanced weather" in order to activate your effects. Just wanted to mention that in case it's something new or you hadn't noticed it yet.

What else is required to get the full effect with increased visibility, etc.?

Thanks, this really is fantastic work!

Curt.
curt
Administrator
 
Posts: 1174
Joined: Thu Jan 01, 1970 12:00 am
Location: Minneapolis, MN

Re: Sunrises (version 1.2 available)

Postby Thorsten » Fri Mar 09, 2012 4:29 pm

One thing I noticed with the most recent "git" version is that I lose the nice ocean sun glint reflections, sea foam, and carrier wake effects when I switch over to "advanced weather" in order to activate your effects. Just wanted to mention that in case it's something new or you hadn't noticed it yet.


If the default rendering scheme and advanced weather cause the water effects to disappear - that'd be a bug, this used to work two weeks ago.

If the lightfield shading makes the water effect disappear - that's normal because I have only re-written the default terrain shader and that runs as technique 7 in the commit, i.e. overrides all other special effect shaders. Emilian is (hopefully) going to take care of that by factoring out fog and light computations and use the factored version as option in all other special terrain shaders (I'm not firm enough in the technical aspects of effect file code to go for that).
Thorsten
 
Posts: 11578
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.2 available)

Postby Gijs » Fri Mar 09, 2012 6:26 pm

Replacing the code gets rid of the sinusoid. The overall sky colors looks less attractive though, like you said. Uncommenting the other code has little effect.

Thorsten wrote in Fri Mar 09, 2012 7:14 am:The problem is that when you look into the sun in real life, it's a blinding light intensity.

Right, forget about my "complaint" please. Let's turn it into a feature-request: sun glare/blinding :)
But all you did is truelly amazing. I'll spent some hours looking at the sky this weekend!
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9417
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Sunrises (version 1.2 available)

Postby Thorsten » Sat Mar 10, 2012 8:47 am

After some experiments yesterday evening: try

Code: Select all
if (color.x > 0.58) color.x = 1.0 - exp(-1.5 * color.x);
if (color.y > 0.58) color.y = 1.0 - exp(-1.5 * color.y);
if (color.z > 0.58) color.z = 1.0 - exp(-1.5 * color.z);


as an exposure filter - it combines the advantages of exponential mapping and a threshold behaviour. I think it looks quite okay.
Thorsten
 
Posts: 11578
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.2 available)

Postby Gijs » Sat Mar 10, 2012 12:46 pm

With your 1.2 release code, adding only the above mentioned code, I get this weird band at the horizon:

Image

When also adding the different exposure filter I get this:

Image

Colors are much much nicer (and better?) in the default 1.2 version.
I'll do some reallife checks, see if I can see it when looking at (near) the sun; when the weather around Amsterdam clears up 8)...
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9417
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: Sunrises (version 1.2 available)

Postby gluon » Sat Mar 10, 2012 1:30 pm

I added only the exposure filter Thorsten mentioned today to version 1.0 (for FG 2.6.0) and for me it looks more natural.
The whiteout was too extreme and I remember fiddling with the settings for mie and raleigh scattering in the past and I never was satisfied.

Also the skycolor was odd - too dark/saturated and with a reddish tint. In fact when I tried out version 1.0 of the shader my girlfriend passed by to see what I was doing and she immediately said: "The sky color looks fake". Hmm, well I suppose thats why I always turned the the shader off in the past.

Anyway, I looked into the shader file and tweaked the initial values for rK. No need to wait for the clouds to go, Gijs :)
[I know, its actually the wrong thread..]

Here are the results:
Image
The first screenshot shows a look at the zenith at noon from the ground. On the right you see the original. On the left my tweaked version.

Image
The next image shows a landscape shot. Again, right original, left tweaked. I can't help it, but somehow the clouds look better in the tweaked version.

Image
This is a composite picture with the original screenshot to the left, the tweak to the right and a photo I took at 12 o'clock. Notice how the color differs between the original settings and the real picture. The difference is much less to the tweaked version. Of course the camera doesn't reproduce the color 100% accurate. However, if I look outside the tweaked version looks, em, convincing enough.

So, please include this minor change in the next version Thorsten.
To do so, search for the line
Code: Select all
vec3 rayleighK = rK * vec3(5.602, 7.222, 19.644);

in the file skydome.vert and replace it with
Code: Select all
vec3 rayleighK = rK * vec3(4.5, 8.62, 17.3);


I hope you like this as much as I do, I haven't tested it extensively with sunrise conditions though. So give this a closer look. However, after a quick review, it looks good there, too.:)
gluon
 
Posts: 68
Joined: Tue Aug 18, 2009 7:43 am

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 0 guests