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.3 available)

Postby Zan » Fri Jul 13, 2012 7:16 pm

Hi Thorsten, amazing work you have done!

I've been away from developing for a while; I don't currently have internet connection on my home PC... But I skimmed through your code. I see the shaders have advanced quite a lot and become complicated, so I was thinking that I will read through them and see if there would be possibility for optimizations.

One thing I'm thinking is precomputing some (almost) static calculations to texture and juts fetch the values in shader. That texture could be updated in FG core every minute or so if necessary, for slow changes, but it could improve shader speed and fps a lot.

Keep up the great work, I can't wait to see these in my FG too!

Zan

Edit: I see you figured out the noise texture. But maybe to help others: It's a 3D texture, size maybe 256x256x256 or something. Iirc it's grayscale and generated with some perlin noise. It usually is used in repeat mode so you can just give it a 3D coordinate, say a texel's world space position, and get a nice "random" grayscale image. A normal float randomval = texture3D(noiseTexture, position.xyz).r; should be enough.
Zan
 
Posts: 121
Joined: Tue Oct 20, 2009 10:28 am

Re: Sunrises (version 1.3 available)

Postby Thorsten » Tue Jul 31, 2012 10:01 am

Victory! Another shader successfully beaten into submission.

Image

(In this case, the idea of just including a different fog function would have failed miserably - I ran out of varying slots and had to rearrange things both in the atmospheric computation side and on the relief shader side to make it run).
Thorsten
 
Posts: 11087
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.3 available)

Postby Thorsten » Mon Oct 29, 2012 8:29 am

I've spent a weekend dealing with two issues which have been bugging me for a while.

This is how Cu clouds currently appear at sunset - they're quite bright orange and the way shading works is that this becomes a dark orange away from the sun.

Image

Looking at plenty of examples, that shading is actually incorrect - shaded parts of clouds in low sunlight get bluish-violet, rather than dark orange. The cloud self-shading by simply reducing the intensity of the color works fine at daylight, because that transforms white into grey as it should, but it fails at sunset, we need a color rotation as well for the shaded parts.

Furthermore, clouds are hardly ever this bright over the darkening terrain because the inter-cloud shading means they're not all in sunlight. We can't actually render that, but we can tone down the color values a bit to effectively mock up the effect.

Still not perfect (unfortunately it needs to run in real time...) but this is how it looks after parameter tweaking and the additional color rotation - shaded parts now go to blue-violet...

Image

... and the intensity of clouds looking towards the approaching night is much reduced and makes the scene more plausible.

Image
Thorsten
 
Posts: 11087
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.3 available)

Postby Johan G » Wed Oct 31, 2012 6:21 am

Great work and stunning screen shots (as usual). :D

The colour might explain a pinkish livery I've seen on images on some Blackburn Buccaneers, though they might have had a dessert connection. I remember that SAS land rovers was called Pink Panthers for that reason as well. :wink:
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)
Johan G
Moderator
 
Posts: 5528
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: Sunrises (version 1.3 available)

Postby Thorsten » Wed Oct 31, 2012 8:59 am

The colour might explain a pinkish livery I've seen on images on some Blackburn Buccaneers, though they might have had a dessert connection.


I'm still not completely happy with the colors. It's so difficult to get decent aerial pictures of sunrises and sunsets, and I've witnessed only three good ones myself. I have now a time series of sunset colors on my digicam with a picture taken every 5 minutes - I have some plans to extract (rgb) curves of the sunlight change from that and compare with what is currently used.
Thorsten
 
Posts: 11087
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.3 available)

Postby ajm » Sat Nov 03, 2012 10:42 pm

Johan G wrote in Wed Oct 31, 2012 6:21 am:The colour might explain a pinkish livery I've seen on images on some Blackburn Buccaneers


Those Buccaneers really were pink - as you guessed, it was a desert camouflage scheme hastily applied when they were deployed during the first Gulf war. I remember not being terribly impressed with the new colour scheme while watching them training in the days before they flew out!
ajm
 
