How to Switch As-Is Terrain vs. Cut/Fill Terrain in a CesiumJS App

There has been a long standing problem to visualize two different terrains in a CesiumJS app.

In CesiumJS API, I know that ‘CesiumTerrainProvider’ accepts only one terrain tileset in a viewer construct. Due to this, it’s known to be impossible visualizing two different tilesets in a single CesiumJS app session.

However, in many of customer use cases, there are frequent requests those need to overcome this limitation. For example, in a building construction site, let’s think about an as-is terrain. On the other hand, according to a construction plan, an uphill ground is going to cut. And, the customer would like to place a planned building tileset and compare the perspective views before and after the construction. In order to achieve it, how can I compare the terrains between as-is and the cut. A similar need exists for the fill terrain as well.

Could any Cesium staff or community members answer this question?

Many thanks in advance,

Hi @kschoi-cesium, here is a very rough overview of one way to solve this:

  1. Load the as-is terrain as your terrain tileset
  2. Cut out the terrain in the area of the construction site using Clipping Planes
  3. Load a Cesium3DTileset representing the surface of the cut or filled terrain
  4. Load another Cesium3DTileset for the building.

See the Terrain Clipping Sandcastle for an example of how to cut out a section of the as-is terrain. That example only places a Model entity in the cut out region, but you could place Cesium3DTilesets there instead.

Hi Jeshurun! Thank you so much for your reply. You light up me an insight that I’ve overlooked so far. To make your instruction feasible for my goal, I have a concern. Concerning Step 3 “Load a Cesium3DTileset representing the surface of the cut or filled terrain”,

I assume the surface be a batched 3D model tileset instead of a quantized mesh. This could be used for visualization purpose only… Is it correct?

What’s more, how can I create the batched 3D model of the surface where I only have a source data as a digital elevation model(DEM) format?

I would appreciate if I hear from you again.


Hi @kschoi-cesium,
You are correct that a Cesium3DTileset would not have all the functionality that we have available for quantized mesh terrain tiles. See the current open issues with the tag 3D Tiles as Terrrain.

I am not aware of how to tile a DEM as 3D Tiles—I am still looking into this.

Hi @kschoi-cesium, to answer your remaining question:
To tile a DEM as a Cesium3DTileset in Cesium’s tilers, you will need to convert it to a mesh first, and then upload it as a .obj or .fbx file. See the table of supported data formats.

Hi @jjhembd, thanks for your revisit to this thread. Though I appreciate your comment, I’ve been seeking any practical method that make your initial rough overview (1. 2. 3. 4.) become achievable. As a matter of fact, without DEM-to-Mesh converter which is ready to use, your suggestion doesn’t make sense in this regard. Is it fair to say like this? But, I still welcome any other suggestions.

Do you have a solution to deal with it? I encountered this problem.
I need to achieve this effect