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 Ernest1984 » Sun Mar 11, 2012 11:05 am

Your WB is wrong, that's why the photo's so greenish.
EPWA-hub: ERJ-195 clsgn: ERNIE
-----------------------------------
Around The World with B1900D!
callsign: AROUNDw - currently suspended till the FG will have a proper look on different locations
User avatar
Ernest1984
 
Posts: 438
Joined: Wed Dec 01, 2010 4:47 pm
Location: Poland / Canada
Callsign: ERNIE
Version: 2.10
OS: Mac OS X 10.8.2

Re: Sunrises (version 1.2 available)

Postby Thorsten » Sun Mar 11, 2012 4:17 pm

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.


You have to be careful with comparisons with pictures from the ground. The skydome scattering alone isn't supposed to give the right appearance, skydome plus haze layer is. So the skydome itself should actually compare with pictures taken above the haze layer, i.e. mountaintops or so. At present we have a very clear day in Finland, and I'm looking at a sky which is a bit deeper blue than your tweaked version.

Obviously the parameters need to be tuned, but it's really a combination of haze, overcast haze, Mie, Rayleigh and exposure filter which needs to be adjusted to fit many different conditions and altitudes.

Thus, I will take your different Rayleigh vector as a suggestion, but not implement it asap.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby Thorsten » Sun Mar 11, 2012 4:20 pm

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


Yes, you have the smoothstep-based filter still in - switch that off and use only the exposure filter, don't add it to the existing process.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby Thorsten » Mon Mar 12, 2012 8:57 am

@ gluon: After comparing with my series of sky images to get cloud textures, I think you have a very valid point. I'll give your color-scheme a thorough test.

Currently my fitting procedure is:

* ground haze layer off, overcast haze off
* select a given exposure filtering strategy

* noon on the ground - is this a plausible sky for a very clear day?
* morning on the ground, looking towards the sun - is the amount of Mie light scattering plausible?
* pre-dawn on the ground - does this look like plausible light?
(if one of the steps is a 'no', change Mie, Rayleigh and density parameters)

* noon at 36.000 ft - is this a credible view from cruise altitude?
* pre-dawn at 36.000 ft - is this plausible?
(if one of the steps is a 'no', change Mie, Rayleigh and density parameters - no need to go back as we can implement altitude dependences)

* noon at 85.000 ft - do we reach the 'out of atmosphere' impression? Is the sky really black?
* dawn at 250.000 ft - does this look like a plausible view from low orbit?
(if one of the steps is a 'no', change Mie, Rayleigh and density parameters - no need to go back as we can implement altitude dependences)

I've been working on this a bit more yesterday and also linked lower-altitude Mie scattering to the actual visibility, something I planned to do a while ago). But as you can imagine, it's a lengthy process to get all things right, and I ended up discarding some very charming noon skies because the pre-dawn light was just all wrong...
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby Thorsten » Tue Mar 13, 2012 2:23 pm

It occurred to me that making the skydome shader parameters environment-dependent is also a nice way to get air pollution simulated by increasing the rayleigh factor in the ground haze region. I've made the amount of air pollution user-selectable in the menu. This is the outcome:

Clear day in San Francisco:

Image

