Board index FlightGear Development Scenery

Why do my water always looks so greenish

Questions and discussion about enhancing and populating the FlightGear world.

Re: Why do my water always looks so greenish

Postby erik » Tue May 04, 2021 12:21 pm

benih, could you give me the latitude and longitude of the lake you are testing?

I've now added a lakes and rivers layer which I would like to test before committing the result.

Erik
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: 2244
Joined: Thu Nov 01, 2007 2:41 pm

Re: Why do my water always looks so greenish

Postby benih » Tue May 04, 2021 1:45 pm

Sure, its here: 47.72N, 11.73E
https://www.google.de/maps/@47.72,11.73,13z

Also affecting the small lake in the east, Lake Schliersee, and in essence any other in the wider area.
User avatar
benih
 
Posts: 1689
Joined: Tue Aug 15, 2017 10:34 am
Callsign: D-EBHX
Version: next
OS: Debian Linux 64bit

Re: Why do my water always looks so greenish

Postby vnts » Tue May 04, 2021 3:40 pm

Thorsten wrote in Tue May 04, 2021 10:33 am:Now consider areas in the world where we usually don't make SSOTM-Type shots - lakes are blocky, triangular or rectangular chunks, rivers are not smooth but straight line segments zig-zaging through the area. Now imagine these structures illustrated with high contrast against the surrounding landscape - we'd literally point the viewer right at the flaws of the terrain resolution.

So here you have in a nutshell why lakes are greenish in spite of the fact that for a particular lake blue might actually work better as base color.

erik wrote in Mon May 03, 2021 2:03 pm:
As for floor colour (water bed colour), some of the reddish colours like in Australia might not be appropriate for rivers or even small water bodies. The yellows might only be valid for some volcanic type locations, or shallow sandy water. The whites might be ok for sandy coastal areas / islands, but lakes high in mountains in the blue marble map have snow - as might landmasses close to the poles.

The way the shader works is that it blends the RGB colors if the depth is shallow enough. This requires some thinking for inland water bodies but I think i got it quite acceptable with the latest update.

Testing with files downloaded from sourceforge (I had transmission=1.0 in the shader to turn off fog/haze, so water colours can be seen clearly):

Small waterbodies near reddish and yellow areas can look a bit odd even with a bit of red or yellow colour (for dry coloured regions like Australia, Africa etc.). A water source can be found in instantstreetview near pretty much any town in a desert or dry region, and it's in FG's landclasses for better covered areas like Austria or Europe.

Western Australia (-27.112707,118.075356) :img
Transitions between colours can look odd (e.g. problematic for rivers) : img
Near -27.112707,118.075356 : img
Central Spain 39.500527,-3.253065: img

Not sure what the solution is other than to have variations of a dull green depending on dryness/temperature/climate, and have it vary very slowly somehow. To make a colour vary slowly it would need selecting certain areas and blurring heavily(?) - but even that might be visible from high altitude if the colours varied sharply. The colours would need to be variations of green. It might also be possible to select an area and save to channel, duplicate image, lower resolution, upscale, and copy to original image over the selection. Not sure if this will work properly. A flat colour for most places inland is simplest.

The inland colours in texture could just be de-saturated for WS2. Possibly to match a bit with targets used in the texture matching project (not sure what those were exactly). While saturated colours for large lakes might be ok in high quality Corine areas, there are also thin rivers in places which look pretty jagged IIRC.

Maybe inland Corine areas like alps could be de-saturated a bit less than other locations.
erik wrote in Mon May 03, 2021 2:03 pm:
I guess some approximation of depth can be extracted if "blueish" hues are identified in the shader - for the sea and maybe some rivers/lakes. Large inland waterbodies that don't appear blueish will get a default shallow depth, as will waterbodies that are too small to register.

After some experimenting it turns out the red channel gives the best result, mixed with a small bit of the green channel.

I meant treating ocean water depth separately from inland water based on blueness (or redness) to simplify things - i.e. but as long as it works a two line equation is also probably as fast/faster
benih wrote in Mon May 03, 2021 7:32 pm:Well, the ortophoto at least comes close to the color of the lake 2/3 of the time when i look out my window. (1)
When it does not, it’s a way darker version of the blueish in the first image.

benih wrote in Mon May 03, 2021 3:57 pm:Hm, maybe a tad too much blue now :)
The depicted lake is about 40 meters deep on average.

For specific waterbodies like lakes, or waterbodies in a whole area that have similar colours, creating a shader tweak to override of colour and maybe depth via regional definitions, is the best way to go. There could be a waterbody xml file like - austria-water-bodies.xml. A list of waterbody types are in gobal-summer.xml - and Alps scenery just uses Europe.xml for everything at the moment.

Kind regards
vnts
 
Posts: 409
Joined: Thu Apr 02, 2015 1:29 am

