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 (download in first post)

Postby Thorsten » Mon Jan 16, 2012 7:47 am

Now just to add project Rembrandt to that.... it would look awesome.


I have no clue if it would interfere somehow in a bad way. Frederic? Currently I'm basically overwriting gl_LightSource[0] by position-dependent functions and feeding that to the lighting code, and struggling to determine the best position from which the haze color (which is now different from the light color at the object position) should be determined. In principle haze color would now be a line integral along the ray, but we can't actually do this, so it has to be an effective solution.

I don't really know what the shadow map generation needs to assume - but the shaders really override a lot of defaults now.

Btw, do you think the terminator would come free with real shadows, or is it somehow different phenomenom?


Largely it couldn't, because most of Earth isn't really there but just drawn by the skydome, so it couldn't cast a shadow in any case. If we had the LOD system and could draw terrain all the way out to the horizon, then probably in principle the terminator should come from this.
Thorsten
 
Posts: 11095
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (download in first post)

Postby Sealbhach » Mon Jan 16, 2012 11:29 pm

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

Re: Sunrises (download in first post)

Postby Thorsten » Tue Jan 17, 2012 8:30 am

Thanks, they're very good. Seems a self-shading correction for fog for very low sun angles is needed...
Thorsten
 
Posts: 11095
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (download in first post)

Postby Zan » Tue Jan 17, 2012 9:34 am

Thorsten wrote in Mon Jan 16, 2012 7:47 am:I have no clue if it would interfere somehow in a bad way. Frederic? Currently I'm basically overwriting gl_LightSource[0] by position-dependent functions and feeding that to the lighting code, and struggling to determine the best position from which the haze color (which is now different from the light color at the object position) should be determined. In principle haze color would now be a line integral along the ray, but we can't actually do this, so it has to be an effective solution.


Fred can correct me if I'm wrong, but something I think how the Rembrandt works:
- Terrain is rendered without shading. This has no effect on this topic.
- I think skydome will be rendered in the old way, so all work on that should be directly portable, and nothing is wasted there.
- A shadow map is rendered, which is used in the next step. It is basically just a map of shortest distances from the light source to terrain. Nothing to do with this thread yet.

- Lighting is rendered for every light. We're mostly interested in sun and moon lights, so here comes this thread. The difference is that the geometry is already rendered on the screen, so we just calculate lighting for every visible area of scenery. So we now know for every pixel it's diffuse/specular etc colors, normal direction and position (probably relative to the camera?). And the pixels are compared to the shadow map to see if they're farther away from light than the nearest pixel, i.e. are they in shadow.
Now, I don't think too much changes here. You probably will need to change some maths, because the coordinates are different, but same principles should apply to this shading stage, as they did for the current way. Just that we now calculate the shading for only visible pixels, it should be a bit faster. And we probably could easily switch between old fog or this method or anything, as they are rendered as a separate passes.

- Transparent objects, like clouds are rendered after opaque geometry, but using the old methods, so I don't think anything changes there.

Conclusion is that I don't feel like anything here will get wasted if we take project Rembradt into use. It most likely needs some changes, but since the physics do not change, we can reuse all the things. Hopefully :)

Zan
Zan
 
Posts: 121
Joined: Tue Oct 20, 2009 10:28 am

Re: Sunrises (download in first post)

Postby Hooray » Tue Jan 17, 2012 9:46 am

That's also my impression. After reading through http://wiki.flightgear.org/Project_Remb ... er_writers I think this is mainly about having a set of decomposed shaders for specific tasks rather than some huge monolithic shaders that touch lots of areas.
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: 11350
Joined: Tue Mar 25, 2008 8:40 am

Re: Sunrises (download in first post)

Postby fredb » Tue Jan 17, 2012 9:52 am

I am trying to write the same thing on the Dev ML.
(probably relative to the camera?)

Yes. We don't want to mess with variable numerical precision induced by world coordinates.

And the pixels are compared to the shadow map to see if they're farther away from light than the nearest pixel, i.e. are they in shadow.

Until you reach the border of the shadow map which will occur at ~15km from the viewer. Everything beyond that will not receive shadows, so we need Thorsten's work

Conclusion is that I don't feel like anything here will get wasted if we take project Rembradt into use. It most likely needs some changes, but since the physics do not change, we can reuse all the things. Hopefully :)

Shader management would be simpler because the same haze calculation will not be implemented multiple times. Moreover, it will be possible to switch it globally if needed by less powerful computers, without modifying models.
User avatar
fredb
 
Posts: 756
Joined: Fri Dec 01, 2006 10:41 am
Location: Paris, France

Re: Sunrises (download in first post)

Postby Johan G » Tue Jan 17, 2012 4:48 pm

Sealbhach wrote in Mon Jan 16, 2012 11:29 pm:Ryan the Pilot has got some good images on his blog... might be useful for reference:

I'm even more impressed now. Thorsten, you are actually even closer to reality than I thought. 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)
Johan G
Moderator
 
Posts: 5529
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 (download in first post)

Postby Thorsten » Thu Jan 19, 2012 8:51 am

Some benchmark testing of the system yesterday evening with pictures of aerial sunrises/sunsets I found in internet searches.

Horizon glow just pre-dawn
=========================


Real:

Image

And Flightgear:

Image