Posts: 259
Joined: Wed Dec 20, 2006 5:05 pm

Re: Sunrises (version 1.3 available)

Postby Thorsten » Fri Nov 09, 2012 10:44 am

I'm still tackling cloud illumination in low sun. The basic failure of my current scheme is that cloud layers do not self-shade - every cloudlet is illuminated as if the others would not be there. The reason is of course that we can't do ray intersection tests between thousands of cloudlets in real time, so in rendering one cloudlet, we really don't know what the others do. Only the weather system knows where clouds are in relation to each other.

If the sun is high, that's not so problematic, as the weather system has the layer ordering available, and since the light comes from above, there's a good approximation scheme to get this right, so we can shade low cloud layers if there are closed layers above.

However, if the sun is low, the shading depends not only on the visible layers, but in addition also on assumptions about how layers which we haven't actually drawn yet would obscure the sunlight at the horizon. I've tried to capture this on average with a new parameter.

This is a broken cover in full glory illumination. - higher clouds still in light light up very brightly, the lower ones are already getting dark. I think under some conditions it can be seen like this...

Image

...but normally the outcome would rather be like this if the layer would be continued to the horizon (as the weather system is likely to do if you go there):

Image

(note also that the fog underneath the clouds has to be shaded as well).

The difference is in particular apparent when you look away from the sun: Full glory illumination for every cloudlet gives very bright contrast with the dark terrain...

Image

...whereas this looks much more plausible if we apply the cloud self-shading correction:

Image

Right now this is property controlled and the property is selected by hand - now that I know that it generates about the right appearance, it's down to finding a good function to set it from the weather system based on sun position and current weather conditions.

Since I was already tinkering with light all over the place, I finally got around to adding some moonlight correction as well:

Image
Image

This isn't *real* directional illumination (that'd be fairly expensive to do) but just an ambient light and fog color effect - but I think it does the job. Now someone needs to expose the moon phase somewhere, and we can have this automatically :-)
Thorsten
 
Posts: 11087
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.3 available)

Postby Thorsten » Fri Nov 30, 2012 12:28 pm

I think with the last ambient light correction, I finally managed to get it really right. I've done a few test flights with 6/8 cover yesterday in the French Alps, and the play of light on the clouds for the first time was just right throughout 25 minutes from predawn on. Also the contrast of violet-rosy clouds and the first daylight on the high peaks sticking above the clouds was just incredible. I got ~70 km visibility above the clouds, clouds drawn out equally far - all the high mountain ranges were just sticking out of the sea of clouds, then going back into shaded fog in the valleys. And the framerate never dropped below 20 fps even with all the graphical goodies on and even using the F-14b.

I wish I could post some screenshots, but my current improvised Windows setup doesn't seem to come with a screen capture utility :-( Anyway - it was the first time that the play of light and shadow looked actually real to me and I didn't flag any issues.

(find merge request on GIT in case you'd like to try)
Thorsten
 
Posts: 11087
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.3 available)

Postby fredb » Fri Nov 30, 2012 6:58 pm

Thorsten wrote in Fri Nov 30, 2012 12:28 pm:... my current improvised Windows setup doesn't seem to come with a screen capture utility :-(


Alt-PrntScreen puts a screenshot of the active window in the clipboard
Prntscreen puts the whole desktop in the clipboard

Paste in Gimp or in Paint.
User avatar
fredb
 
Posts: 756
Joined: Fri Dec 01, 2006 10:41 am
Location: Paris, France

Re: Sunrises (version 1.3 available)

Postby Thorsten » Sat Dec 01, 2012 9:15 am

Thanks Fread - figured it out yesterday - the problem was some directory permission (the error message was 'No plugin available to write screenshot to...' which doesn't exactly point to the problem - that's why I really like Windows...)

