Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D tiles bounding volumes don't move with tileset modelMatrix #5984

Closed
hpinkos opened this issue Nov 14, 2017 · 9 comments
Closed

3D tiles bounding volumes don't move with tileset modelMatrix #5984

hpinkos opened this issue Nov 14, 2017 · 9 comments

Comments

@hpinkos
Copy link
Contributor

hpinkos commented Nov 14, 2017

With the chappes church point cloud model:

chappes.readyPromise.then(function() {
    var cartographic = Cartographic.fromCartesian(chappes.boundingSphere.center);
    var surface = Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
    var offset = Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 415.49299710114906); //2.9262921309980063, 46.388339804887515, 415.49299710114906
    var translation = Cartesian3.subtract(offset, surface, new Cartesian3());
    chappes.modelMatrix = Matrix4.fromTranslation(translation);
});
camera.flyTo({
    destination: new Cartesian3(4401822.465194312, 225035.28458448383, 4595539.250208599),
    orientation: {
            heading: 5.404892352900644,
            pitch: -1.4530591151917136,
            roll: 6.260800942147647
    }
})
@lilleyse
Copy link
Contributor

This came up on the forum too: https://groups.google.com/forum/#!topic/cesium-dev/OIP2B_UgGns

I started to investigate but realized this was only affecting tilesets that use region bounding volumes, in which case this is the expected behavior. We figured It doesn't really make sense to transform a region since it isn't in Cartesian space.

From the spec:

The `transform` property applies to:
* `tile.content`
   * Each feature's position.
   * Each feature's normal should be transformed by the top-left 3x3 matrix of the inverse-transpose of `transform` to account for [correct vector transforms when scale is used](http://www.realtimerendering.com/resources/RTNews/html/rtnews1a.html#art4).
   * `content.boundingVolume`, except when `content.boundingVolume.region` is defined, which is explicitly in [WGS84 / EPSG:4326 coordinates](http://spatialreference.org/ref/epsg/wgs-84/).
* `tile.boundingVolume`, except when `tile.boundingVolume.region` is defined, which is explicitly in WGS84 / EPSG:4326 coordinates.
* `tile.viewerRequestVolume`, except when `tile.viewerRequestVolume.region` is defined, which is explicitly in WGS84 / EPSG:4326 coordinates.

https://github.com/AnalyticalGraphicsInc/3d-tiles#tile-transform

@cesium-concierge
Copy link

Congratulations on closing the issue! I found these Cesium forum links in the comments above:

https://groups.google.com/forum/#!topic/cesium-dev/OIP2B_UgGns

If this issue affects any of these threads, please post a comment like the following:

The issue at #5984 has just been closed and may resolve your issue. Look for the change in the next stable release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.


I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

@hpinkos hpinkos reopened this Dec 15, 2017
@hpinkos
Copy link
Contributor Author

hpinkos commented Dec 15, 2017

@lilleyse this is a problem because the point cloud flickers a lot as you move the camera. Is it being culled incorrectly or something because the points are no longer inside the bounding volume?
Here's a more complete example. I wanted to put this tileset on terrain:

//Point Cloud by Prof. Peter Allen, Columbia University Robotics Lab. Scanning by Alejandro Troccoli and Matei Ciocarlie.
var viewer = new Cesium.Viewer('cesiumContainer');
viewer.extend(Cesium.viewerCesium3DTilesInspectorMixin);

viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
    url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
    requestWaterMask : true,
    requestVertexNormals : true
});

var chappes = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
    url : 'https://beta.cesium.com/api/assets/1460?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyMzk2YzJiOS1jZGFmLTRlZmYtYmQ4MS00NTA3NjEwMzViZTkiLCJpZCI6NDQsImFzc2V0cyI6WzE0NjBdLCJpYXQiOjE0OTkyNjQ3NTV9.oWjvN52CRQ-dk3xtvD4e8ZnOHZhoWSpJLlw115mbQJM'
}));

chappes.readyPromise.then(function() {
    var cartographic = Cesium.Cartographic.fromCartesian(chappes.boundingSphere.center);
    var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);
    var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 415.49299710114906); //2.9262921309980063, 46.388339804887515, 415.49299710114906
    var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
    chappes.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
});
viewer.camera.flyTo({
    destination: new Cesium.Cartesian3(4401822.465194312, 225035.28458448383, 4595539.250208599),
    orientation: {
            heading: 5.404892352900644,
            pitch: -1.4530591151917136,
            roll: 6.260800942147647
    }
});

image

@pjcozzi
Copy link
Contributor

pjcozzi commented Dec 22, 2017

Should Cesium throw a DeveloperError or console warning if the model matrix is not identity and region bounding volumes are used?

@lilleyse
Copy link
Contributor

One other thing we could do is let the transform happen, but transform the underlying oriented bounding box and not touch the region. It's possible this will cause other side effects though.

@lilleyse
Copy link
Contributor

Another issue from the forum: https://groups.google.com/forum/#!topic/cesium-dev/rUFnzb0d14o

@ggetz
Copy link
Contributor

ggetz commented May 15, 2018

@lilleyse
Copy link
Contributor

Another forum post: https://groups.google.com/forum/#!topic/cesium-dev/DE_iV6WAZcs

I submitted a PR to fix this, if we decide to allow transforms to move regions. #6755

@cesium-concierge
Copy link

Congratulations on closing the issue! I found these Cesium forum links in the comments above:

https://groups.google.com/forum/#!topic/cesium-dev/OIP2B_UgGns
https://groups.google.com/forum/#!topic/cesium-dev/rUFnzb0d14o
https://groups.google.com/forum/#!topic/cesium-dev/j-8uQL0lJTo
https://groups.google.com/forum/#!topic/cesium-dev/DE_iV6WAZcs

If this issue affects any of these threads, please post a comment like the following:

The issue at #5984 has just been closed and may resolve your issue. Look for the change in the next stable release of Cesium or get it now in the master branch on GitHub https://github.com/AnalyticalGraphicsInc/cesium.


I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome.

🌍 🌎 🌏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants