Board index FlightGear Development Effects and shaders

fully-procedural sea surface computing. without textures

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

fully-procedural sea surface computing. without textures

Postby erik » Sat May 26, 2018 9:48 am

Hi,

A follower of one of my GitHUB projects has created a stunning ocean shader:
https://www.shadertoy.com/view/Ms2SD1

The problem at this point is the license which is not compatible with the GPL.
Would it be interesting to ask whether he is willing to release it under the GPL2 too?

Erik
erik
 
Posts: 1492
Joined: Thu Nov 01, 2007 1:41 pm

Re: fully-procedural sea surface computing. without textures

Postby bugman » Sat May 26, 2018 10:27 am

That looks awesome! Do you know if it looks good from high altitude? Don't forget to ask for GPLv2+, i.e. it can be updated to GPLv3+ by the project in the future if so decided.

Regards,
Edward
bugman
Moderator
 
Posts: 1514
Joined: Thu Mar 19, 2015 9:01 am
Version: next

Re: fully-procedural sea surface computing. without textures

Postby erik » Sat May 26, 2018 12:55 pm

I have no idea how it looks from altitude, but in this video you can look straight down:
https://youtu.be/c1bwIQs0F2k

So that's probably something to to check for once we have permission. But I will only ask if there is interest from the shader developers. Myself I have no clue whether it could actually work together with FligthGear at this point.

Erik
erik
 
Posts: 1492
Joined: Thu Nov 01, 2007 1:41 pm

Re: fully-procedural sea surface computing. without textures

Postby wlbragg » Sat May 26, 2018 4:03 pm

That is impressive! I would love to land a float plane on it. Of course I'll have to wait for a calmer day!
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 3966
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: fully-procedural sea surface computing. without textures

Postby Thorsten » Sat May 26, 2018 5:25 pm

What, specifically, do we want to achieve, aka what is the feature you want to have in FG?

We have a fully procedural (aka texture-less) sea shader at the moment (which responds to weather etc.). We could switch it against another one, or we could augment it with more detail (in particular, a few octaves of Perlin noise at close distance is easy to do). I've toyed with the idea to use a geometry shader to produce an actual local wave mesh for instance....

What a procedural shader without geometry stage does is look poor when you actually land on it. Even a geometry shader won't produce anything an aircraft reacts to when floating on the water - I believe that is the achilles-heel.

Dependent on what you want to have, it may be cheaper to integrate the other shader into FG by adding our lighting, or it may be cheaper to augment our shader with additional functionality.
Thorsten
 
Posts: 9468
Joined: Mon Nov 02, 2009 8:33 am

Re: fully-procedural sea surface computing. without textures

Postby wlbragg » Sat May 26, 2018 5:48 pm

I've toyed with the idea to use a geometry shader to produce an actual local wave mesh for instance....

That would be really interesting to see or "feel".

What a procedural shader without geometry stage does is look poor when you actually land on it. Even a geometry shader won't produce anything an aircraft reacts to when floating on the water - I believe that is the achilles-heel.

Yes, for the purposes I would be excited about something like that, it has to have geometry and physics to go along with it. But I have to admit the visual sure looks good.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 3966
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: fully-procedural sea surface computing. without textures

Postby vnts » Sun May 27, 2018 3:51 am

(AIUI) What is being asked is what aspects of the sea shader stand out compared to FG's existing implementation.

Other than more octaves of noise..hm

Main other thing seems to be change in hue of scattered light with changing geometry of sea surface (greenish). Is that what's drawing attention?

Water colour is complicated..will not stay same as in video and change by location (varies by season/sun angle/view angle). Not sure what the dominant physical processes in the video are exactly.. or if they're accounted in FG but not depicted often due to data that feeds the shader (or I haven't seen it). My understanding of what's happening: As far as I know (AIUI) water absorbs strongly in lower frequencies (red) due to OH bond(?). Light passing through clear water becomes blue as lower frequencies gets filtered out. When looking at a deep ocean light doesn't reach the bottom to get reflected like in a swimming pool with a white floor. Instead different frequencies of light gets absorbed and/or scattered back by suspended particles/sediments of varying size. These particles colour the light (like rock particles ground by glaciers which give glacial lakes distinctive colours). AIUI particles: algal blooms, sediment from rivers (worse during flooding), plankton density, and things like bioluminescent phytoplankton in tropics that glow in wakes or show on foam from breaking waves (google: img). These have complicated scattering interactions. Sky colour is accounted for. Not sure if any are worth time or performance hit.

Based on this AFAICS The shader shows deep ocean. Sea bed doesn't play a role. AIUI The depth to a sea floor to reflect light in shallow waters isn't available until next gen scenery (or something extremely(?) complicated like creating an object on terrain OSM-style.. a beach+seabed object with a distance/direction field).

Particles may also have a profile in the water column that might effect hue of scattered light when looking at a shallow angle compared to perpendicular(?). When looking through waves there's light transmitted from the other side+light that goes in and gets scattered back. Not really sure what dominant processes that the change in hue describes. These are volumetric effects so they have to be faked somehow to avoid a raytrace of noise(??).

