Clipping Planes and external tilesets

Hi,

I am trying to use clipping planes on tilesets that are organized as follow :
- a master tileset which references several external tiles as children.
- the master tileset has no defined transformation (identity).
- the different transformations are defined at child level in the external tileset or below if the child is also a sub master tileset.

Using the clipping plane example from the sandcastle on such dataset:
-When trying to apply a clipping plane to such tileset, the entire tileset is "hidden".
-When the clipping plane is applied on one of the child, it's is working.

I have build a small dataset based on a master tileset and an external tileset as a single child. If the transformation is defined at the master level and not into the child, it is working but not in the opposite case. I can share the test data if needed.

Is there some restriction on the way to use clipping planes with external tileset or it should be considered as a bug ?

Releases:
Cesium 1.45
Chrome Version 66.0.3359.139

Best regards,
Pascal

Hi Pascal,

There shouldn’t be any restriction on using clipping planes on tilesets with external tileset children. If you could provide a Sandcastle example reproducing the issue, I can take a look and open up an issue in GitHub if needed.

Thanks,

Gabby

Hi Gaby,

I have investigated more the issue I face. By the end, it seems to be related to the way the clipping planes collection is defined and how it is applied on the contents.

The modelMatrix of a clippingPlaneCollection is composed with the modelViewMatrix of the contents to clip.

My understanding is that can lead to clipping issues when it the tileset there are several branches with some dedicated embedded transformations ( in external tilesets or at tile level).

In my use cases, I need to clip tilesets ( see below) by a set of clipping planes defined from a position on the globe.

I have quickly done the following update of the code to test my understanding:

model.js

var inverseModelMatrix = Matrix4.inverse(model._modelMatrix,scratchClippingPlaneMatrixA);

var clippingPlanesModelMatrix = Matrix4.multiply( inverseModelMatrix, clippingPlanes.modelMatrix,scratchClippingPlaneMatrixB);

return Matrix4.multiply(model._modelViewMatrix, clippingPlanesModelMatrix, scratchClippingPlaneMatrix);

instead of

return Matrix4.multiply(model._modelViewMatrix, clippingPlanes.modelMatrix, scratchClippingPlaneMatrix);

and similar update in PointCloud3DTileContent.js

However, now it require to define the modelMatrix of the clipping planes collection relatively to the associated item (master tileset or model).

There are perhaps a better way to fix it in the code to reduce the number of matrix functions calls.

Let me know, and I will push the update asap.

Using this fix, it is working now for my use cases on different tilesets I have:

Best regards;

Pascal

Hi Pascal, we opened a github issue to track this: https://github.com/AnalyticalGraphicsInc/cesium/issues/6600

This issue should now be fixed! https://github.com/AnalyticalGraphicsInc/cesium/issues/6600

Thanks for providing the test cases and helping us track this down Pascal. The fix should be in the next Cesium release (1.50) or you can try out the master branch right now.

Unfortunately, the proposed solution and/or fix since 1.50 didn't work for me.
I am using Cesium in version 1.52 and I had to remove the tranformation in the children tilsets and added a transform matrix to the root tileset instead. Only then clipping on all children tilesets worked for me. All tilesets have a region as boundingVolume and consist of b3dm-Models (just for your information).

I think with the latest fixes the clipping planes now use the root tile’s bounding sphere center to figure out where to place the origin of the clipping planes. If the root doesn’t have a defined transform or if its bounding sphere center is in the center of the Earth, that’s where the origin of the clipping planes will be.

You can see the discussion and the current implementation in this PR: https://github.com/AnalyticalGraphicsInc/cesium/pull/7182#discussion_r229321628

I appreciate you bringing this up and your workaround for it. You said all tilesets have a region as boundingVolume but just to confirm, is that what the root tile had defined as well?

Hi,

As feedback and to complete Omar’s answer, the fix, that has been published by the Cesium team on the clipping plane issue I have detected few months ago, has solved my issue on clipping planes on the use cases I have.

On my tiles, a transformation matrix is applied at root level in the tileset, others transformations are applied internally inside the B3DM or PNTS and not exposed into tileset. (As of now, I didn’t generate tiles with several cascaded transformations defined in the tileset.json, it is in my roadmap for BIM in 2019).

Perhaps mholt...@gmail.com can provide more details on the issue on his side to help to understand.

Best regards

Pascal

Yes. That was the only way ma tileset got clipped as desired. The root-tile is defined by a a region as boundingVolume and placed to a specific position on the globe. at this point I applied the trnaform for this root tile. The refine adds two children, both spciified by a region as bounding volume, too. The children tiles are 3D Tilesets, as well. They are defined with the same region as boundingVolume as the children got defined in the root tile and each filled with a b3dm model as content.

If I transformed just the children but not the root tile, I expereineced the beahviour, that the content of my tileset on the globe got clipped immediately and completely as soon as the clipping plane reached the first time the content of the tileset (see first image here: https://github.com/AnalyticalGraphicsInc/cesium/issues/6600).
Maybe it's just because of the tileset I created, but thats the way I can clip my tileset as I want to.