And now we have a lot of smog in the air (note the yellowish horizon coloring which I've only ever seen for rather polluted air.

Image

The differences are much more spectacular at sunrise: A clean atmosphere doesn't scatter too much light...

Image

... but a lot of pollution gives quite spectacular sunrises (note the almost greenish hue of the higher sky - the only times I've seen this was in Shanghai and Mumbai, and wow - that was dirty air...)

Image

Morning fog also gives more spectacular sunrises, but that never acquires the greenish-yellow tone characteristic for polluted air.

All air pollution is simulated as a function of altitude and is gone when the ground haze layer is cleared.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby jakes1487 » Wed Mar 14, 2012 3:08 am

:shock: (the whole project, not just the last post!)

These are the most impressive virtual skies I've ever seen. I could not tell the top halves of those last four pictures from reality. I wish every video game looked this good.

I wonder if the Crystalspace people would like it? I worked on a project before in that engine so maybe I'll ask them once this is finished. It might be hard to copy-and-paste in, but at least it might be possible to write a duplicate version in their engine.
jakes1487
 
Posts: 3
Joined: Tue Mar 13, 2012 3:38 am
Version: 2.6
OS: Ubuntu, XP

Re: Sunrises (version 1.2 available)

Postby Hooray » Wed Mar 14, 2012 5:11 pm

jakes1487 wrote in Wed Mar 14, 2012 3:08 am:I wonder if the Crystalspace people would like it? I worked on a project before in that engine so maybe I'll ask them once this is finished. It might be hard to copy-and-paste in, but at least it might be possible to write a duplicate version in their engine.


FWIW, directly including Thorsten's shader work in Crystalspace won't be possible currently due to licensing reasons, i.e. Crystalspace is LGPL while FlightGear is GPL. You would need to ask Thorsten to dual license his shaders or grant an exception specific to the Crystalspace project.

The GPL's viral nature means that projects linking in GPL code must comply with the legal requirements, that would affect, and in fact revoke, the LGPL exceptions regarding proprietary linking. Note that shaders do in fact get compiled and linked (also in the sense of the GPL) by your GPU driver and that this can be considered a form of tight coupling which is no longer "at arm's length".
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: Sunrises (version 1.2 available)

Postby jakes1487 » Wed Mar 14, 2012 11:10 pm

Hooray wrote in Wed Mar 14, 2012 5:11 pm:Crystalspace is LGPL while FlightGear is GPL


Sorry, I should have picked that up. I entirely agree FlightGear should be GPL not LGPL--but that's for another thread. In any case, wouldn't Thorsten just have to license the shaders under the LGPL and then both projects could use them? If you're reading this, Thorsten, don't worry about it for now, I don't mean to take your attention away from your great project; and I think you can always "downgrade" GPL software to LGPL later.

By the way, this probably wouldn't be helpful, but I have a set of about 100 high-resolution photos of a sunrise over an ocean I took one morning last spring from about a half hour before sunrise to a half hour afterwards, if you'd like them to compare your shader output to (CC licensed :wink: ). I can provide the location (coordinates) as well if you need to know the latitude, proximity to cities, etc.
jakes1487
 
Posts: 3
Joined: Tue Mar 13, 2012 3:38 am
Version: 2.6
OS: Ubuntu, XP

Re: Sunrises (version 1.2 available)

Postby Thorsten » Thu Mar 15, 2012 8:28 am

In any case, wouldn't Thorsten just have to license the shaders under the LGPL and then both projects could use them?


I have no idea of the legalities involved here.

First, the light scattering code underlying the shader was written by Lauri (Zan) - I added haze, light attenuation and the altitude profiles of the relevant parameters. Lauri's code in turn is based on a algorithm by some O'Neill fellow, which is in turn based on some older work. So given that I started with some code which was GPL in the first place, I don't think I could make the decision alone to change license even if I wanted to.

Second, by having my share of the work included in GIT, did I not implicitly commit to a GPL license?

Personally I have no problem if my work is included in some other project (it will be a hard enough task anyway...), but I'm not really sure I am able to decide anything about it at this point.

By the way, this probably wouldn't be helpful, but I have a set of about 100 high-resolution photos of a sunrise over an ocean I took one morning last spring from about a half hour before sunrise to a half hour afterwards


Aerial or ground-based? I have plenty of ground-based sunrises, but aerial shots are pretty hard to find.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby jakes1487 » Thu Mar 15, 2012 5:30 pm

Thorsten wrote in Thu Mar 15, 2012 8:28 am:I don't think I could make the decision alone to change license even if I wanted to.

Yeah, I don't think you can if it's based on other GPL work. I guess I thought you just sat down and came up with the whole thing yourself!

Aerial or ground-based?

They're ground-based. Sorry. I wish they were aerial. :)
jakes1487
 
Posts: 3
Joined: Tue Mar 13, 2012 3:38 am
Version: 2.6
OS: Ubuntu, XP

Re: Sunrises (version 1.2 available)

Postby gluon » Sun Mar 18, 2012 9:46 am

Finally came around to revisiting this thread.

Thank you for considering the tweak as a starting point. That was exactly my intention. I've tested it a bit since last week and found it to be quite ok in all situations, though i haven't gone above 30000ft. It took me quite some time to get those parameters, so they should be pretty close.

Of course I am aware that using photos is inaccurate, also because of white balance, aperture and exposure time all contributing to the image. That's why I set my starting point to the nearest airport, kicked in METAR and looked out of the window and compared the results to "the real thing" while modifying the parameters.

This brings me to another point - here in southern Germany the sky is hardly ever as deep blue as in Flightgear (for example in the cold sector scenario in local weather). Its always a very light /pale blue. Of course we have more air pollution here adding to scattering. Much different to beautiful Finland. So I'm glad to see you've added a pollution model :)
Also from my observations, the pollution here gives the "white-band" on the horizon a slight grey-isch tint. Just a bit.
I will have to look for some pictures from a mountain top or one of the balloon rides I took in winter yet for comparison.

I don't know if its possible to interface the shaders with Nasal, but eventually it would make sense to probe the land-classes in the surroundings for cities and include this model in the calculation. Which is what you've probably had in mind anyway.

I remember, back when I was hacking the sun code, I was playing with the idea of using some pollution data for areas of the earth for adapting the scattering properties of the sun appearance. There were some scientific data-sets around for this and even the formulas for calculating the scattering for the different aerosols were easily accessible. OK, but this is a little OT now, I guess. If there's some interest in this I could provide some more info (I probably still have the stuff on my disk).

So this again is a great development by Thorsten, many thanks!
gluon
 
Posts: 68
Joined: Tue Aug 18, 2009 8:43 am

Re: Sunrises (version 1.2 available)

Postby Thorsten » Sun Mar 18, 2012 1:17 pm

This brings me to another point - here in southern Germany the sky is hardly ever as deep blue as in Flightgear (for example in the cold sector scenario in local weather). Its always a very light /pale blue.


No, it isn't - when you climb Zugspitze, you'll see the deep blue more often :-)

