Board index FlightGear Development Effects and shaders

Water shader

An exciting "new" option in FlightGear, that includes reflections, lightmaps, the particle system etc.. A lot is yet to be discovered/implemented!

Re: Water shader

Postby gral » Sun Nov 21, 2010 12:50 pm

Yes, curt, it’s true and this is where I am picking up my work again. When you switch between the two shaders, old water reflection and new water shader, above quailty level 2, you can see that there is a (wrong ? ) constant offset with the new shader. I will have a look to this problem again the next days (or weeks). -gral
gral
 
Posts: 323
Joined: Mon Nov 16, 2009 2:03 pm
Location: Zurich (Switzerland)
Callsign: HB-GRAL
Version: GIT

Re: Water shader

Postby fredb » Sun Nov 21, 2010 4:53 pm

Hi Yves,

Not so sure it is in the new shader only :

Image
User avatar
fredb
 
Posts: 753
Joined: Fri Dec 01, 2006 11:41 am
Location: Paris, France

Re: Water shader

Postby HHS » Sun Nov 21, 2010 5:01 pm

What I somewhere already said...
It is even (though less) noticeable without shaders.
Maybe the changes on the lighting some while ago was the cause...
Up, up and away
User avatar
HHS
 
Posts: 3625
Joined: Thu Jul 19, 2007 9:09 am
Version: GIT

Re: Water shader

Postby gral » Sun Nov 21, 2010 8:40 pm

Oh - thank you Fred and HHS. I will stop working on this topic in the water shader for the moment. And I should re-start here reading the whole thread and not just reacting on red color ;-)
gral
 
Posts: 323
Joined: Mon Nov 16, 2009 2:03 pm
Location: Zurich (Switzerland)
Callsign: HB-GRAL
Version: GIT

Re: Water shader

Postby fredb » Mon Nov 22, 2010 1:46 pm

Can somebody try to change line 380 of simgear/scene/sky/oursun.cxx

Code: Select all
    T2.makeTranslate(osg::Vec3(0, sun_dist, 0));

    sun_transform->setMatrix(T2*DEC*RA);

into :
Code: Select all
    //T2.makeTranslate(osg::Vec3(0, sun_dist, 0));

    sun_transform->setMatrix(DEC*RA);

?
User avatar
fredb
 
Posts: 753
Joined: Fri Dec 01, 2006 11:41 am
Location: Paris, France

Re: Water shader

Postby i4dnf » Mon Nov 22, 2010 2:20 pm

Modified, rebuilding now, will report as soon as build completes.

L.E.: Yep no sun, VaLeo beat me to it :).
Last edited by i4dnf on Mon Nov 22, 2010 2:50 pm, edited 1 time in total.
i4dnf
Retired
 
Posts: 743
Joined: Wed Sep 09, 2009 8:17 am
Location: LRBS
Callsign: YR-I4D
Version: GIT
OS: Gentoo Linux ~amd64

Re: Water shader

Postby VaLeo » Mon Nov 22, 2010 2:40 pm

fredb wrote:Can somebody try to change line 380 of simgear/scene/sky/oursun.cxx

?


No sun :?
VaLeo
 
Posts: 186
Joined: Wed Nov 29, 2006 11:00 am
Location: Ukraine, Dnipropetrovsk
Version: GIT
OS: Debian 7

Re: Water shader

Postby fredb » Mon Nov 22, 2010 2:41 pm

Thanks
User avatar
fredb
 
Posts: 753
Joined: Fri Dec 01, 2006 11:41 am
Location: Paris, France

Re: Water shader

Postby timoore » Thu Dec 02, 2010 12:02 pm

I'm looking at the problem of the mismatch between the sun texture and the water reflection. I think there's a mismatch between the positioning of the sun on the celestial sphere in the SimGear ephemeris code and the calculation of the sun angle in FlightGear that is based on the ephemeris data. I will test this theory out later today.

Tim
timoore
 
Posts: 12
Joined: Tue Dec 30, 2008 10:29 am
Location: Bordeaux, France
IRC name: moore33
Version: git

Re: Water shader

