2

I use next code to get tiles that were rendered by Cesium engine:

    // cesium initialization
    var viewer = new Cesium.Viewer('cesiumContainer', {
            sceneMode : Cesium.SceneMode.COLUMBUS_VIEW,
            imageryProvider: new Cesium.TileCoordinatesImageryProvider({
                tilingScheme : new Cesium.WebMercatorTilingScheme()
            }),
            baseLayerPicker : false,
            terrainProvider: new Cesium.EllipsoidTerrainProvider({
                tilingScheme : new Cesium.WebMercatorTilingScheme()
            })
        });

    // get rendered tiles
    viewer.camera.moveEnd.addEventListener(function() {
        var tilesToRender = viewer.scene.globe._surface._tilesToRender;
    });

the problem is that tiles that I get are not the same as tiles I see on the Cesium globe. Cesium globe picture looks like this:

enter image description here

but tilesToRender variable contains only level 2 tiles and also tiles that are not on the globe (for instance L2X0Y0).

tilesToRender[0]: L2X1Y1
tilesToRender[1]: L2X1Y2
tilesToRender[2]: L2X2Y1
tilesToRender[3]: L2X2Y2
tilesToRender[4]: L2X1Y0
tilesToRender[5]: L2X0Y1
tilesToRender[6]: L2X2Y0
tilesToRender[7]: L2X0Y2
tilesToRender[8]: L2X1Y3
tilesToRender[9]: L2X0Y0
tilesToRender[10]: L2X2Y3
tilesToRender[11]: L2X0Y3
tilesToRender[12]: L2X3Y1
tilesToRender[13]: L2X3Y2
tilesToRender[14]: L2X3Y0
tilesToRender[15]: L2X3Y3

Is it possible to get exactly same tiles that are visible on the Cesium globe?

  • Hi! I'm curently digging into Cesium too, and want to ask you how did you come up with a viewer.scene.globe._surface._tilesToRender thing? This is so badly documented... – scythargon Jun 20 '17 at 21:19
3

Cesium doesn't compute this exactly. Cesium computes a Bounding Sphere for each tile, which provides a rapid approximation answer as to whether the tile is close enough to the view volume that there's some good chance it (or part of it) might need to be rendered. Tiles matching this criteria make their way into tilesToRender.

False positives are no problem, the renderer will sort that out. False negatives would be a large problem, as tiles would go missing from view. The bounding sphere calculation is designed to run very fast and allow a few false positives but weed out the negatives with certainty.

Long story short, Cesium doesn't actually calculate the answer you're asking for here, because it could render a tile and never realize that WebGL has discarded all fragments from that tile.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.