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 vnts » Tue May 11, 2021 10:39 am

benih wrote in Mon May 10, 2021 7:00 pm:Hm, now the lake is way too black....
I want to give this a shot, but i'm overwhelmed by all those files etc.
In this specific case, where should i look?

EDIT more specific: i see all the xml files, and want to start adding the separate file you mentioned - but i don't know what to enter there. Can you maybe share the code for the demo you mentioned?

For the demo I just overrode the floor_Colour variable in the water-ALS-high.frag shader, as reloading shaders is slightly quicker than pressing reload materials and reload scenery in the debug > configure development extension box (and you can use an equation to bump up colours by a fraction, as well as tweak intensity). AIUI it's possible to type <use>property name</use> and just change values of property trees, but not sure if there's a syntax to do assign 3 floats from the tree to a vec3 colour.

There's not too much to it. The way regional definitions work is that there's a location (diagonal corners of a box) followed by materials which assign an effect to a bunch of landclasses. The material contains properties like the ones above which are passed to the shader. For any effect there's a list of them in the parameters section at the start of the effect file e.g. (link) - these contain the defaults.

XML files can use the include statement to include other XML files. regions/Materials.xml (link) is a list of xml files for areas. The regional definitions at the bottom override the ones at the top, so it starts of globally and is a list of increasingly specific areas. FG checks regional definitions that apply to a location, and takes the last one (or reads from the bottom up and takes the first one).

You can just copy an existing regional definitions file - like iceland.xml, change the lat/lon coordinates, and add some water-inland landclass materials from global-summer.xml '(1) - then just play around with the parameters, or add more from the effect file. For different box areas, you can just list more lat/lon and materials. Same for any other terrain effect. It's probably simplest to use the UFO and view scenery from different angles/lighting ( "< >" keys move left right , "Home End" to move up/down, and "[ ]" to change speed).

Here is an example xml file e.g. for germany/alps local waterbodies : link
erik wrote in Mon May 10, 2021 8:01 am:The deepest party of the ocean is almost 9km. The resolution of the PNG images is 65536 possible values per channel. [..]
The current image has a resolution of 25cm per value change around the shorelines.

I get what you mean now. After taking a look to see what happened with the 16 bit image,what form the depth map from 2020 was - I understand what happened - the depth map was actually in space and was 16 bit - so it turned out to be 16 but when I exported.

I was under the impression FG would be working in 8 bit images, as the hypso website just had 8 bit Tiffs intended for the eye, which I thought was where the old bathymetry data came from:
erik wrote in Mon May 03, 2021 2:03 pm:
vnts wrote in Mon May 03, 2021 11:51 am:Where did you get your bathymetry data when you updated the water depth map, and is that source at a higher resolution than the blue marble image?

The original water depth map was from http://www.naturalearthdata.com/downloa ... lend-hypso

Then I looked at the old update to see what happenened (link)and it seems a 16 bit data product was integrated (instead of the usual logarithmic image intended for people to see):

The depth map before that was in 8-bit. The shader was set to interpret the depth data from 2014 (the commits until then didn't touch the depth and mixing equations): (link) . So the adjustments to the texture in 2020 were out. The interval mapping from the sourceforge folder history is "+1m to -63m in 25cm increments" apparently (link).

25cm increments and 8 bits [256 levels] means the interval is 1.0 to -62.75[=1.0-((256-1)*0.25)]?, not 1 to 63.0. Not sure if the quoted interval, or ranges are more accurate. This data nicely in linear space, I thought it was just roughly tuned to one of the logarithmic data sets meant for the eye - the GEBCO image I downloaded was designed for the eye so I thought that was the right product.

For this current iteration, I take it you deleted the data that was too deep from the 2020 16-bit depth map, and then used something like the map function from Colors > levels to map to the correct range.

What I don't get is that the GIMP r channel of the current depth map shows basically 255 and 0 in the histogram = i.e. 0 pixels between 0.001 and 0.999 - there's and nothing in between (img). The alpha channel, which is not used in the shaders, has some content. When viewing both channels in GIMP it looks better, as one is an alpha, but the shader just sees two sets of info channels and it's upto the code to use that info. Something probably went wrong with whatever setup you have that is limited to producing 2 channels instead of one - so the texture is effectively in 16 bit (from 2 channels), but is smaller as compressed PNG as a lot of it is blank.

BUT for the moment there is some great improvements to ocean colour, lakes, and the sim works (these are low risk changes that only affect color visuals) - so it can be left as is for a while - and someone other than Eric can deal with the depth data bugs at some later point to preserve his sanity at GIMP not working (e.g. me - if the 2020 16 bit texture is a simple conversion, and the ranges or other details are available, I can convert it ). (I guess a take away is it also helps to add comments about the units, spaces, and expected ranges to the shader in cases like these - so this type of thing is very straightforward, without needing to dive into history.)

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

Re: Why do my water always looks so greenish

Postby benih » Tue May 11, 2021 2:48 pm

Great, thank you!

Looks god again :)
Image
User avatar
benih
 
Posts: 1688
Joined: Tue Aug 15, 2017 10:34 am
Callsign: D-EBHX
Version: next
OS: Debian Linux 64bit

Previous

Return to Scenery

Who is online

Users browsing this forum: No registered users and 8 guests