We have all the necessary ingredients - ground haze, overcast haze, Rayleigh and Mie scattering parameters - the problem for the weather system is how to mix them properly. I've concluded that you simply can't know the amount of pollution properly by any automatic procedure which isn't ridiculously complex. Finland may have very polluted air when there's forest fires in Russia. The air above Los Angeles can be very clear in the right winds. And so on.

Which is why you get sliders to control ground haze and pollution and max. visibility to tell the weather system what you want.

I don't know if its possible to interface the shaders with Nasal, but eventually it would make sense to probe the land-classes in the surroundings for cities and include this model in the calculation. Which is what you've probably had in mind anyway.


The shaders are interfaced via properties.

/environment/ground-visibility-m and /environment/ground-haze-thickness are ground fogging,
/rendering/scene/overcast is overcast haze and so on. So technically it's easy enough to tell the shaders once you have a model what all the parameters should be, but I think coming up with a model is the problem.

Then there are other issues - you correctly remark that in Germany the horizon tends to be greyish - yet in Mumbai it was distinctly yellowish. So just how on earth are we supposed to get this correct? I think if you turn all the knobs of the system, you can reproduce most sunset pictures, but to write a system which knows so much about the planet that it does so automatically is quite a different beast. At some point we have to be content with having more variation than previously, rather than aiming to get it 'right' :-)

If you want to play with it a bit more, I can tell you where in the weather tiles these things are set.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.2 available)

Postby planetacancun » Sun Mar 18, 2012 4:14 pm

At some point we have to be content with having more variation than previously, rather than aiming to get it 'right'


Amen.
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 » Sat Mar 24, 2012 10:21 am

Hi,

I've looked at some photos of a balloon ride i took a few years back in January in a cold sector and i conclude your right above the haze layer.
When I look at the sky from below, like from an airport, i have to set the haze thickness to maximum and visibility to minimum in advanced weather to achieve the sky coloring i perceive when i look out of the window though. But i hope this will be adjustable through the new pollution feature you've added. Good.

I agree adding a pollution model would probably not worth the effort an i assume there are more interesting topics you would like to pursue.

I've got one question though that you might be able to answer because your very familiar with the scattering formulas:
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. The effect is clearly visible in photos. But then i remember my dad uses a UV-Filter when making pictures in the mountains because else the photos had a blue tint. And there's the issue of white balance. What's your take on this?

You might find the thesis here: http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/2554/pdf/imm2554.pdf
gluon
 
Posts: 68
Joined: Tue Aug 18, 2009 8:43 am

Re: Sunrises (version 1.2 available)

Postby Thorsten » Sat Mar 24, 2012 11:25 am

When I look at the sky from below, like from an airport, i have to set the haze thickness to maximum and visibility to minimum in advanced weather to achieve the sky coloring i perceive when i look out of the window though. But i hope this will be adjustable through the new pollution feature you've added. Good.


I guess the best way to address this is to mix a bit more overcast haze effect in... Pollution also helps a bit, but I agree that the zenith tends to come out too blue for most occasions.

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.


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 inbetween, 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.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 0 guests