All in all, not doing too bad here - the high altitude clouds should become more salmon-coloured instead of just yellow, but the light function is a tricky beast to tune (for performance reason, I am restricted to a generalized logistic function for all color channels). Also, we don't get the bright glow of clouds directly in the sun's path - that's Mie forward scattering of direct light, and far outside the range of what the cloud shader can be reasonably expected to do.

The terminator line from high altitude:
===================================

ISS (?) from about 300 km altitude

Image

And Flightgear from just 100 km (with 250 km max visibility, you wouldn't see any terrain from 300 km altitude... - but I couldn't find NASA pictures from 100 km, so...)

Image

Focus on the lower half of the pics - the hue of terrain, haze and clouds is reasonably well captured. In the upper half, reality brightens up much more than the Flightgear light function does (this is actually not just something I did - I just fitted the Flightgear light function, and the fit gets to full light even before the real thing from the core does). This is, in fact, a variant of the 'Why is the snow so yellow' question - because the light takes an awfully long time to go to full strength in all three color channels, so for a long time after sunrise, ambient light is rather yellow. Needs to be changed apparently - neither is snow seen so yellow, nor is the beyond terminator region really so low intensity.

Dense brightly glowing morning ground haze:
==========================

Reality:

Image

And Flightgear:

Image

Yep - works out well. We don't have clouds casting shades into the haze (pity, but technically an absolute nightmare to do) and we don't have enough self-shading of the clouds in these conditions (that can probably be improved somewhat by tuning the shader code), but otherwise it's coming out nicely.

Actually, what I am really missing is aerial shots of sunset/sunrise condition *away* from the sun - of course, no one takes those as it's much less spectacular, but as it stands I have only a very foggy idea of how the scene should look like when not seen from the ground. Fixing it from the ground isn't so difficult, but shots from high altitude are way more challenging to get right.
Thorsten
 
Posts: 11095
Joined: Mon Nov 02, 2009 8:33 am

impressive screen shots

Postby Hooray » Thu Jan 19, 2012 10:28 am

holy shit ... :shock:
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: 11350
Joined: Tue Mar 25, 2008 8:40 am

Re: Sunrises (download in first post)

Postby F-JJTH » Thu Jan 19, 2012 11:19 am

Absolutely impressive !

Cheers,
Clément
User avatar
F-JJTH
 
Posts: 697
Joined: Fri Sep 09, 2011 11:02 am

Re: Sunrises (download in first post)

Postby penta » Thu Jan 19, 2012 1:43 pm

Yep, that's some great work! I'm always amazed of what you are able to do :shock:
penta
 
Posts: 238
Joined: Mon Dec 29, 2008 11:05 am
Location: Parma-Italy
Version: Git
OS: Ubuntu Linux

Re: Sunrises (download in first post)

Postby Thorsten » Sat Jan 21, 2012 12:11 pm

Changed from development to testing of a package release candidate. Some screenshots documenting the features are posted in the next newsletter. I hope to persuade someone to help make this available as an option linked to the skydome shader in GIT, since integration into the other shader frameworks (Rembrandt for instance) might take quite some time.

The package will probably be available early next week - I'm still testing a wide variety of conditions from suborbital X-15 hops to low-level flying.
Thorsten
 
Posts: 11095
Joined: Mon Nov 02, 2009 8:33 am

Re: Sunrises (download in first post)

Postby i4dnf » Sat Jan 21, 2012 12:55 pm

The framework for integrating the haze into fog easily is already in place, using linked shaders. What is needed now is to add the haze computation to the fog shader, which is linked to all the other shaders. No other shaders need to be modified. A similar scheme could be setup for the light part.
I've put a hold on trying to integrate the haze, waiting for the light stuff to be more or less finished, since they are related.
As master is now opened for new features submission, we can start working on integrating this.
i4dnf
Retired
 
Posts: 745
Joined: Wed Sep 09, 2009 7:17 am
Location: LRBS
Callsign: YR-I4D
Version: GIT
OS: Gentoo Linux ~amd64

Re: Sunrises (download in first post)

Postby adrian » Sat Jan 21, 2012 2:29 pm

I'd just like to say that the screenshots look great! Fabulous work here!
adrian
 
Posts: 362
Joined: Wed Sep 15, 2010 2:15 pm

Re: Sunrises (version 1.0 available)

Postby Thorsten » Sun Jan 22, 2012 4:23 pm

Seems to be working just fine in my test cases, so see first post for package download.

The framework for integrating the haze into fog easily is already in place, using linked shaders. What is needed now is to add the haze computation to the fog shader, which is linked to all the other shaders. No other shaders need to be modified. A similar scheme could be setup for the light part.


I hope you are right. The light and fog computations are very much interlinked, since it is very important what light illuminates the fog where. In addition, the lightfield requires that no shader later in the processing may refer to gl_LightSource.ambient(diffuse) without creating lighting inconsistencies.

Well, it's maybe best if you simply take a look and see what you can make of it - you're much better with the tecnical aspects than I am. In case this does turn out to be more troublesome, maybe it'd really be best to commit this as an alternative scheme? I'd like to get this onto GIT in one way or the other, because the need to maintain three different branches (master, local weather bare and local weather + terrain haze) drives me nuts - I start making more and more mistakes...
Thorsten
 
Posts: 11095
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 0 guests