Clipping only a portion of 3d Tileset

The clipping planes define a Half Space. They are only defined by a normal direction and a distance to the origin. The concept of “size” does not apply to them. They are basically “infinitely large”.

(You showed the rectangle in the screenshot. Yes, that’s that: A rectangle. This one does have a size. But this is only a visual representation for the clipping plane. It is not used for the clipping plane computations).

In order to define a “clipping shape”, you have to put multiple clipping planes into a ClippingPlaneCollection. With this, you can essentially describe a Convex Polytope.

The actual question here is somewhat similar to How to load only 3dtiles inside the polygon? - #7 by Marco13 . I had created an example sandcastle for the other thread, and just tweaked it for your use-case.

There are two sliders (defined in the “HTML body & CSS” tab). The first slider affects the size of a square. From the corner points of this square, 4 clipping planes are created. The second slider affects the height of another clipping plane. Together, these 5 clipping planes allow you to “carve out” something cube-shaped from a tileset.

(Sandcastle edited 2024-06-06 for new async API)

https://sandcastle.cesium.com/index.html#c=xVfdb9s2EP9XDn5Y5cWWpbZ5cZ1gidshBdomWLJ2Q5wHWmIsIhKpkZQdd8j/vuOHZMlR0wZ9GGDA5PG+70feKRFcaVgzuqESjoDTDcypYlURfra0YDFI7H4uuCaMU7kYDN8s+IJPJjCXlGgKBMqccPzXoDMKCeUalS2p3lDKLWnF1rgqBeNajazohukMBbmQBcndCeMrWAwkW2V6MYBAZ0wBUaoqqEIlTrmVbWsDIikwZ+Wvv50jwwW/rXiimeCQWBcvDDkooxGU8RD+XXCAxAbufT2qg54TqXFF+Kswp7L0IiOIwsNROzk7vmBo0lHryzFDb5mkznifWlUttSSJDowQGOV+EfnFN6yYw7Yll7m2rX5Bp7TjV7j1psZd8r0nR/u2bFY/uVL1xeR8YV+pt7bn2/MCc1hqzNjShbdSFBem4M6LwNVt1PbM6ZBUV5I7OhIe9pG6RGBkIG4hyVlZGshZVgXGQgerihnfPVyXRNEUhMOZ89BCEiHqEJY6RLfgBrdCWllK0GJJmDRmHWofAXTuvbGS6ncbrXcgaFzpIrcjgfm6vrEJQKsQ5BRdQ1r0Bv9mu2AQ1HyFbo4hxpODA6+xSX2EMg3zNXMam9O4ewoH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x1O8B1HbEj76L3pf7TPp/us3IPcR5jvu0bfr8M9xyXtBBrepLnwXA3IfuStL8EOhPeN7WZGSRpP/W9LzyeD0aDmdLbnB4b3t9YUQqpoZJ5EIYTjUNYjmJqsqySO2NFWYTPJrXILGVrYOlRz/c3eozfxXhyW+W5yelicDybIH9HLBd29jlfU5mTrWHJ4uMPjhiG4WyC28dSTb+2Xs+06YfHLiEzbQaf47oZzrRs1maXHr9zzzi4dxxsQuBkNsGjLuNuh3vGywrRui0pmnfNbWAuEO7w7TVrco9r2w1wh5NQaY9i3GDmyXiJAwRSbOec9vWSkeuqDktTeGEtvvAhei/aTuJGPjfM0/89zNOfCBOXTW1x7Yteo2PB/wM

You’ll probably have to tweak and adjust that as well, for example, to create a rectangle (from width an height) and not only a square. But the example should already show the general approach of using 5 clipping planes to define the area that is supposed to be cut out here.