Re: Why do my water always looks so greenish

Postby erik » Wed May 05, 2021 12:18 pm

I 've made an update which includes 1.5 million lakes and ponds resulting a toned down (less deep looking) look the smaller lakes.

Erik
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: 2244
Joined: Thu Nov 01, 2007 2:41 pm

Re: Why do my water always looks so greenish

Postby vnts » Wed May 05, 2021 3:03 pm

That should get nice depth for a lot of waterbodies :)

Test: https://imgur.com/a/OjrMeEj

The water bodies in spain were caught, however waterbodies in western Australia that I checked before weren't - as there's a limit to resolution I guess. I found one lake that was partially caught (blue and red). The current blue colours don't suit locations that don't have sediment free water (including slow moving water in drier areas).

How are you managing all these different data, as layers and/or selection-to-channel, with unneeded data in various sources deleted?

Since the colour channels are just used for water colour and depth data, they aren't used visually - a solution might be to change some channels to help the shader ID the type of water, and use a unique way to interpret depth and colour?

Example of what I mean:
- Blue channel: pure depth data (same as old alpha channel, but with the new info)
- Green channel: could indicate the area was ocean [e.g. 255], muddy river-mouth (like Amazon) [e.g. 200], inland lakes[e.g. 100], and other inland water[0].
- Red channel: intensity of some effect. Some space saving having a blank channel - 12.5 MB -> 10.5 MB @ 95% JPG on latest texture.

GIMP: RGB in greyscale layers, multiple layers for data sources in some channels like green, selections in channel, using channel-to-selection and save selection to channel to switch. Flood-fill to set G and R channels. Color > Compose/Decompose to compile image. Transitions between inland green values may have to be interpolated somehow (??) (duplicate layer, grow selection, flood-fill, blend layers).

Floor colour calculation (mix statements are fast, and smooth step is also pretty fast - old ps model 3 hlsl ref for instruction slots [1]): Use fast array of floor colours, and create a colour array lookup index by a quick means like n=blue channel*number; i = int(floor(n)). Will need to mix between i and i+1 floor colours to avoid sharp transitions, taking advantage of texture interpolation e.g. mix(c[i],c[i+1],n-i). If colours are too different, like ocean & inland, transitions will still be noticeable. The biggest issue is the highest and lowest value next to each other will cause it interpolation through all the floor types, so inland floor colours can't be too different - a way to avoid this might be to store adjacency info in the R channel - R channel: grow selections for different floor types, flood fill, use subtract channel to isolate area around blobs, and combine different floor types. For variety: more floor types, or have an array of particle colours and use mix(floor_colour, particle_colour, r_channel).

Trying to manage colour and depth in 3 channels is complicated.

Kind regards
vnts
 
Posts: 409
Joined: Thu Apr 02, 2015 1:29 am

Re: Why do my water always looks so greenish

Postby wlbragg » Thu May 06, 2021 2:32 am

Erik, I copied over the new ocean depth texture and my system has issues with it.
All I did was replace my ocean depth with the new one. If I have the transition shader to max using the new image, then the water looks correct.
See my sig for GPU info

The first two images are with the original ocean depth texture and the second is using the new texture with the transition shader set to anything less than max. This is with ortho photo enabled. I haven't tried this yet using non ortho or tested the water slider settings.
Image
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7586
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Why do my water always looks so greenish

Postby wlbragg » Thu May 06, 2021 2:52 am

Ortho has nothing to do with it, it does it with ortho disabled.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7586
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Why do my water always looks so greenish

Postby erik » Thu May 06, 2021 8:00 am

There as also a small update to Shaders/water-ALS-high.frag, did you also update that to the last version?
And if so, at what lat and lon does this happen?

Wait, that menu option is not available anymore in next, is this version 2020.3 by any chance?

Erik
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: 2244
Joined: Thu Nov 01, 2007 2:41 pm

Re: Why do my water always looks so greenish

Postby vnts » Thu May 06, 2021 1:50 pm

wlbragg wrote in Thu May 06, 2021 2:32 am:[..]All I did was replace my ocean depth with the new one. [..]

The new texture is in .jpg format, the old is in .png. Quick fix: If you open it in gimp and export to ocean_depth_1.png it should sort of fix it.

You need the new water.eff and water-inland.eff effect, as well as water-ALS-high.frag shader. What's likely happening is that at lower transition the lower quality water shaders are used, and these don't use a depth map so there's no error. The console/fgfs.log should also tell you the .jpg file is missing.

This change works fine in 2020.3 LTS.

Kind regards
vnts
 
Posts: 409
Joined: Thu Apr 02, 2015 1:29 am

Re: Why do my water always looks so greenish

Postby wlbragg » Thu May 06, 2021 4:33 pm

