The clippingPlanes problem

os:win10(64)

chrome: 65.0.3325.181(64)

cesium:1.44

I used five 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)

When I dug a hole in the tileset.The effect looks like this.

And then zoom in

The cut came out again.And I tried the new version of the ClippingPlane, used with ClippingPlane objects instead of Plane.But there will be new problems,The dynamic change of distance or normal ,tileset doesn’t change

Hi there,

Can you provide your full code for setting up the clippingPlaneCollection? There’s not enough info here to see what the problem is, and I think it has to do with the reference frame.

Thanks,

Gabby

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)

];

var allClippingPlanes = [
var midPoint = self.viewer.entities.add({
position : midPosition,
point : {
pixelSize : 0
}
});
tileset.clippingPlanes = new Cesium.ClippingPlaneCollection({
modelMatrix : midPoint.computeModelMatrix(Cesium.JulianDate.now()),

planes : allClippingPlanes,

edgeWidth : 1.0,

edgeColor : Color.WHITE

});

``

在 2018年4月12日星期四 UTC+8下午10:27:42,Gabby Getz写道:

Yes, I think the issue here is modelMatrix. You are providing a the transformation matrix relative to world space.

If you remove it entirely, it should place the clipping planes relative to the tileset origin.

Otherwise, try Cesium.Transforms.eastNorthUpToFixedFrame(tileset.boundingSphere.center).

It’s already used eastNorthUpToFixedFrame when I compute the plane’s normal.The result of the graphic is correct

I guess if it is a problem with Multistage rendering?

The tileset is Tilt photography.There’s a problem when I zoom in.However, it’s good when I’m zooming out

在 2018年4月14日星期六 UTC+8上午4:35:25,Gabby Getz写道:

在 2018年4月16日星期一 UTC+8上午11:04:31,MR.Klien写道:

Got it, thanks for the gif, that’s a lot clearer. Looks like the clipping planes are not being correctly applied to the higher LOD tiles. Would you be able to post the tileset for us to take a look at?

The source file is too large, I cut part of it to upload.

tilesets demo

在 2018年4月17日星期二 UTC+8下午9:37:49,Gabby Getz写道:

Sometimes this happens

在 2018年4月18日星期三 UTC+8上午10:49:22,MR.Klien写道:

I started to look into this but could use some help in recreating the problem. Do you have the latest clipping planes code from your gif above? I also want to make sure the tileset you sent is the correct area. I attached a screenshot of what I see.

snippet.PNG

var scratchPlane = new Cesium.Plane(Cesium.Cartesian3.UNIT_X, 0.0);
function createPlaneUpdateFunction(plane, transform) {
return function () {
plane.distance = targetY;
return Cesium.Plane.transform(plane, transform, scratchPlane);
};
}

var tileset;
function loadTileset(url) {
var clippingPlanes = [
new Cesium.Plane(new Cesium.Cartesian3(0.0, -1,0.0), -10.0)
];

tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
    url : "../../../data/Tileset/Tileset1/tileset.json",
    clippingPlanes : new Cesium.ClippingPlaneCollection({
        planes : clippingPlanes,
        edgeWidth : viewModel.edgeStylingEnabled ? 1.0 : 0.0
    })
}));

tileset.debugShowBoundingVolume = viewModel.debugBoundingVolumesEnabled;
return tileset.readyPromise.then(function() {
    var boundingSphere = tileset.boundingSphere;
    var 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() {
                var boundingSphere = tileset.boundingSphere;
                viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.0, -0.5, boundingSphere.radius * 2));
                viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
        });
   

    for (var i = 0; i < clippingPlanes.length; ++i) {
        var plane = clippingPlanes[i];
        var 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);
});

}

``

I use the demo http://localhost:8081/Apps/Sandcastle/index.html?src=3D%20Tiles%20Clipping%20Planes.html&label=Showcases

The Plane situation

Then I replace Plane with clippingPlane

You need to pull far and try several times

在 2018年4月23日星期一 UTC+8上午4:18:02,Sean Lilley写道:

Thanks - I was able to confirm this is a bug. I opened an issue here: https://github.com/AnalyticalGraphicsInc/cesium/issues/6484.

Thanks again, this was fixed in https://github.com/AnalyticalGraphicsInc/cesium/pull/6486 and will be shipped with Cesium 1.45 on May 1st.

Thanks,I updated the code, the problem with the cutting function is OK,But sometimes still this error occurs

在 2018年4月25日星期三 UTC+8上午8:09:42,Sean Lilley写道:

Ah sorry we didn’t catch that one - I opened an issue on Github for fixing it: https://github.com/AnalyticalGraphicsInc/cesium/issues/6566.

MR.Klien - would you be able to test our fix? The changes are in https://github.com/AnalyticalGraphicsInc/cesium/pull/6576 and I’ve uploaded a Cesium build here: https://drive.google.com/open?id=1ieZ3NlgIA6OMGwXZWZCoWfHNhsj0k1z5.

I used this zip, but there is another problem……

在 2018年5月10日星期四 UTC+8上午12:53:51,Sean Lilley写道:

Thanks, we’ll look into it.

MR.Klein - does the crash happen immediately when the app loads or only after zooming in/out and moving the clipping planes around?

Also, are you able to reproduce this crash with any of the tilesets that we have in Sandcastle? Or are you able to share any other tilesets that have this problem?

Thanks!

you can use http://localhost:8081/Apps/Sandcastle/index.html?src=3D%20Tiles%20Photogrammetry.html&label=All

js code:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var tileset = new Cesium.Cesium3DTileset({
url: Cesium.IonResource.fromAssetId(3836)
});

viewer.scene.primitives.add(tileset);
viewer.zoomTo(tileset);

tileset.readyPromise.then(function(tileset) {
var clippingPlanes = [
new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, -1.0, 0), -100.0)
];
tileset.clippingPlanes = new Cesium.ClippingPlaneCollection({
planes : clippingPlanes,
edgeWidth :1
});
});

document.getElementById(“removeClip”).addEventListener(‘click’,function(){
tileset.clippingPlanes.removeAll();
});
document.getElementById(“addClip”).addEventListener(‘click’,function(){
var clippingPlanes = [
new Cesium.ClippingPlane(new Cesium.Cartesian3(0.0, -1.0, 0), -100.0)
];
tileset.clippingPlanes = new Cesium.ClippingPlaneCollection({
planes : clippingPlanes,
edgeWidth :1
});
});

``

html code:

@import url(../templates/bucket.css);
remove add

Loading...

``

first remove,and then add.

This problem arises when you zoom in and out

在 2018年5月18日星期五 UTC+8上午3:02:23,Kangning Li写道: