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.