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

terrain loading error #4894

Closed
jbo023 opened this issue Jan 20, 2017 · 10 comments · Fixed by #4969
Closed

terrain loading error #4894

jbo023 opened this issue Jan 20, 2017 · 10 comments · Fixed by #4969

Comments

@jbo023
Copy link
Contributor

jbo023 commented Jan 20, 2017

Ho,

we just found a weird bug in the terrain loading code. Sometimes in the front of the screen the terrain is not loaded (see screenshot). Unfortunately this Bug does not occur all the time. If you disable the webbrowser file cache it occurs more often.

I narrowed it down to the following Pull Request #4616. Before the merge I could not reproduce the problem.

It is also interesting that for the same startview, a refresh of the page does not always request the same amount of terrain tiles. As an example for another application I counted between 130 and 200 terrain requests.

image

var viewer = new Cesium.Viewer('cesiumContainer');

var cesiumTerrainProviderMeshes = new Cesium.CesiumTerrainProvider({
    url : 'http://virtualcitymaps.s3-website.eu-central-1.amazonaws.com/terrain/',
    requestWaterMask : false,
    requestVertexNormals : true
});
viewer.terrainProvider = cesiumTerrainProviderMeshes;


var cam = viewer.scene.camera;

var cameraPosition = new Cesium.Cartesian3(3950334.446443219, 769922.5676672924, 4932162.0991373975);
var cam = viewer.scene.camera;
var cameraOptions = {
"heading": 0.05446154055800534,
"pitch":-0.6709337075080422,
"roll": 0.00022910782255536333
};

var direction = new Cesium.Cartesian3(-0.9887510456113379, -0.1492704873805369, 0.009470554348256777);
var up = new Cesium.Cartesian3(0.0042078055935553796,0.03553292930862533,0.9993596476278372);


cam.setView({
"destination": cameraPosition,
"orientation": {
"direction":direction,
"up":up
}
});
@jbo023
Copy link
Contributor Author

jbo023 commented Jan 20, 2017

Terrain is loaded correctly (197 requests, browser cache active)
image

Terrain is loaded incorrectly (144 requests, browser cache disabled)
image

You can see that in the the second image the terrain loading algorithm starts with lower levels of the terrain, while in the correct version the algorithm starts with the higher terrain levels.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jan 21, 2017

@jbo023 thanks for the detailed report and narrowing this down.

@kring any ideas?

@kring
Copy link
Member

kring commented Feb 8, 2017

Are you able to reproduce this with STK World Terrain, too, or only with your custom terrain tileset? Is your tileset quantized-mesh or heightmap?

@jbo023
Copy link
Contributor Author

jbo023 commented Feb 8, 2017

It is a custom quantized-mesh terrain tileset. The link in the sandcastle has to be changed to this terrain.
http://d35ei6ur3bjvr1.cloudfront.net/thueringen/terrain_5/
I will also check if i can reproduce this using the STK World Terrain.

@jbo023
Copy link
Contributor Author

jbo023 commented Feb 8, 2017

Hi, i could also reproduce the problem with the STK World Terrain.

Also I noticed that the number of terrain request for the same view are more or less random.
The bug seems to be related to the speed the tiles will be delivered.

@kring
Copy link
Member

kring commented Feb 8, 2017

Hi, i could also reproduce the problem with the STK World Terrain.

I can reproduce it using your code as well. Thanks! I'll take a look soon.

Also I noticed that the number of terrain request for the same view are more or less random.

Sure, that's to be expected. It's certainly non-deterministic, depending on how long it takes for tile requests to come back and in what order. To fix this, and make Cesium load exactly the tiles needed for a particular view, we would need to make per-tile min/max heights available without downloading tiles.

@kring
Copy link
Member

kring commented Feb 9, 2017

@jbo023 a fix is in #4969, let me know if it works for you.

@hpinkos
Copy link
Contributor

hpinkos commented Dec 13, 2017

I run into this all of the time when I have a camera flight go close to the ground at the start of an application:

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.terrainProvider = new Cesium.CesiumTerrainProvider({
    url : 'https://assets.agi.com/stk-terrain/v1/tilesets/world/tiles',
    requestWaterMask : true,
    requestVertexNormals : true
});
var center = new Cesium.Cartesian3(960309.3317601935, -4954000.560677782, 3888228.4347712533);
var bs = new Cesium.BoundingSphere(center, 164.94449695026205);
viewer.scene.camera.flyToBoundingSphere(bs, {offset: new Cesium.HeadingPitchRange(0.0, -0.5, bs.radius * 2.0)});

In this case, the tiles decided never to load in:

terrain

@hpinkos
Copy link
Contributor

hpinkos commented Dec 13, 2017

It looks like #4969 fixes the problems I'm seeing, although I still see that flickering for a few seconds before the tiles finally start to load in

@hpinkos
Copy link
Contributor

hpinkos commented Jan 29, 2018

@jbo023 this issue has been fixed and will be included in the upcoming 1.42 release, available on Feb 1st. Thanks@

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

Successfully merging a pull request may close this issue.

4 participants