Thanks guys, I'll pull the shaders as well and try again.
Kansas and Ohio/Midwest scenery development.
KEQA, 3AU, KRCP Airport Layout
Intel i7/GeForce RTX 2070/Max-Q
User avatar
wlbragg
 
Posts: 7586
Joined: Sun Aug 26, 2012 12:31 am
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Linux/RTX 2070

Re: Why do my water always looks so greenish

Postby erik » Fri May 07, 2021 2:33 pm

I've now split up the water depth texture (gray-scale) and the water color texture (rgb) in such a way that it does not take up more video memory but does result in a disk space reduction to about 10% of the original. And I think I'm quite happy with the result.

Erik
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: 2244
Joined: Thu Nov 01, 2007 2:41 pm

Re: Why do my water always looks so greenish

Postby vnts » Fri May 07, 2021 4:28 pm

I added a tweak to the effect allowing a floor colour and depth override (zip of v1).

I also cleaned the water effects up (technique 2 had an un-needed uniform, and water-inland was a duplicate that just had the ocean flag changed which I exposed as a parameter - see a file diff to see what I mean).

This allows creation of a bunch of effects for different waterbody appearances. The various types of inland waterbodies in global-summer.xml can get regional appearances. It's just a case of defining effects to inherit from water-inland, and changing parameters - e.g. defining glacial lakes with different amounts of glacial flour and algae or other sediment: water-inland-lake-glacial-medium-algae-low.eff

The lake at 47.72N, 11.73E Benih mentioned which had a water colour similar to this 2/3 of the time:
Image

Quick override (only roughly the colour above):
Image
(BTW, this area is stunning in FG these days :mrgreen: There also seems to be some issue on next where trees and OSM are only loaded at really close ranges, even with LoD rough set to 30km(?) )

This is a quick override, the actual value should tweak the brightness of the colour to a reasonable value to reduce the attention to the lack of transtion, and match the hue to be in-between the 2/3 blue-green and the 1/3 more blue without drawing too much attention to the water.

This technique avoids other water bodies in the area like rivers or other lakes which aren't fed by glaciers from appearing the same colour.