Postby timoore » Sat Dec 04, 2010 5:16 pm

I've committed a fix to the synchronization problem in flightgear git, 79a2173ef9d6d04af8815d658c0a4daedf553ac4. Please give it a try.

By the way, in investigating the water shader I found that it is derived from the tutorial at http://www.bonzaisoftware.com/water_tut.html. Indeed, the shader code is very close to the GLSL port of that tutorial found at http://forum.bonzaisoftware.com/viewthread.php?tid=10. I don't think there is a copyright issue, but we can't put our own copyright on that shader code. At a minimum, it is polite to give attribution when you borrow code.

Tim
timoore
 
Posts: 12
Joined: Tue Dec 30, 2008 10:29 am
Location: Bordeaux, France
IRC name: moore33
Version: git

Re: Water shader

Postby MdMax » Sat Dec 04, 2010 7:07 pm

Hello ! :D

Thank you very much ! It works fine now for me.

Image
User avatar
MdMax
 
Posts: 46
Joined: Sun Nov 22, 2009 1:17 pm
Location: France
Version: Git
OS: Ubuntu GNU/Linux

Re: Water shader

Postby fredb » Sun Dec 05, 2010 2:46 pm

timoore wrote:By the way, in investigating the water shader I found that it is derived from the tutorial at http://www.bonzaisoftware.com/water_tut.html. Indeed, the shader code is very close to the GLSL port of that tutorial found at http://forum.bonzaisoftware.com/viewthread.php?tid=10. I don't think there is a copyright issue, but we can't put our own copyright on that shader code. At a minimum, it is polite to give attribution when you borrow code.

I added an attribution to the vertex and the fragment shader :
Code: Select all
// This shader is mostly an adaptation of the shader found at
//  http://www.bonzaisoftware.com/water_tut.html and its glsl conversion
//  available at http://forum.bonzaisoftware.com/viewthread.php?tid=10
//  © Michael Horsch - 2005

By the way, thank you for the fix
User avatar
fredb
 
Posts: 753
Joined: Fri Dec 01, 2006 11:41 am
Location: Paris, France

Re: Water shader

Postby someguy » Sun Dec 05, 2010 4:13 pm

timoore wrote:I've committed a fix to the synchronization problem in flightgear git, 79a2173ef9d6d04af8815d658c0a4daedf553ac4. Please give it a try.

I presume this is only available to those able to build fg from scratch?
User avatar
someguy
 
Posts: 1650
Joined: Tue Nov 25, 2008 6:54 am
Location: USA
Version: 2019.1.1
OS: Mac OS X 10.11.6

Re: Water shader

Postby fredb » Sun Dec 05, 2010 5:40 pm

You can download a git build if you are running windows or mac

Edit: before being asked, for mac : http://flightgear.simpits.org:8080/job/ ... /artifact/ :wink:
User avatar
fredb
 
Posts: 753
Joined: Fri Dec 01, 2006 11:41 am
Location: Paris, France

Re: Water shader

Postby planetacancun » Mon Dec 06, 2010 1:21 am

Bump :)
Just to thank you ppl. Anyways we could have like different shaders depending on the weather in that given moment, like thunderstorm and calm shaders, for the cloudy days with no direct sun, some crystal clear sun reflection would be awesome for a lake for example, but I have seen some other work in rocks, shaders are looking great :) <- happy guy upgrading GIT as I write.

planetacancun wrote:
gluon wrote:@planetacancun: Sure you can, just do some lines of GLSL code...


At least that video is OpenSceneGraph, so it's not like crazy right :) I was testing the shader posted here and it's pretty cool, it could be better than the actual one. I'm going to leave the coding to the pros here coz I sux :D

EDIT

3 links I found, might be useful.

IDE for shaders (I'm going to give it a try later): http://www.vis.uni-stuttgart.de/glsldevil/
Some GLSL version of water FP/VP: http://forum.bonzaisoftware.com/viewthr ... =10&page=1
A test project as demo: http://forum.bonzaisoftware.com/viewthr ... =33#pid265
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

PreviousNext

Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 6 guests

cron