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

Postby planetacancun » Sun Jan 22, 2012 10:48 pm

Man I'm going to buy me a set of DVD's just because you guys rock <3
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.0 available)

Postby Thorsten » Mon Jan 23, 2012 4:51 pm

Actually, GIT newer than the release branch has changes in the cloud shader code - I've provided a patch for the shader as on today's FGData, see first post.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.0 available)

Postby statto » Mon Jan 23, 2012 7:17 pm

Not sure these will be of any help, but I have two early-morning in-flight pictures I took from this August:
Image
Image
Custom Scenery available from http://www.stattosoftware.com/flightgear
statto
 
Posts: 2106
Joined: Fri Jan 25, 2008 10:57 pm

Re: Sunrises (version 1.0 available)

Postby penta » Mon Jan 23, 2012 8:45 pm

Hi Thorsten, I've tested your patch and I had to say that flying from night to day gives a really suggestive view. Thank you very much for your work!
Here is an image:
Image

I've noticed some problems when I enable some shaders but I don't think they have to do with your implementation as I get something similar with the git version. I hope at least you can give me some advice on what the problem could be: maybe the graphics card (NVIDIA GT440)
Here is the same image with crop shader enabled:
Image

Something similar to the above example happens when I enable model or water effects.
penta
 
Posts: 238
Joined: Mon Dec 29, 2008 12:05 pm
Location: Parma-Italy
Version: Git
OS: Ubuntu Linux

Re: Sunrises (version 1.0 available)

Postby Gijs » Mon Jan 23, 2012 9:05 pm

Inspired by Statto I can share two pics that I took en route from Amsterdam to Tokyo. Date was 2010-07-20/21, so the Northpole was under constant daylight.

The first one was taken above Finland, you can count the thousand lakes, at 23:20 (Dutch time, so that must've been 00:20 local time?), looking north. The lower one was taken one hour later, 00:23 Dutch time.

Anyone up for the challenge to take these shots in FG? /me should spend the time on studying ;)

Image

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

Re: Sunrises (version 1.0 available)

Postby Thorsten » Mon Jan 23, 2012 9:55 pm

I've noticed some problems when I enable some shaders but I don't think they have to do with your implementation as I get something similar with the git version.


There's nothing wrong with your setup, it just doesn't work with other shaders at the moment. The other shaders still use gl_LightSource[0] to compute lighting and fogging, and the result is inconsistent with the lightfield (in your example, default FG likes white light at this altitude, so this is what you get, even if the ground would be much darker.

Apparently we can arrange things such that fogging and light will be computed independently of other shader operations and simply be referenced, so that's going to come eventually.

@Gijs: Doesn't look that complicated, dark terrain and glowing horizon band is something I've seen quite often being generated. The lakes would need an adaption of the water shader for the lightfield to come out properly though.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.0 available)

Postby Thorsten » Thu Feb 02, 2012 10:44 am

I wish I could make it run faster. I spent two hours yesterday to tweak everything I could - make use of the asymptotic behaviour of the light curves, streamline all the fogging into a single exponential call by making use of the factorization property of exponentials, not doing the numerical sky sampling in the scattering shader below the horizon, took everything closer than 50 m out of the fog computation...

In my benchmark, this improved framerates for a 110 km visibility panorama from 36.000 ft with the ufo from 39 to 43 fps - terriffic... It doesn't sound too bad, except when you go to hires mountain scenery, and then even 35 km visibility range runs with barely above 20 fps. The skydome doesn't really seem to be an issue to begin with - even drastic changes hardly affect the end result, the terrain is just so much more important.

I have the impression the vertex count is just the killer here - I can't imagine what else. It doesn't matter if I do wireframe (Hooray suggested this) or not by the way. The problem really seems to be that lots of invisible scenery still gets the full treatment. So I am hoping for Fred's Project Rembrandt to give us the chance to not render in detail invisible surfaces. If anyone else can figure out a way to make it faster - please let me know. I'm not distributing the latest changes, because the 10% gain are really not that big an impact.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.0 available)

Postby Hooray » Thu Feb 02, 2012 11:11 am

Another guess: Does resizing the window (i.e. reducing the resolution) have any noticeable effect?
What about the OSG on screen statistics, do they show any obvious bottleneck?

Assuming it's really the high vertex count, then, no-scenery areas should have much better frame rates, right?

EDIT: You could rebuild SG+FG with CXXFLAGS set to "-pg", that would add profiling code to FlightGear, which would in turn create a run time profile of all functions that get called. Obviously, you would need to keep this running for a while, because otherwise the initialization code would just show up (maybe, keep it running for 10-30 minutes).

If you'd like to give this a try, I can walk you through the steps, which shouldn't be too tedious, as I am familiar with your build setup.

Basically, all that is needed is rebuilding SG+FG with CXXFLAGS=-pg
FlightGear will then automatically create a run time profile that can be processed with gprof, which shows where most of the time is spent while running your code. OTOH, this will obviously not profile any OpenGL/GLSL code - there are separate tools available for that, but I am not really familiar profiling GL/GLSL code unfortunately.
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.0 available)

Postby Thorsten » Thu Feb 02, 2012 11:24 am

OTOH, this will obviously not profile any OpenGL/GLSL code - there are separate tools available for that, but I am not really familiar profiling GL/GLSL code unfortunately.


This is only GLSL code, nothing else. :D
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Sunrises (version 1.0 available)

Postby Hooray » Thu Feb 02, 2012 11:58 am

Yes, YOUR code - but doesn't it rely on C++ code passing certain parameters in the form of uniforms and such?

