clipping plan on 3dtileset problem

815 views
Skip to first unread message

Cherry

unread,
Feb 14, 2019, 10:16:18 PM2/14/19
to cesium-dev
When you click two point on viewer, the globe will be dug a hole. In my case, I want to dig a hole on 3dtileset, too. But in the follow code, 3dtileset didn't work, how should I do?

Omar Shehata

unread,
Feb 17, 2019, 9:07:08 PM2/17/19
to cesium-dev
This is because clipping planes are relative to the root tile's transform. This is described on the documentation page:


So for example, if you set the the clipping plane at (0,0,0), with a normal facing in the positive X axis, it would clip half the tileset (wheras the same plane would clip half the globe). The easiest way to get a plane to clip a tileset and the globe in the same location is to add a modelMatrix to the ClippingPlaneCollection on the tileset to reverse this transformation to make its coordinate relative to the center of the earth:

tileset.clippingPlanes = new Cesium.ClippingPlaneCollection({
        planes
: clippingPlanes,
        edgeColor
: Cesium.Color.WHITE,
        modelMatrix
: Cesium.Matrix4.inverse(tileset.root.computedTransform, new Cesium.Matrix4())
   
});

You might also want to use viewer.camera.pickEllipsoid instead of pickPosition to get more accurate results when not using terrain. 

clara...@gmail.com

unread,
Jun 5, 2019, 8:42:43 AM6/5/19
to cesium-dev
Hello,

I have been trying to adapt this sandcastle so that the user can draw the hole as a polygon and therefore cut the 3Dtileset in any shape he wants, but I can't get it to work. I've only changed the "hole" function.

Is this because clipping planes are not supported (except for rectangles and triangles) ?

Many thanks for your response, I'm really stucked on this one!

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html#c=pVZ/b9s2EP0qQoCh8iLQCdoOReIG82wvMZp1gW1sGOIiYKSLRJQiBZJy4gb+7jtSPyzJdpp1/sci+e7du+MdyRVV3orBIyjvoyfg0RuBZnlK/nJz/pvQDUdSGMoEqDe986VYoY1hHDSYtlHx93a8KBb956VYmlzxswowlWIGWuYqBPKgZDrUCJtG/of3v7zrBRatE/l45hmVgxtGa0FTFs5DBSDmGQ1hopRUXg3x8Nfvp/SJpXnahZ15p0uxcZJdOESHIIBkiqXMsBVoQqPIL0NpwL5JmS5kc8G6QT0u9ISKiHfz1XS9Am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2019, 5:11:36 PM6/5/19
to cesium-dev
I think it just might be that that original example was computing the planes based on the assumption that it will always describe a rectangle. You can certainly have a combination of many clipping planes to describe more arbitrary shapes. Here's a Sandcastle example showing this:


You might also find this thread useful which was doing a similar thing, clipping planes made out of arbitrary polygons:


Although the tileset in the examples seems to no longer be accessible. 

clara...@gmail.com

unread,
Jun 7, 2019, 8:46:02 AM6/7/19
to cesium-dev
Hi Omar and thank you for your response, with both examples I managed to make it work!

If anyone is interested, here is the updated Sandcastle that lets the user cut the tileset in any (convex) shape he wants:

https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html#c=pVdtb9s2EP4rWobB8qrQfUmHwkmLpYnXBkvbIM62D3UR0NJFJkKRAkm5cYv89x1J0aZs56WbgSAS+dzdc288aiIGgzEVRU614XD5FkomJmJOVTJn8BVU8joR8DU5As2aivzt1tJe7l6PpDCUCVC9/r6XMYyDBtMV8v9eHF/4zfT7RExMo/gwAE6kOActG5UDuVKyOtQIOynSVy9/2+tnFq1n8uswMaoB91osBK1YPs4VgBjXNIeRUlIlS8itI+TIEp2DAFIrVjHD5qAJLYq0JRrBvklZXch4YzBIOAORVCCaVUg+yAI4OoheJPgrIJdNvbJs14ySDa5cUa4BuYTYSMmn1Aa0kHmDSg0pwYw42Me3C/S310JcONvYXAuZX8vGEKNofp0uGWyD0Lrmi7dMFEyUegXNgmkr47kUrLysJRM2U5+/tARnEgugNjpecyC7cl8wo1yfWfxZ2D6SnENumBRpf2V8huXG1ysrzuUcA/Leg9LWbk5RVFsdrTSxJSLqxhx6/VeN8A9gpfs2PbZSJsZaBKrM7ExqZhErZ3JagaKkZvn1iHNWa8kKL0/qFuxYt1q4FCUzTQFjozDCqCcUOKqXpaL1jOWugO0CblFkE1vuk6WKX1vRD9TMyPHo3floNL48G51fnh8enxx+jK1S83+Nthoetpm0P//kc+8y/D3shbhgeXesZAGQS+4aMbC0r+Sf9ycXI49wnbk00fZQqEZSN3oWl9PSpxfOxWMosUp0upaJrBujfmsC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