It's also possible to make the colour vary seasonally similar to tidal flats - e.g this google result (link) suggests that high concentrations of rock flour when glaciers melt causes emerald glacial lakes and a lower concentration makes them more turquoise - exact colour might vary in different areas depend on how fine the rock flour is, and if there's any other leeched minerals, as well as algae and regular sediment. This would use a summer colour and a winter colour for interpolation. For regular lakes and rivers, the wet to dry season should still cause colour changes (the exact season depends on things like monsoonal rains, and the times of wet seasons won't be in the climate map I guess)

erik wrote in Fri May 07, 2021 2:33 pm:I've now split up the water depth texture (gray-scale) and the water color texture (rgb) in such a way that it does not take up more video memory but does result in a disk space reduction to about 10% of the original. And I think I'm quite happy with the result.


The drawback with this is that there are now 2 texture lookups for fairly large textures, not sure if the performance hit is really noticeable.

After thinking about it, it's possible to just use a depth map, and specify the lake floor colours in regional definitions. This way lakes, estuaries, or rivers don't get the same colour. Since there's only one channel it should be possible to use 4x more pixels in the depth map - a 16384 by 8192 texture (there seem to be 20k source textures which have to be resized to be power of two). The DDS texture cache code path will automatically downsize textures on old systems if they had an issue, but not sure if this was ported to the general case yet (and really old systems would not be able to use water-high anyway). The drawback is that areas like the mouth of the amazon which have brown colours that gradually fade out won't get them (or will get a sharp transition).

Is the extra depth resolution worth it?

It's possible to define 2 floor colours and have the floor colour transition with depth. This might help avoid a sharp transition around a rivermouth, and might make some areas look nice.

Edit: I'm not sure where /environment/sea/color_r , g, and b comes from - it is used in the light coming off the water, and it may include a hardcoded water colour - or it may just be an environmental colour contribution (e.g. fresnel). If the floor colour was split from water colour, then it would be possible to have a couple of environment sliders for particles in water and just mix a few colours - algae, mud, glacial rock flour, some of the types of chemicals leeched from rocks e.g. in volcanic areas. Google suggests common limestone areas (karst geology) also get blue lakes.

Kind regards
vnts
 
Posts: 409
Joined: Thu Apr 02, 2015 1:29 am

Re: Why do my water always looks so greenish

Postby Thorsten » Fri May 07, 2021 6:00 pm

Edit: I'm not sure where /environment/sea/color_r , g, and b comes from


An early interpolation routine pre-dating the depth map - it could do light blue in the Caribbean and dark blue in Hawaii, but it was pretty much obsoleted by the depth map technique.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Why do my water always looks so greenish

Postby erik » Sat May 08, 2021 8:48 am

vnts wrote in Fri May 07, 2021 4:28 pm:I added a tweak to the effect allowing a floor colour and depth override (zip of v1).

This might look nice for inland waters but it destroys the ocean water color effects around TNCM.

The way it works now is that the water colors are taken from globe_colors.jpg, for inland water bodies and for ocean coloring. We need to keep that part.
In the future I also want to experiment with blending Blue Marble ground colors with texture colors at least for areas like desert.

Also, could you create changes without altering the indentation? It's very hard to follow what has changed this way.

Update: It looks to me you did not use the latest code to update which causes globe_colors.jpg not being used.

Erik
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: 2244
Joined: Thu Nov 01, 2007 2:41 pm

Re: Why do my water always looks so greenish

Postby vnts » Sat May 08, 2021 1:16 pm

erik wrote in Sat May 08, 2021 8:48 am:Update: It looks to me you did not use the latest code to update which causes globe_colors.jpg not being used.


Edit: [Zip of changes v2]. This version reads the r channel of the depth texture, so it should work when the issues below are fixed (I tested using a 1 channel png).
----
Yep I was working on it. before I saw the update post here. I'll re-do changes on top of the new version.

One thing, looking at the new ocean_depth_1.png [1] : the r values seem inverted? The previous version had 255 for inland areas, and 0 for the deepest water - it was a measure of shallowness rather than depth. The shader is configured to expect that format (i.e. all the equations where topoTexel.a is used need to be changed if the inverted version is used).

There also seem to be two channels grey and alpha in GIMP?. Grey channel seems to be an inverted version of alpha? Depth looks changed at ENBR (dark blue) where the surrounding ocean is shallow normally (grey/light blue on a cloudless day). Using topoTexel.a instead of topoTexel.r gives the same results as before, so the file does seem to contain 2 channels. Just dragging the alpha channel out to a new image, and exporting to PNG with compression 9 gives me a 2MB file (which is also why a higher resolution depth texture with JPG format is tempting).

(I take it this first greyscale depth map is just a prototype - it doesn't have the detailed shading of the previous depth map [1], or the new additions like lakes. Just checking to see if it the correct map was uploaded.).

I'm not sure what you mean by indentation - I was just using notepad.exe (The shader file appeared to use tabs for indentation so I tried to use tabs to match it IIRC - But there's also a Windows line endings problem that causes the sourceforge's website diff to show the whole file has changed every time there's a Linux/Windows switch - maybe it's what you are seeing? Also syncs should be configured to convert to one or the other I think? IIRC Thorsten used windows due to driver issues with Linux, so most of the effects and shaders used Windows line endings.)
erik wrote in Sat May 08, 2021 8:48 am:
vnts wrote in Fri May 07, 2021 4:28 pm:I added a tweak to the effect allowing a floor colour and depth override (zip of v1).

This might look nice for inland waters but it destroys the ocean water color effects around TNCM.

This will be fixed when I re-do the changes on top of the latest update (once the depth map issue is fixed).

But on the topic of sea colours, a depth based colour transition can be done to match the existing colouring. The current sea colouring just a colour transition based on the depth map too it seems. Transition: shore-colour to shallow-water colour to deep-water colour. Colour/depth value pairs can be specified for the interpolation - this can be done in a fast way by using mix/clamp statements or something e.g. mix(y1, y2, clamp((x-x1)/(x2-x1),0,1) where x1<x2.

This doesn't solve the issue of inland water meeting sea water. It's possible to use a 2nd channel for the transition data, but that ruins the free 4x depth resolution. It's possible to do a 2nd lookup of the depth map and get a bit of transition from inland colour to a blueish colour (but if the sea colour isn't the same everywhere.

Then there's the other issues like checking to see the increased texture size is handling.

Since the depth map is small, I guess it's possible to have a 4x version side-by-side at higher quality levels.
erik wrote in Sat May 08, 2021 8:48 am:In the future I also want to experiment with blending Blue Marble ground colors with texture colors at least for areas like desert.

Not quite sure what you mean. Is this for normal terrain and not water? - that could work if it's mixing base colour with 1-2 textures for variety e.g. it's possible to use rough intensity = length(texture_colour) and multiply with the base colours. But I think for other areas a lot of the small scale colour variation is just not visible in blue marble (e.g. cities aren't really noticeable from space during daytime, as colours get averaged out with surrounding terrain).

For more detail of the water floor, it's possible to use a detail texture or noise function to show reefs in the Caribbean etc. - in addition to the existing noise detail (but there will be numerical issues with smaller details when using world sized texture coords).

Kind regards
Last edited by vnts on Sat May 08, 2021 3:22 pm, edited 1 time in total.
vnts
 
Posts: 409
Joined: Thu Apr 02, 2015 1:29 am

PreviousNext

Return to Scenery

Who is online

Users browsing this forum: No registered users and 13 guests