AFAICS it's mainly hue change that remains unmentioned(?). Some glinty-ness in the video too (glint loop patterns are characterised by roughness which depends on sea-air temp difference as well as wind. Maybe animated thresholded noise can approximate..). Not sure if any of these are worth pain to gain.

(Never sure if it's just me, or if it's a known bug, or something I'm not setting up: Flying low over water. Adjacent parts of water have waves moving at different rates (or stationary) and directions. The seams (between different water polygons?) become visible (seams near ENBR). Sometimes wave direction oscillates or suddenly jumps back and forth. It's noticeable. Happens with UFO and all craft IIRC.)

wlbragg wrote in Sat May 26, 2018 5:48 pm:and physics to go along with it

That's not (conceptually) possible without recreating wave noise in a FG engine lookup function in both time & space with any quirks in precision or GPU FP calculations accounted for?? At least for big waves.

Kind regards,
vnts
vnts
 
Posts: 55
Joined: Thu Apr 02, 2015 12:29 am

Re: fully-procedural sea surface computing. without textures

Postby Thorsten » Sun May 27, 2018 5:32 am

different frequencies of light gets absorbed and/or scattered back by suspended particles/sediments of varying size. These particles colour the light (like rock particles ground by glaciers which give glacial lakes distinctive colours). AIUI particles: algal blooms, sediment from rivers (worse during flooding), plankton density, and things like bioluminescent phytoplankton in tropics that glow in wakes or show on foam from breaking waves


That's accounted for (though not implemented in many places) - the water can get a 'base color'.

The depth to a sea floor to reflect light in shallow waters isn't available until next gen scenery


It actually is - look at the Caribbean islands. The sea floor can have a color and depth (it's a global texture, so the resolution is of course not great) and the depth influences waves to some degree.

When looking through waves there's light transmitted from the other side+light that goes in and gets scattered back.


To be able to look 'through' a wave you need a lot of geometry shader (or other technique) to create a proper mesh - the scattering equation are the smallest of your problems then.

Translation - I doubt we can do that without turning a Flightsim into a Wavesim

AFAICS it's mainly hue change that remains unmentioned(?).


The Hue change in angle (if we mean the same thing) is Fresnel reflection (some background) and we have that:

Image

(Never sure if it's just me, or if it's a known bug, or something I'm not setting up: Flying low over water. Adjacent parts of water have waves moving at different rates (or stationary) and directions.


Google the difference between group velocity and phase velocity, and you'll understand what is happening...
Thorsten
 
Posts: 9468
Joined: Mon Nov 02, 2009 8:33 am

Re: fully-procedural sea surface computing. without textures

Postby erik » Sun May 27, 2018 8:30 am

Thorsten wrote in Sat May 26, 2018 5:25 pm:We have a fully procedural (aka texture-less) sea shader at the moment (which responds to weather etc.). We could switch it against another one, or we could augment it with more detail (in particular, a few octaves of Perlin noise at close distance is easy to do). I've toyed with the idea to use a geometry shader to produce an actual local wave mesh for instance....

I must admit, adding a geometry shader sounds very appealing too.

Erik
erik
 
Posts: 1492
Joined: Thu Nov 01, 2007 1:41 pm

Re: fully-procedural sea surface computing. without textures

Postby Icecode GL » Sun May 27, 2018 12:50 pm

A geometry shader depends on previous geometry to work. FG scenery is not regular (triangles are arbitrarily shaped) and does not have a proper LOD system. There is a limit to how many triangles you can produce per existing triangle, and they are not even close to enough to create waves.

In my opinion what we have today is the most sophisticated thing we can have in FG. FG has limitations, as the shadertoy webpage has. It's just that they are different limitations, so one has to try to get around them and get the best results with the tools available. I think Thorsten did a pretty good job at that.
Icecode GL
 
Posts: 424
Joined: Thu Aug 12, 2010 12:17 pm
Location: Spain
Callsign: icecode
Version: GIT
OS: Arch Linux

Re: fully-procedural sea surface computing. without textures

Postby Thorsten » Sun May 27, 2018 1:21 pm

There is a limit to how many triangles you can produce per existing triangle, and they are not even close to enough to create waves.


You'd basically try to sculpt the leading sines in the geometry shader and do the rest via a heightmap. I'm not sure it will work, but I flagged it as 'worth a try' - but I need to learn more geometry shader lore first, I'm working on a simpler test case that adds roughness to a surface.
Thorsten
 
Posts: 9468
Joined: Mon Nov 02, 2009 8:33 am

Re: fully-procedural sea surface computing. without textures

Postby Thorsten » Mon May 28, 2018 5:07 pm

Oh, and please note that the water shader in ALS is something I basically ported. I added lighting and a few other tweaks to it, but the basic idea and implementation is not mine.
Thorsten
 
Posts: 9468
Joined: Mon Nov 02, 2009 8:33 am


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 1 guest