plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


question

HybridNZ avatar image
HybridNZ asked rhumbaflappy answered

Proper water exclusion and ocean transperant masking (water mask tools)

We need a way that is documented to add transparent maks to ocean water revealing the aerial ortho data but retaining the ocean water properties.

Currently using exclusion and placing other water polygons overlapping doesn't work with wind and waves but appears to be the only way this can be done. Its a bit of a hack and has many issues.

Could we please have clear documentation on how this is achieved using the same way asobo has done as St Barthélemy airport / island.


scenerydefaultdevmodedocumentation
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

FlyingRaccoon avatar image
FlyingRaccoon answered

Hello HybridNZ,

You should be able to achieve this result by:
- defining an exclusion polygon to remove the water body and reaveal the underlying aerial
- add a custom water polygon on top of that

This way you can have the water effect with the imagery in transparency.

Does this answer your question?

Regards,
Sylvain


10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

HybridNZ avatar image
HybridNZ answered SpritelyNZ edited

Hi,

Ive tried what you said exactly and in many different configurations and it doesn't work unfortunately as below.

untitled.jpg


untitled.jpg (1.8 MiB)
4 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

FlyingRaccoon avatar image FlyingRaccoon ♦♦ commented ·
Ok I see what you mean. I was trying on a smaller area and my water polygon was not fully opaque. I'll keep investigating but I don't think we can find an easy workaround using the polygon system and would need an improvement of the CGL asset type to be able to do this.
0 Likes 0 ·
HybridNZ avatar image HybridNZ FlyingRaccoon ♦♦ commented ·

Thanks Sylvian for giving a tiny bit more insight in the SDK Q&A. It probably confirms that an airport such as St Barthélemy / island is using some outside of the editor method to achieve water/ocean transparency.

Side note, you carried yourself very well in the Dev Q & A and I really enjoyed your feedback during the session to provide another perspective to some of the answers.

Keep up the good work team.

Cheers

Josh
NZA Simulations.

2 Likes 2 ·
FlyingRaccoon avatar image FlyingRaccoon ♦♦ HybridNZ commented ·
Hi Josh and thank you for the kind comment.

Glad you enjoyed the Q&A session and I hope we can keep providing useful information to you that way.

Regards,
Sylvain

1 Like 1 ·
Show more comments
Paavo avatar image
Paavo answered Paavo edited

Water polys seem broken and the approach suggested by FlyingRaccoon does not work.

Here's an example based on EEKU. There's an excessive sand bar a few kilometers north-east of the airfield (N58.156329 E24.02775):

sandbar-1.jpg


If I simply attempt to cover it with water, then it introduces an artifact (as expected, because overlapping water polys are not allowed):

sandbar-2.jpg


If I try to use the previously described method of exclusion + custom water on top, then exclusion works as expected:

sandbar-3.jpg


However, it's back to the start when I try to add water on top of it:

sandbar-4.jpg


And I cannot add second water poly either to force water, because overlapping water polys are not allowed and cause artifacts:

sandbar-5.jpg


So how can I cover the sand bar with water?

It looks like stock terrain is taken into account when summing polygons for the final water value (render or no render, as described in the SDK), which breaks third-party customization.

I believe this is a bug. Stock water polygons under excluded areas should not be included in the final water value, because otherwise we cannot add custom water polys over excluded areas.

In any case, this point system seems too complex. It would be much better if we could just use absolute exclusion polys that always remove water, and absolute water polys that always add them, with overlapping allowed for both types.



sandbar-1.jpg (55.2 KiB)
sandbar-2.jpg (140.9 KiB)
sandbar-3.jpg (152.2 KiB)
sandbar-4.jpg (108.2 KiB)
sandbar-5.jpg (144.2 KiB)
2 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

FlyingRaccoon avatar image FlyingRaccoon ♦♦ commented ·

In this case, just add a water polygon over the sand bar and use a different water type.
It doesn't cause the artifact and the shader applied is the same as on the surrounding water

1623420954309.png

0 Likes 0 ·
1623420954309.png (2.6 MiB)
Paavo avatar image Paavo FlyingRaccoon ♦♦ commented ·

My situation was a bit more difficult: the goal was to replace all water around the island (and within) with custom polys derived from LIDAR data.

Initially my approach was:
- Exclude all types of water in work area.
- Add new water with WASTE_WATER (rarely used in stock terrain → low risk of artifacts).

This worked, but caused loss of waves.

Using your tip about water polys keeping their type, I modified the approach:
- Exclude water only in land mass.
- Add new water with WASTE_WATER.

This uses many complex polygons and feels hacky, but works.
Can I use it? Do you see anything wrong with it?

0 Likes 0 ·
kcai avatar image
kcai answered Losco_Nosciuto commented

Since Asobo can not fix all water mask around the world in a short time. Why not open this possibility for DEV. Please.

6 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

FlyingRaccoon avatar image FlyingRaccoon ♦♦ commented ·
Improving the CGL system to support this kind of edition is tricky and is a long term objective.
0 Likes 0 ·
Paavo avatar image Paavo FlyingRaccoon ♦♦ commented ·

Even something as simple as an additional water type limited to 50% transparency (eg SHALLOW_WATER) would be a huge step forward. We could draw such water polys over shallow waters to show the underlying aerial imagery.

1 Like 1 ·
Pasha avatar image Pasha FlyingRaccoon ♦♦ commented ·
If I may ask, how Asobo devs currently create water masking? I'm not asking for tutorial/step-by-step lesson, it's more like a general idea of how this actually works. I've searched inside SDK there are no effective way to do that. Even if that means creating mask via multiple lines of program, I'm sure there are devs out there that can create and provide external tools
0 Likes 0 ·
FlyingRaccoon avatar image FlyingRaccoon ♦♦ Pasha commented ·
For now, we are using dedicated tools to edit georeferenced data and that applies to water masks. This data is then uploaded to Azure and streamed to your game. Obviously, that's not something we can include as is in the SDK and the terraforming and polygon tools in the scenery editor are workarounds to allow you to perform some edition but with limited capabilities compared to what's possible with the raw data.

