complicated contours with clipping planes?

Hello Togheter

I insert a 3D file (KTX) into a 3D terrain with 3D houses. Now the model should be displayed and the underlying 3D houses should be hidden. Otherwise the visualizations overlap.
now my idea is to take the basic contours with clipping planes. but the 3D model has complicated contours because it was generated with a drone and rendering program.
Since I’m new to cesiumjs I need your advice. my question:
Is this possible? As far as I can see, only straight contours are possible?
if so with which code?
Enclosed you can see a partial excerpt.

I am not sure what you are trying to achieve. Can you provide a Sandcastle?

Have you tried combining several clipping planes, and setting unionClippingRegions on their ClippingPlaneCollection?

@anneg It sounds similar to what is shown in the Clipping Regions Sandcastle.

(In fact, one reason why clipping regions/polygons have been introduced is that manually assembling such regions from individual clipping planes is a bit tedious. People always wanted that functionality where they could throw in some polygon, and have everything inside/outside of that polygon clipped away…)

Now it looks like we’re on the next level: Where does that ‘polygon’ come from?

That Clipping Regions Sandcastle casually says

// Add a clipping region covering total lot
const polygons = [
  new Cesium.ClippingPolygon({
    positions: Cesium.Cartesian3.fromDegreesArray(
      [
        [-105.0077102972673, 39.75198671798765],
        [-105.0095858062031, 39.75049417970743],
        [-105.00969000114443, 39.75035082687128],
        [-105.00972838875393, 39.75013579705808],
        [-105.00971742086537, 39.74997136204101],
        [-105.00962967775735, 39.749768979944236],
        [-105.00932806082336, 39.74928832007956],
        [-105.00887837739427, 39.749444324087904],
        [-105.00854934073887, 39.749663572365904],
        [-105.00822578802776, 39.749967145754084],
        [-105.00715641889735, 39.751312128419926],
        [-105.00715641889735, 39.75135429046085],
        [-105.0077102972673, 39.75198671798765],
      ].flat(2),
    ),
  }),
];

And one can imagine that for a complex-shaped tileset, it’s impossible to manually figure out these coordinates.

Right now, I’m not aware of any tooling to support that. It could be possible, with reasonable effort, to offer some sort of functionality for visually generating that polygon. A 5-minute-solution (somewhat quick&dirty) would be to take the Drawing On Terrain sandcastle, draw around the loaded tileset, and just dump out the polygon coordinates to the console.

One could also imagine some form of automated tooling for that. Maybe something implemented on top of the 3d-tiles-tools. But that would require a bit more time and effort.

(An aside: Note that Clipping Polygons have some performance issues for polygons with many points, so one might want to try and “simplify” the shape as long as the error is not too large…)

1 Like