How to flat the overlap area between a polygon and a 3D tiles to a specific height?

I was trying to implement a feature that is to flat the overlap area between a polygon and a 3D tiles to a given height but didn’t make it.

Flat a 3D Tiles

Cesium provides the clipping plane feature to trim the 3D Tiles which is very much similar to what I want to implement. The difference is that the clipping discards all the vertex but in my case, I want all the vertexes to be set in the same z value.

Therefore, I tried to modify the z value of there discarded fragment in the clipping shader. However, many errors came up with any of the changes I made.

Welcome to the Cesium community @ercs!

Is that gif you posted running in Cesium? There’s nothing built-in to do this, but your approach sounds reasonable. What errors did you get? Are you able to post an example or a link to your CesiumJS fork with these changes?

Thanks! @omar
What the GIF shows is that I am trying to implement. So far, I didn’t manage to achieve the feature. And I would love to share that example and source code if I make it.

So is the GIF from a different software, not from a Cesium app? I am curious to know a bit more about your use-case, is your goal to replace the buildings by flattening certain areas and adding different models on top, or something else?

Yes. It is built on Cesium.js lib. The user-case is very much like what you mentioned. It is mostly used in city planning. User needs to flat an area to place a new build model. Then save the scene as a workspace for comparing with the previous scene, or cruise viewing like the sight of a drone.

Great! Are you able to share how this was created so others in the community who may be interested in the same use cases can use it?

Just read this message. I just know that feature is built on Cesium.js Lib, but currently I don’t get a chance to try it. I would love to share it once I make it.

Any update on this? Have used this feature regularly in other applications. As you said, it is quite important in urban planning. We have recently moved to Cesium but have not been able to recreate a similar function. Would love to see a working example. It kills me that I have to create new tilesets with flat areas over and over again…