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 loading to many tiles #5477

Closed
jbo023 opened this issue Jun 15, 2017 · 10 comments
Closed

3D Tiles loading to many tiles #5477

jbo023 opened this issue Jun 15, 2017 · 10 comments

Comments

@jbo023
Copy link
Contributor

jbo023 commented Jun 15, 2017

Hi,

i just checked the current state of the 3D-Tiles Branch and found a problem with one of our datasets.
If i start the view zoomed and only some buildings are shown cesium loads up to 254 b3dm files from this dataset in the background. This sandcastle Code should demonstrate the problem.

var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
viewer.extend(Cesium.viewerCesium3DTilesInspectorMixin);
var camera = scene.camera;
camera.setView({
    "destination": {
        "x": 3784121.7862312756,
        "y": 899825.2027559757,
        "z": 5038031.98712454
    },
    "orientation": {
        "heading": 1.2632693125934953,
        "pitch": -0.5218534463463045,
        "roll": 0
    }
});
var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
	url : 'https://d35ei6ur3bjvr1.cloudfront.net/berlin/3c2a32d3-633c-462d-b79c-7215dcfbc44f'	
}));
scene.terrainProvider = new Cesium.CesiumTerrainProvider({
	url: 'https://d35ei6ur3bjvr1.cloudfront.net/berlin/86bd7c93-de44-455d-9efa-a41238172216'
});

if i just change the view a bit and zoom out. The dataset loads fine and only 12 B3DM are loaded.

camera.setView({
    "destination": {
        "x": 3785571.906079139,
        "y": 898397.8247047168,
        "z": 5038469.149293753
    },
    "orientation": {
        "heading": 1.1879170814150735,
        "pitch": -0.4428628112113908,
        "roll": 0
    }
});

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 16, 2017

@jbo023 is this a new issue or did this always happen in the 3d-tiles branch?

Have you checked each tile's geometric error and the tileset's screen-space error to ensure that this isn't expected behavior? Perhaps the geometric errors are too high.

There's also several optimizations that can be set when calling the Cesium3DTileset constructor function.

@jbo023
Copy link
Contributor Author

jbo023 commented Jun 16, 2017

@pjcozzi I just checked, before this pull request the dataset worked as expected.
#5254

I will also check the tileset structur maybe we have some kind of error in our structur which didn't matter befor that PR.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 16, 2017

I was afraid it would be that pull request! 😢

Let us know what you find about your tileset structure.

@jbo023
Copy link
Contributor Author

jbo023 commented Jul 13, 2017

Hi,
@pjcozzi I created a small tileset to make bug fixing easier.

var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
viewer.extend(Cesium.viewerCesium3DTilesInspectorMixin);
var camera = scene.camera;
camera.setView({
    "destination": {
        "x": 3784121.7862312756,
        "y": 899825.2027559757,
        "z": 5038031.98712454
    },
    "orientation": {
        "heading": 1.2632693125934953,
        "pitch": -0.5218534463463045,
        "roll": 0
    }
});
var tileset = scene.primitives.add(new Cesium.Cesium3DTileset({
	url : 'https://d35ei6ur3bjvr1.cloudfront.net/berlin/small_untextured'	
}));
scene.terrainProvider = new Cesium.CesiumTerrainProvider({
	url: 'https://d35ei6ur3bjvr1.cloudfront.net/berlin/86bd7c93-de44-455d-9efa-a41238172216'
});

The problem seems to be that the traversal code loads all children of tiles in the following line of code even if they are not visible.
https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Cesium3DTilesetTraversal.js#L316

If I add a visibility check to the loadTile function at: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Cesium3DTilesetTraversal.js#L641

    function loadTile(tileset, tile, frameState) {
        if ((tile.contentUnloaded || tile.contentExpired) && tile._requestedFrame !== frameState.frameNumber) {
            if (isVisible(tile._visibilityPlaneMask)) {
                tile._requestedFrame = frameState.frameNumber;
                tileset._requestedTiles.push(tile);
            }
        }
    }

This works for my dataset, but I didn't the understand the traversal code completely so i can not say if this check changes any other tile loading behavior or creates new problems. But this is probably a good start to fix this problem.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jul 21, 2017

@jbo023 thanks for narrowing this down so much, it is appreciated!

@lilleyse I labeled this priority - next release. Given glTF 2.0 and the upcoming conferences, we clearly can't look at this for 1.36, but let's look at it for 1.37 in case the scope of affected tilesets is wide.

@jbo023
Copy link
Contributor Author

jbo023 commented Jul 21, 2017

Thanks a quick resolution would be nice,
until this is fixed we are unfortunatly stuck with an old release, before the Traversal Refactoring.

jbo023 added a commit to virtualcitySYSTEMS/cesium that referenced this issue Aug 25, 2017
@jbo023
Copy link
Contributor Author

jbo023 commented Aug 28, 2017

the examples i posted don't work at the moment. They work again with pull request:
#5783

jbo023 added a commit to virtualcitySYSTEMS/cesium that referenced this issue Aug 28, 2017
@lilleyse
Copy link
Contributor

@jbo023 your fix in b74aab6 is good. I tried a few different tilesets and haven't noticed any issues with that approach. I arrived to a similar solution in 8e28a6f but just didn't take it all the way.

@jbo023
Copy link
Contributor Author

jbo023 commented Aug 29, 2017

@lilleyse should i create a PR, or do you just integrate the fix yourself ?

@lilleyse
Copy link
Contributor

I just opened #5788 - needed to add an exception for the loadSiblings flag but otherwise was similar to here.

jbo023 added a commit to virtualcitySYSTEMS/cesium that referenced this issue Aug 30, 2017
jbo023 added a commit to virtualcitySYSTEMS/cesium that referenced this issue Aug 30, 2017
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

3 participants