Some contrast of hires runway and grass effects... (Side note - doing the runway normal map 'properly' is pretty expensive - it requires 3 varying vec3 to be interpolated to get the local coordinate system of normal, tangent and binormal in view space, then to compute the local geometry based on the distortion of the normal in eye space. Doing instead an illusion (as done here) is a one-liner - the bumps done that way do not behave correctly as you watch the light change during the day, but assuming we don't really need every bump on the runway to stay where it is as we spend a day looking at the runway but are happy just to see that there are bumps during the minutes we actually spend on the runway, the job can be done at a fraction of the rendering cost).

Image

So, here it comes - a study in morning light (this wasn't quite as impressive as the last flight, but similar):

On the runway in Grenoble Isere airport - note the hires procedural snow drifts on the runway and the fact that there is now much more predawn light than in previous versions of the framework - I think this illumination is more realistic.

Image

... and through a 6/8 layer, onwards into the Alps:

Image

First sunlight...

Image

...note the subtle play of light and shadow on clouds and mountain tops as they are illuminated - I think the balance of light is finally almost perfect - this is how the scene ought to be illuminated to be real.

Image

It gets gloomy again as I descend below the cloud layer and fly over Grenoble (note the absence of direct light hitting the mountains below the cloud layer)

Image

Play of light and shadow on the clouds turning westward across some foothills.

Image

Southern France covered in thin procedural snow cover:

Image

A patch of morning fog over Lyon...

Image

... and a foggy approach to Clermont-Ferrand

Image

Who needs FSX? (Bring a really good GPU though...)
Thorsten
 
Posts: 11087
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.3 available)

Postby Johan G » Sat Dec 01, 2012 12:53 pm

:shock: Beautiful, Thorsten, beautiful. :D
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)
Johan G
Moderator
 
Posts: 5528
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: Sunrises (version 1.3 available)

Postby penta » Sat Dec 01, 2012 1:26 pm

Thorsten wrote in Sat Dec 01, 2012 9:15 am:Image

This is awesome! bravo Thorsten!
penta
 
Posts: 238
Joined: Mon Dec 29, 2008 11:05 am
Location: Parma-Italy
Version: Git
OS: Ubuntu Linux

Re: Sunrises (version 1.3 available)

Postby Ernest1984 » Sat Dec 01, 2012 4:33 pm

How much RAM? :P
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 3:47 pm
Location: Poland / Canada
Callsign: ERNIE
Version: 2.10
OS: Mac OS X 10.8.2

Re: Sunrises (version 1.3 available)

Postby Thorsten » Sat Dec 01, 2012 6:05 pm

The laptop has 3 GB directly in the video card and 7 GB normal RAM. I think the 70 km visibility hits 8 GB memory usage or so - I estimate half of that is trees... I didn't run into swap though - with 120 km visibility in custom scenery I do.
Thorsten
 
Posts: 11087
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (version 1.3 available)

Postby Thorsten » Sat Dec 01, 2012 6:25 pm

And a bit more weather variation:

Thinner cloud cover gives more light, so there's a trend towards more red - and the Mie scattering becomes very pronounced. From Clermont-Ferrand to Toulouse:

Image
Image

And some carrier ops (I really missed the F-14 a lot on my old computer, but it becomes unflyable below 20 fps) - from Nimitz to Vinson and back - 23 kt wind and some gusts to make things more interesting:

(Did I mention that I love flying between cloud layers? It's something I always wanted to do in a flightsim)

Image

Approaching Vinson - I actually clicked the recovery course option in the AI menu - but Vinson didn't follow... I wonder to what carrier this applies if there are serval loaded - so I had to do a crosswind landing (look at the waves to see how the wind goes...)

Image

And back at Nimitz...

Image

I'd be prepared to claim that some of these skies could really pass for real - the revised shade function finally does the trick nicely under these conditions. 8)
Thorsten
 
Posts: 11087
Joined: Mon Nov 02, 2009 8:33 am

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 1 guest