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 » Sun Mar 25, 2012 9:40 pm

I've had a thoroughly humiliating experience today - spend 2 hours flight just watching the horizon and trying to figure out what makes it the way it is.

In his thesis "Real Time Rendering of Atmospheric Scattering Effects for Flight Simulators" Ralf Stokholm Nielsen states that the color of haze/distant objects gets darker and more blue the further they are away from the viewer (page 33, areal perspective. I was wondering if this can be deduced from the scattering formulas and is correct or if the author is mistaken.


So here we have the first counterexample - the sky was rather clear, but with a haze layer quite high up with lots of Rayleigh scattering - as a result, objects at the horizon were fading to orange-red rather than blue despite of the high sun angle.

Why? Sun illuminates white object pretty directly, object is effectively emitting white light - but on the way up to my view position again the white light crosses a lot of Rayleigh-scattering medium and hence objects appear red since the blue light is scattered out.

At one point, I saw three distinct horizon line phenomena - against the sun, there was a very high line sharp below which everything was radiant milky-white. At about 50 degrees with the sun, this changed to the true horizon line becoming visible as a dark line in front of a bright sky. At about 110 degrees, this changed to a higher haze-top line as my shader generates it. I couldn't see the other side unfortunately.

There were directly lit faint clouds appearing really dark (almost black) - almost pure Mie scattering in action. There was a haze layer showing blue top, fading to green and then to orange-brown below - wavelength dependent light diffusion in a primarily Rayleigh scattering medium. It was like nature's demonstration of all phenomena you can do with light scattering at the same time.

This whole stuff is so fascinating that I would like to spend half a year to just code something that solves the general scattering problem for any distribution of Rayleigh, Mie and diffuse scatterer density. Unfortunately it's never going to run in real time on the present or next generation of GPUs...
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby planetacancun » Mon Mar 26, 2012 7:56 am

If you guys make a screenshot contest Thorsten wins xD I mean wow! Look at those screenies!
Callsign:Fallen-
Videos: http://youtube.com/planetacancun2
planetacancun
 
Posts: 322
Joined: Thu Jul 30, 2009 5:52 pm
Callsign: Fallen-
IRC name: Fallen-
Version: GIT
OS: Ubuntu

Re: Sunrises (version 1.2 available)

Postby gluon » Mon Mar 26, 2012 9:41 am

Thorsten wrote in Sat Mar 24, 2012 11:25 am:Assuming the air is very clear otherwise, I think he is correct. Think of the sky-blue as a glowing dark blue filter placed across the dark of space (it's 'glowing' because you see diffuse sunlight scattering). Now place a stronger version of that filter over a white mountain peak in the distance - it gets darker and bluish. It's the effect of pure Rayleigh scattering when looking down (I believe Lauri had a picture of that really overdone in his early terrain shader experiments).

It's no longer true though if there is some haze layer in between, which might show a more white reflection, so then the horizon just whitens out. If there are high clouds on the horizon, then the terrain beneath at the horizon greys out. In my experience, in general all sorts of interesting things may happen.

Interesting, so you say Lauri has implemented this? I took a look at some distant mountain tops above LOWI and they appeared to be a bit bluish indeed. Couldn't notice the effect with the haze though. But those are such minute details. I still think much of the blueness in photos is from UV-light.

Thorsten wrote in Sun Mar 25, 2012 9:40 pm:This whole stuff is so fascinating that I would like to spend half a year to just code something that solves the general scattering problem for any distribution of Rayleigh, Mie and diffuse scatterer density. Unfortunately it's never going to run in real time on the present or next generation of GPUs...

Hehe, yes nature is fascinating. Which i suppose is one of the reasons you chose your profession.
Simulating all the above effects could be possible with raytracing, but that'll take a while until its available in realtime for desktops. Meanwhile your and Lauris shaders are doing a great job.
gluon
 
Posts: 68
Joined: Tue Aug 18, 2009 8:43 am

Re: Sunrises (version 1.2 available)

Postby Thorsten » Mon Mar 26, 2012 10:08 pm

Interesting, so you say Lauri has implemented this?


Yes and no - he wrote a terrain shader containing the physics of the skydome shader. This had the blue Rayleigh component

Image

but had black fog

Image

which is the result of applying a single-scatterign approximation in a regime where multiple scattering is relevant. Which is why I started working on the optically thick terrain haze layer to add that part of physics to the problem. Read it all here.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby ameya123 » Wed Mar 28, 2012 6:57 am

Hi Thorsten

I tried downloading your v 1.2 but i am still facing the same problem like the one in this post http://flightgear.org/forums/viewtopic. ... 06#p154206

Is there any specific setting for the scattering?

Thanks

ameya
ameya123
 
Posts: 43
Joined: Wed Sep 14, 2011 1:45 pm

Re: Sunrises (version 1.2 available)

Postby Thorsten » Wed Mar 28, 2012 6:53 pm

Version 1.2 was for GIT, but if you have a recent GIT you should have it automatically and don't need to download it. If you run FGFS 2.6, then should *not* install 1.2, it doesn't shade clouds properly, you might install 1.0 instead.

In the linked thread, evidently other terrain shaders are on (I can see for instance the water shader pattern) whereas they need to be off - it is likely that this causes the problems.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby ameya123 » Thu Mar 29, 2012 7:02 am

Okay. I will try that and let you know.

Thanks

Ameya
ameya123
 
Posts: 43
Joined: Wed Sep 14, 2011 1:45 pm

Re: Sunrises (version 1.2 available)

Postby ameya123 » Fri Mar 30, 2012 10:38 am

Do i have to also add the line /sim/rendering/scattering-shader=true in the command line
ameya123
 
Posts: 43
Joined: Wed Sep 14, 2011 1:45 pm

Re: Sunrises (version 1.2 available)

Postby Thorsten » Fri Mar 30, 2012 12:09 pm

Yes, this is only fixed in later versions.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby ameya123 » Sat Mar 31, 2012 5:19 am

Hi Thorsten

I tried 1.0, added the prop: turned off all the shaders. turned on advanced weather, turned on skydome. and when i start fg at gatwick the sky appears brown without any clouds.

still the white thing remains. is it because of AMD or what?
ameya123
 
Posts: 43
Joined: Wed Sep 14, 2011 1:45 pm

Re: Sunrises (version 1.2 available)

Postby Thorsten » Sat Mar 31, 2012 1:36 pm

I tried 1.0, added the prop: turned off all the shaders. turned on advanced weather, turned on skydome. and when i start fg at gatwick the sky appears brown without any clouds.

still the white thing remains. is it because of AMD or what?


I'm not a clairvoyant... What is the terrain type that is white? Do other terrain types shade normally? Is there any fog visible at all? What does the skydome in the terrain region do? Does the time of day change the appearance of things in any way? Is there any error in the console indicating shaders which do not compile properly?

If I am to even make a guess at what is going on, I need a lot more information. It's close to impossible to trace a bug that doesn't occur on my system.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby Thorsten » Wed Apr 11, 2012 7:04 pm

Who wants to make a guess what I spend the last two hours doing?

Image

Image

Image

Image

(Yes, that's the water shader merged with haze layer and lightfield shading. Right now this is a 500+ line mess in need of some cleaning, although it works (slow...) - but since this is a heavily modified copy of the shader, I might as well drastically simplify the environment interface and streamline the computations. I don't know if Emilian and Vivian still have plans to separate out and generalize light and fog functions or plan to wait for Rembrandt to be ready, but my first experiments with Rembrandt convinced me that this has a lot of potential, but isn't there yet, so I see some motivation to continue on non-Rembrandt development...).
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby curt » Wed Apr 11, 2012 8:11 pm

Looks great!
curt
Administrator
 
Posts: 1168
Joined: Thu Jan 01, 1970 1:00 am
Location: Minneapolis, MN

Re: Sunrises (version 1.2 available)

Postby Thorsten » Sun Apr 15, 2012 11:22 am

And some nice progress - we're approaching a release 1.3 soon :-)

Here's a subtle one - compare the lightness of the mountain texture above and below the cloud layer - clouds now shade the terrain on average and this is computed based on vertex position (previously the light attenuation was dependent on aircraft position), so the view of dark terrain looking through gaps in the cloud layer is now correct.

Image

Water color when the water shader is used is now location and weather dependent. The base color is interpolated from a table of values in a Nasal script, the shader adds environmental effects on top of that - currently we just have the greying of the sea in bad weather, but I think one can do a little more.

Here's TNCM in nice weather with turquoise sea:

Image

Same scene in really bad weather - terrain is much darker and sea greys out:

Image

The area around Nice with deep blue sea (I'm not too happy with the actual color, so take it as a proof of concept...)

Image

Far from any interpolation points, the script falls back to default values which give a slightly greenish sea:

Image

What I still want to do before a release is to add an optional snow effect to the terrain shader, and on the way implement also a 'dry terrain' scenario where everything gets a bit dust-covered.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby Gijs » Sun Apr 15, 2012 1:23 pm

Woohoo, subtle but very obious! Thanks for your continous developments!
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9549
Joined: Tue Jul 03, 2007 3:55 pm
Location: Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 4 guests