1. A concise explanation of the problem you’re experiencing.
Previously we have been trimming our 3D-tiles in pre-production, but this is not always practical. We are attempting to implement cesium clipping planes to allow us to define areas to hide but have not been having much luck. Our ultimate aim is to draw a polygon, convert each straight edge into a vertical clipping plane and exclude from display that texture that falls outside the planes. Currently we are just trying to get clipping planes of any definition to work our 3d-tile dataset and regardless of what we try there is zero effect on the 3d-tiles. Below is an example… any help would be much appreciated
2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url : tile_url,
clippingPlanes : new Cesium.ClippingPlaneCollection({
planes : [
new Cesium.Plane(new Cesium.Cartesian3(1.0, 0.0, 0.0), 0),
new Cesium.Plane(new Cesium.Cartesian3(-1.0, 0.0, 0.0), 0),
new Cesium.Plane(new Cesium.Cartesian3(0.0, 1.0, 0.0), 0),
new Cesium.Plane(new Cesium.Cartesian3(0.0, -1.0, 0.0), 0),
new Cesium.Plane(new Cesium.Cartesian3(0.0, 0.0, -1.0), 0)
],
unionClippingRegions : true
})
}));
tileset.debugShowBoundingVolume = viewModel.debugBoundingVolumesEnabled;
return tileset.readyPromise.then(function() {
let boundingSphere = tileset.boundingSphere;
let radius = boundingSphere.radius;
// viewer.zoomTo(tileset, new Cesium.HeadingPitchRange(0.5, -0.2, radius * 4.0));
tileset.clippingPlanes.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(boundingSphere.center);
tileset.readyPromise.then(function() {
let boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius * 2));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
});
for (let i = 0; i < clippingPlanes.length; ++i) {
let plane = clippingPlanes[i];
let planeEntity = viewer.entities.add({
position : boundingSphere.center,
plane : {
dimensions : new Cesium.Cartesian2(radius 2.5, radius 2.5),
material : Cesium.Color.WHITE.withAlpha(0.1),
plane : new Cesium.CallbackProperty(createPlaneUpdateFunction(plane, tileset.modelMatrix), false),
outline : true,
outlineColor : Cesium.Color.WHITE
}
});
planeEntities.push(planeEntity);
}
return tileset;
}).otherwise(function(error) {
console.log(error);
});
``
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
4. The Cesium version you’re using, your operating system and browser.
1.55