I mean, if it's "just" your code that you want to profile, then there's at least no need to rebuild any binaries, right?
GLSL profiling should be supported by many driver implementations, AFAIK.

But probably you are right, Fred will know best where to look for bottlenecks and how things can be improved, because he's currently working on this.

This discussion contains some pointers to software tools.
There's another tool that used to be commercial and is now made available for free here: http://www.gremedy.com/download.php

There's also the NVIDIA Performance Software Development Kit ("NVPerfSDK ") which is generally recommended for debugging, profiling and optimizing shaders:

http://www.gpgpu.org/forums/viewtopic.php?t=3840#15132
you might also want to check out the NVPerfSDK. The instrumented driver comes with a run-time GL checker that tells you what's wrong. Effectively, this is the same functionality as wrapping each and every GL call in a glGetErrors(), but without the coding hassle.

For GLSL, don't forget checking the infolog regularly. There's code how to do this in my tutorials. If you use the GLSL extensions (GL1.5 style), refer to my basic math tutorial. If you use core GL 2.x, refer to my fast transfers tutorial for error checking functions you can just copy and paste into your code.
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.0 available)

Postby Thorsten » Tue Feb 14, 2012 9:33 am

I've tested and optimized the shaders over the last couple of days, and while I could squeeze a few more fps out and was able to eliminate a few rendering artefacts, I fear it is now as fast as I can make it, and that means vertex count is the overall governing factor. I'll do a few more checks, then comment the code properly and release a version 1.1.

It's worth spending the framerate on this in my opinion - even if basically all other shaders have to be off. A feature gallery of how the weather system, the skydome, the terrain haze and the lightfield functions mesh together to create atmospheric light:

A panorama of the French Alps in broken cloud cover. Note how the clouds at the horizon blend into the haze layer, leaving the question somewhat open if there'd be more clouds or not coming.

Image

With the terrain effect functionality of Local Weather, clouds tend to attach to mountaintops as convection seeds. This can make low flying through mountain passes a bit of a challenge. Here I'm crossing near the Massif de la Valoise towards Courchevel airport (LFLJ) - if you haven't seen that one, try it out (using the custom model by the Custom France scenery maintainers) - the runway is steeply inclined and looks a bit like a skijump.

Image

Flying the Italian Alps near Bolzano with the P-51D on a bright clear summer day - lots of convection, this would also be an awsome day to go soaring. The P-51D is fun to fly low through valleys and canyons.

Image

With the F-16 over the Italian Alps while the sun illuminates the broken cloud layer. Note the fine gradient of the light from left to right - this is what we spend a lot of GPU power to get right.

Image

Flying alpine valleys with the F-16 - this picture illustrates nicely what the terrain haze is for and how it meshes with the weather system: It represents the moisture in the air which is usually present below the first cloud layer, but blocked by the inversion to get higher, so the view is much reduced below the cloud layer.

Image

A 777ER on a morning departure from San Francisco enroute to Las Vegas (I know it's designed to fly longer routes, but I don't have the patience...) - note how the hills stick out of the morning haze in the background and how clouds and haze blend into the light gradient.

Image

Stratocumulus fields and lots of haze as we descend into the Las Vegas area. Note how the summit of Mt. Charleston sticks above the haze, and also how far we can draw the cloud cover.

Image

With the F-16 above Maui. This again illustrates perfectly the effect I wanted to achieve with the haze layer - but this time, the haze also has to inherit the correct light for this scene to work (it is *much* easier to render this at noon) - shade and low visibility beneath the cloud layer, clear sky above.

Image

Pulling up to fly between two layers (I always like when I find a situation like this - seeing just cloudscape).

Image

Hazy evening light over Grenoble - apparently the gliders are done for the day. Note how the light reduction by haze and cloud cover makes the light violet rather than red.

Image

Diffuse haze over the French Alps. Notice the appearance of the haze layer top as blurred line - I am close to the boundary here, as I descend the line blurs more and more and eventually disappears.

Image

Eerie evening light over the French Alps with strong fog in the valleys and a scattered cloud cover.

Image

An F-16 pulling up into the cloud cover over the ocean. The rendering artefacts over ocean tiles are gone :-) Note the effect of the position-differential light which keeps the sea surface dark while illuminating the clouds, and how the light gradient changes in altitude. A lot of effort goes into making these things not noticed in the final scene - it's very easy to produce an unnatural appearance.

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

Re: Sunrises (version 1.0 available)

Postby f-ojac » Tue Feb 14, 2012 11:27 am

No other word but congratulations !
f-ojac
 
Posts: 1304
Joined: Fri Mar 07, 2008 10:50 am
Version: GIT
OS: GNU/Linux

Re: Sunrises (version 1.0 available)

Postby Sealbhach » Tue Feb 14, 2012 2:18 pm

This looks amazing, really professional level effects. It will increase enjoyment of flights by at least 300%.

.
Sealbhach
 
Posts: 934
Joined: Wed Jun 30, 2010 10:17 am

Re: Sunrises (version 1.0 available)

Postby Johan G » Tue Feb 14, 2012 3:14 pm

I am impressed, as always! :D 8)
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)
Some YouTube videos
Johan G
Moderator
 
Posts: 6629
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Sunrises (version 1.0 available)

Postby erik » Tue Feb 14, 2012 3:53 pm

Just: Wow!
This takes FlightGear to a whole new area of simulation, great work!
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2245
Joined: Thu Nov 01, 2007 2:41 pm

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 6 guests