Water Mask and .terrain files

I have a need to run everything locally.
Atm I am running a geoserver and a terrain provider server.
I am using this terrain provider server: GitHub - geo-data/cesium-terrain-server: A basic server for serving up filesystem based tilesets representing Cesium.js terrain models
I have generated all the tiles using GitHub - tum-gis/cesium-terrain-builder-docker: Dockerfile for the geo-data/cesium-terrain-builder app with quantized mesh support.
The problem I have is that I need to generate a water mask or at least be able to emulate a water surface. As I will be displaying ships traveling from different harbours - and I don’t want them floating in mid air. I would also like to keep my bathymetry data and not just zero it out.

How would I be able to solve this? Once again, everything has to be able to run locally and I cannot upload my bathymetry data files to a third party server.

It leaves me thinking:

  1. Just generate a huge globe around the earth which would be the water.
  2. Using python and struct edit the .terrain files generated by cesium-terrain-builder-docker, which is a tricky and decently huge undertaking.

Are there any other ways I could solve this? Either in the JS used to display, or in C++ for the terrain builder?
Any who, been fiddeling around with this software much less than most of you guys so would appreciate if you could share some knowledge on how you solved water masks or emulate a water mask.

Hi @Maximilian, welcome to the community!

The water mask is usually generated at the same time as the tiles. If the tile server provides water masks, then you can use them in the terrain provider by setting the requestWaterMask flag in the CesiumTerrainProvider constructor.

If you are using cesium-terrain-builder to generate the tiles, you will need to reach out to the maintainers about their support for water masks—this tool is not a Cesium product, so I can’t comment on it.

Alternatively, Cesium’s own Terrain Tiler (a paid product) can compute the water mask for you. All of our tilers can be run on-premises if you need to keep your data local.

Leaning towards running your Terrain Tiler - the question I have is:
Does it support Bathymetry data? I.e can I have a water mask and fly below the water surface to see the bathymetry? Can I add a transparency index to the water mask and see below the water surface?

Or will the watermask be drawn on the bottom of the sea? Is there a way to normalize so that the watermask is drawn at zero elevation or -0.5 meters elevation?

My other way would be to directly edit the tile files using python and struct and adding the water mask manually to each tile (binary). Do you know if there are any github repos dealing with this? Because I have tried to read the quantized tile binary information but having some troubles actually dissecting the files correctly.

Hi @Maximilian,
I don’t think we have anything out-of-the-box that would support flying below the water mask.

One option would be to generate a separate geometry for the water surface. Depending on your accuracy needs, you could use an ellipsoid, or a custom mesh representing mean sea level. This geometry could then be rendered as translucent.

As for editing the quantized tiles, I can imagine this would be difficult. If you haven’t seen it already, you may want to look at the format specification: GitHub - CesiumGS/quantized-mesh: Specification for streaming massive terrain datasets for 3D visualization.

By the way @Maximilian, what you are building sounds very interesting.
If you do manage to get a bathymetry + water surface rendered together, and are able to share at least a minimal version of it, I am sure many people here on the forum would be excited to see it!