Multiple ClippingPlaneCollections for concave clipping polygons

Hi everyone

I find that clipping planes for globe and models can only cut a convex area.

What if I have a concave shape to clip?

My solution is to apply multiple clippingPlaneCollections.

So that I can triangulate the concave shape into triangles first, and then clip the area triangle by triangle with multiple clippingPlaneCollections.

However, modifying the source code is a little bit hard for me.

Can any help me with the idea?

Thanks

Chris

Hi,

Currently its not possible to have multiple multiple clippingPlaneCollections. We have started some work on clipping volumes, which you would be able to have multiples of per tileset, and either use a concave ro convex mode. Keep and eye out for that feature.

You can also try setting clippingPlaneCollection.unionClippingRegions to false, which will clip all regions outside any clipping plane.

Thanks,

Gabby

Hi Gabby, was this issue fixed?

Hi @clint,

Not yet. Please follow Add support for concave /convex clipping planes + holes in CesiumJS · Issue #8751 · CesiumGS/cesium · GitHub for updates.

Thanks!

Hi Gabby,

Do you know when it is likely to be implemented? I can see the initial request was from 3 years ago and it’s a very important feature for our projects. Thanks

Hi Clint,

We do not currently have this item scheduled to be worked on by the Cesium team. But we’re happy to review a contribution. It might also help to add a comment in the thread explaining your use case and why this feature is important to your project.

Thanks!
Gabby

Hi Gabby, we have a mining project as well as many architectural projects that require multiple clips of terrain. Reason: 1. To replace terrain with 3d building data of proposed developments 2. To clip lakes and sections of terrain to see below the terrain surface to view gas deposits and other underground data sets.

Hi Clint,

Understood. In the meantime, I have a few workarounds to suggest. We, as well as some other customers, have created CesiumJS apps addressing similar use cases and have a few different ways of dealing with underground data, or data which intersects terrain.

One way to address both of your points would be to use a translucency mask to define areas of terrain that should be discarded.

Besides translucency masks, it’s also possible to adjust the overall globe translucency value to show underground data as the user zooms in or out.

Specifically, for

  1. To replace terrain with 3d building data of proposed developments

it’s possible to change the rendering order so that scene data is always rendered in front with

viewer.scene.globe.depthTestAgainstTerrain = true;

Happy to discuss further how to make to make underground and intersecting data work best for your app.

Thanks,
Gabby

Hi Gabby.

Thanks for the info.

With transparency masks, are we able to create masks for specific parts of the terrain?

E.g. if we created different mask shapes, not just the rectangle shape shown on the demo?

Thanks,
Clint

Hi Clint,

If you use imagery, it can be any shape or any number-- In the demos this is shown with the oceans. But you can use any imagery and any color to create the mask.

If you use the rectangle, it c an only be a singe Rectangle object.

That’s great!

With using imagery to create masks on the base layer, would you use an asset uploaded to Cesium Ion typically to do this or another method?

Not sure if you have an example of the code that would be used?

Yes, uploading imagery to Cesium ion is the easiest way to do that. You can treat it like a typical imagery layer when uploading ion.

I’m not sure we have any example code for generating the imagery layer data if that is what you’re looking for. However, there should be plenty of tutorials online for doing so with traditional 2D GIS tools like QGIS or ArcGIS. For example here’s the process for masking raster imagery in QGIS.

Hi Gabby, our developer has mentioned the below if you’re able to assist?

‘Our Cesium ion layers are placed on top of the Global Layer, but they do not participate in the trasparency of the Global Layer. The ocean and rivers in the sandcastle example are not a separate layer on top of the global layer’.

Is there a way to use Cesium ion raster layers to affect the global layer, as it’s not possible to create a transparency mask otherwise? Image layer below for reference;

Hi Clint,

Not at the moment. You’ll need to mask out a base layer in QGIS or another software yourself.

Natural Earth Imagery is a lower-res but global dataset you can use which is shipped with CesiumJS in the Assets folder. There should also be other open source imagery datasets available online, including higher quality ones if you’d like to narrow into a few specific regions.