# Quantized-mesh format with water mask

**URL:** <https://community.cesium.com/t/quantized-mesh-format-with-water-mask/25537>\
**Category:** Cesium for Unreal\
**Created:** [July 21, 2023, 4:22pm UTC](https://community.cesium.com/t/quantized-mesh-format-with-water-mask/25537 "2023-07-21T16:22:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gfrontera](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gfrontera/32/14037_2.png) [@gfrontera](https://community.cesium.com/u/gfrontera)\
**Post date:** [July 21, 2023, 4:22pm UTC](https://community.cesium.com/t/quantized-mesh-format-with-water-mask/25537/1 "2023-07-21T16:22:30Z")

</div>

I have created a tileset of quantized-mesh terrain, in which I have added water masks according to [the specification](https://github.com/CesiumGS/quantized-mesh). However, in Unreal Engine 5 with a Cesium 3D Tileset, tiles are either rendered as all-water or all-land. This is expected for tiles where the mask is just 1 byte, but for those where the mask is 256\*256 bytes, I would expect the water material to render only some portions of the tile as water (following the values of the mask). I am using the default MI\_CesiumThreeOverlaysAndClippingAndWater material for water.

Is the linked specification up to date? How can I make Cesium for Unreal render only portions of the tile as water?

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [July 23, 2023, 11:02pm UTC](https://community.cesium.com/t/quantized-mesh-format-with-water-mask/25537/2 "2023-07-23T23:02:45Z")

</div>

Yes that spec should be accurate. Is Cesium World Terrain working as expected for you? If so, take a working Cesium3DTileset and change just its URL to point your tileset. Don’t change the materials or any other settings.

If that still doesn’t work, check if your tileset works in CesiumJS. If it works there but not in Cesium for Unreal, please send me a small terrain that has the problem, and I’ll take a look.

If it doesn’t work there, either, I suggest stepping through the water mask loading code in either CesiumJS or Cesium for Unreal (both are open source) and see where it’s getting tripped up by your tiles.

---

<div class="post-metadata">

**Author:** ![gfrontera](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gfrontera/32/14037_2.png) [@gfrontera](https://community.cesium.com/u/gfrontera)\
**Post date:** [July 25, 2023, 6:04pm UTC](https://community.cesium.com/t/quantized-mesh-format-with-water-mask/25537/3 "2023-07-25T18:04:25Z")

</div>

Thank you for your answer!

Cesium World Terrain works as expected for me, and changing the URL to point to my tileset did indeed solve the issue!

This made me wonder what exactly the issue was. I created a “Cesium World Terrain + Bing Maps Aerial Imagery”, then enabled the water mask. This made the water mask render correctly (see image below).

 ![coastline-nice](https://global.discourse-cdn.com/cesium/original/2X/0/0bdc94b2f02c07c943d37ad13ca6845cc1613cd4.jpeg)

Then I deleted the “Bing Maps Aerial” component from the actor, and clicked the “Refresh Tileset” button in the “Cesium World Terrain” actor. And there is the problem again, water masks are no longer considered (see image below, which corresponds to the same view as the image above).

 ![coastline-not-nice](https://global.discourse-cdn.com/cesium/original/2X/2/2e2f0035b6430a887dd227c538109ba5ccc391ee.jpeg)

The underlying problem seems to be that the default material does not render water masks correctly when there is no raster overlay attached to the actor. Is there any easy fix to this? We’re not planning on using any textures on terrain.

---

<div class="post-metadata">

**Author:** ![Kevin\_Ring](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/kevin_ring/32/2003_2.png) [@Kevin\_Ring](https://community.cesium.com/u/Kevin_Ring)\
**Post date:** [July 26, 2023, 6:00am UTC](https://community.cesium.com/t/quantized-mesh-format-with-water-mask/25537/4 "2023-07-26T06:00:47Z")

</div>

I can reproduce the problem you’re describing @gfrontera, and I agree it’s a bug. I wrote up and issue for it:

> <https://github.com/CesiumGS/cesium-unreal/issues/1176>
>
> As reported here:
> https://community.cesium.com/t/quantized-mesh-format-with-wat…er-mask/25537
> 
> 1. Open the first Cesium for Unreal Samples level in San Francisco.
> 2. Move the camera somewhere near the coastline so you can observe the water effect.
> 3. Remove the Bing Maps Aerial raster overlay component from the Cesium World Terrain Actor. The water effect should still look the same as it did before.
> 4. Click Refresh Tileset on the Cesium World Terrain Actor. Now the water mask will be broken, with entire tiles showing either water or no water, without any coastline effect.

---

<div class="post-metadata">

**Author:** ![gfrontera](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gfrontera/32/14037_2.png) [@gfrontera](https://community.cesium.com/u/gfrontera)\
**Post date:** [August 14, 2023, 10:55am UTC](https://community.cesium.com/t/quantized-mesh-format-with-water-mask/25537/5 "2023-08-14T10:55:14Z")

</div>

In case anyone else runs into this problem, I found a workaround. By simply adding a CesiumDebugColorizeTilesRasterOverlay, the water masks will behave as expected. Any Raster Overlay would do, but I found this to be the simplest one available, and it works offline.

---

<div class="post-metadata">

**Author:** ![Aankit\_K](https://avatars.discourse-cdn.com/v4/letter/a/b19c9b/32.png) [@Aankit\_K](https://community.cesium.com/u/Aankit_K)\
**Post date:** [February 4, 2025, 11:41am UTC](https://community.cesium.com/t/quantized-mesh-format-with-water-mask/25537/6 "2025-02-04T11:41:51Z")

</div>

> [@gfrontera](#):
>
> I have created a tileset of quantized-mesh terrain

how? using cesium ION or you have any custom solution build inhouse? can you share how did you included the watermask extention in the terrain. Thanks

---

<div class="post-metadata">

**Author:** ![gfrontera](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/gfrontera/32/14037_2.png) [@gfrontera](https://community.cesium.com/u/gfrontera)\
**Post date:** [February 4, 2025, 4:23pm UTC](https://community.cesium.com/t/quantized-mesh-format-with-water-mask/25537/7 "2025-02-04T16:23:02Z")

</div>

Hi Aankit. If you haven’t already, please check this repository:

> **[GitHub - ahuarte47/cesium-terrain-builder at master-quantized-mesh](https://github.com/ahuarte47/cesium-terrain-builder/tree/master-quantized-mesh)**
>
> master-quantized-mesh

Although it still has a bug which makes some terrain normals not being correctly generated, this project will allow you to generate your tileset from GeoTIFF data. If your data is not in GeoTIFF format, you may want to take a look at GDAL tools (such as `gdal_translate`) to make this conversion.

The tileset generated by this method will not contain water mask information. We added this using an in-house solution. Fortunately, the specification for water masks is quite simple and it wasn’t too hard to implement.

You may also want to check out this repository for further resources:

> **[GitHub - bertt/awesome-quantized-mesh-tiles: Awesome implementations of the quantized mesh...](https://github.com/bertt/awesome-quantized-mesh-tiles?tab=readme-ov-file)**
>
> Awesome implementations of the quantized mesh tiles specification