But as @Paavo suggested, we are checking how we can improve the current system so that you can realize more complex editions.

4 Likes 4 ·
Show more comments
Pasha avatar image
Pasha answered SpritelyNZ commented

One of the way to do it is creating thin stripes of water polygon, but the problem is the reflected light is like zebra pattern (following strip size). It really helps when we can create transparent water from inside SDK, just like Asobo did with official water masks. I found out that water masking was done via CGL, further confirmed by a post somewhere I found in past (using older file will enable water masking in release build) but currently haven't had the knowledge on how to decompile CGLs

3 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

HybridNZ avatar image HybridNZ commented ·

This was in the original problem statement as the hack way to do it but doesn't work properly with other sim variables.
Keen to see your results on the old post.
While we wait for official documentation/support on this issue.

0 Likes 0 ·
Pasha avatar image Pasha HybridNZ commented ·
Actually it wasn't my result, just me found out someone said they successfully reverting the removed water mask that Asobo shown in trailer. I'm also waiting for official support
0 Likes 0 ·
SpritelyNZ avatar image SpritelyNZ commented ·
There's a tool over on fsdeveloper.com called bgldec as it can decompile cgls for msfs now. Sorry I don't have the link but shouldn't be hard to find.
0 Likes 0 ·
soakco avatar image
soakco answered FlyingRaccoon commented

Hello,

Has there been any update to this? Water masking is a major feature that us Devs would love to have!

1 comment
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

FlyingRaccoon avatar image FlyingRaccoon ♦♦ commented ·
Hello


No update yet and don't expect one soon. This kind of feature might seem simple but it has a lot of technical implications that will take time to solve.

In the meantime, It seems there's no ideas posted about that particular feature. You should create one so that people can upvote it.
Be sure it'll be taken into account when trying to prioritize the development of the upcoming features.

Regards,
Sylvain

1 Like 1 ·
rotornut44 avatar image
rotornut44 answered HybridNZ commented

Took the initiative to add this as an idea so that it could be voted on. You can find that here:

https://devsupport.flightsimulator.com/idea/1563/proper-water-masking.html

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Sasa avatar image
Sasa answered Sasa edited

Still trying to shed some light on this topic and wrecking my brain trying to make sense of it:

I'm trying to create a clean slate for a coastal area excluding ALL water polygons.
From what I understand from above this is still not possible and exclusions are only possible INSIDE the existing water polygons. Correct?
The water polygons used in my area of interest seem to be from Openstreetmap (OSM). So this is not perfect and comes with the risk that the excludes won't match anymore once anything happens that causes MSFS to update the water polygons in the area.

Of course this rules out the option of drawing the exclude polygons by hand inside MSFS but requires some in-depth work with GIS tools.

For a starter working with OSM polys seems to work "good enough" though. I'm tiling the polygons before exporting them to QMID15 to minimize the risk of incomplete polygons and artifacts. Still there are some polygons that cause artifacts. Loading the SHP in Scenery Editor shows some issues that are not documented anywhere:

While most polygons are shown file, there's a number of polygons that are either tagged as "OVERRIDE" or "OVERRIDEN":

1639663908020.png

The tags I'm using for all polygons are as follows:

1639648870110.pngTrying to make sense of which polygons are tagged as what doesn't help much neither:

1639648976981.png

YELLOW: OVERRIDEN
RED: OVERRIDE
ALL OTHERS: No Tag

Questions:

1. What do the tags "OVERRIDEN" and "OVERRIDE" mean? What needs to be done to make the polygons valid?

2. Where can I find the waterbody sources of MSFS? TMFViewer from the previous MS FSX SDK can still open the waterbody BGLs created by the MSFS SDK. I have been unable however to locate the MSFS default waterbody BGLs (provided they are saved as BGLs?)


1639648870110.png (61.9 KiB)
1639648976981.png (1.8 MiB)
1639663908020.png (224.9 KiB)
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Sasa avatar image
Sasa answered

UPDATE... weirdly enough I have been able to solve the issue above by manually drawing the exclude polygons inside MSFS and saving them as shapefiles there (one for lakes, one for ocean water). In that case the exclude polygon doesn't need to match the existing water polygons and can overlap the default polygon's boundaries.

It seems that MSFS uses some kind of proprietary format for shapefiles as compiled shapefiles created inside MSFS behave very different to those with the same attributes and XML definitions created in QGIS, Global Mapper and the like (tried both and on both cases the results inside MSFS look similar as above).

Best case scenario though would be that it's not proprietary and someone could just give us a push into the right direction. Meaning a hint what's required to import existing watermask polygons (or polygons in general) into MSFS. Since Asobo imported OSM polygons into MSFS there must be a way to bring in polygon content from outside into MSFS without having to struggle with messed up imports.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

superspud avatar image
superspud answered superspud edited

image-2022-01-22-040633.png

I've given up on polygons for this, but it has been possible to use a texture with an alpha channel floating on top of the surface as some other developers have already done.

I had to make it a simobject to show up, as a normal object it wouldn't outside of development mode for some reason.

However it has to be a very silly height above the surface - 10 to 20 metres and sometimes more - to prevent it from flickering from a distance.

Since this one is so huge - about 20 km across - 20 km of flickering isn't a great look.

I presume this is some sort of alpha channel issue. Does anyone have any idea how to stop it or are we stuck with it? Not much point in taking it any further unless I can cure the flickering.


10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.