-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Cesium stops rendering on bad terrain #7936
Comments
I tested several releases and the issue might have been introduced in Cesium 1.55. |
Thanks for looking into this @gberaudo . There have been two major changes recently. Version 1.55 changed the way terrain & imagery load to skip levels of detail to make it faster and use less bandwidth: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CHANGES.md#155---2019-03-01 And version 1.56 changed the way image decoding works by implementing ImageBitmap: https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CHANGES.md#156---2019-04-01 My guess is one of those changes is the culprit. This is the error you're getting right?
|
Thanks @OmarShehata for the feedback. Indeed this is the message I get. |
Thanks for confirming @gberaudo. I think the next step here would be to |
Hi @OmarShehata, hi @kring, I took the time to bisect the error. It looks like being introduced either in 955c996 or in 0328cc9.
I was not able to test commit 0328cc9 as it immediately triggers the following error:
Here is the procedure to check by yourself:
Here is the <head>
<link rel="stylesheet" src="./Sandcastle/templates/bucket.css"></link>
<script src="/Build/CesiumUnminified/Cesium.js"></script>
<script src="./bisect.js"></script>
<style>
@import url(/Build/CesiumUnminified/Widgets/widgets.css);
html, body, #cesiumContainer {
width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
}
</style>
</head>
<div id="cesiumContainer" class="fullSize"></div>
<div id="toolbar"></div> And the window.onload = function() {
// Swiss extent
var rectangle = Cesium.Rectangle.fromDegrees(
5.013926957923385,
45.35600133779394,
11.477436312994008,
48.27502358353741
);
try {
var viewer = new Cesium.Viewer("cesiumContainer", {
baseLayerPicker: false,
terrainProvider: new Cesium.CesiumTerrainProvider({
url:
"//3d.geo.admin.ch/1.0.0/ch.swisstopo.terrain.3d/default/20180601/4326/"
}),
imageryProvider: new Cesium.UrlTemplateImageryProvider({
url:
"//wmts10.geo.admin.ch/1.0.0/ch.swisstopo.swisstlm3d-karte-farbe.3d/default/current/4326/{z}/{x}/{y}.jpeg",
minimumLevel: 6,
maximumLevel: 17,
tilingScheme: new Cesium.GeographicTilingScheme({
numberOfLevelZeroTilesX: 2,
numberOfLevelZeroTilesY: 1
}),
rectangle: rectangle
}),
fullscreenButton: false,
homeButton: false,
sceneModePicker: false,
selectionIndicator: false,
timeline: false,
animation: false,
geocoder: true,
navigationInstructionsInitiallyVisible: false,
navigationHelpButton: false,
scene3DOnly: true
});
// Zoom to Mürrn
viewer.camera.setView({
destination: Cesium.Rectangle.fromDegrees(7.87, 46.58, 7.88, 46.59), // Mürren
orientation: {
heading: Cesium.Math.toRadians(175.0),
pitch: Cesium.Math.toRadians(-35.0),
roll: 0.0
}
});
viewer.scene.globe.baseColor = Cesium.Color.WHITE;
viewer.scene.backgroundColor = Cesium.Color.WHITE;
} catch (e) {
console.log(e.message);
}
}; |
Hi @gberaudo, I played with your 1.58 codepen and wasn't able to trigger the error in a few minutes of navigating around. Any more specific advice about where or how to move? Based on your debugger screen shot, my best guess is that you have a quantized-mesh tile that is missing a corner point, or where the corner vertices are not quite exactly in the corners. This is tripping up the fill tile generation code. We could perhaps handle this case, but, if I'm right, you really should fix your tileset if at all possible. The missing/misplaced corner will cause cracking artifacts between tiles, too. |
Thanks @kring for the tips. I can probably rely on https://quantized-mesh-tile.readthedocs.io to iterate the whole tileset.
I can probably add some detection logics in Cesium to find the bad tiles (and test your hypothesis). We only generate part of the world (Switzerland with a border). Where there is no content we send a "204 No content" HTTP response; could it also trigger the issue? To trigger the issue I navigate like this (triggered with the 1.58 codepen): |
I think the black areas you see in your GIF are the problem. Check those tiles first. Enabling Cesium Inspector might help identify which they are. I wouldn't expect a missing tile (204 or otherwise) to cause that problem, Cesium should be able to handle that. But you should definitely include the |
@gberaudo in case it's relevant, there was a bug I introduced, that was recently fixed in this PR #7914 where imagery requests that came back with 204 would prevent future requests from happening. This doesn't look like what's happening here, but I wonder if it's worth also testing the latest master branch here. |
@kring, we actually define the In the console logs I see: "An error occurred in "CesiumTerrainProvider": Failed to obtain terrain tile X: 4276 Y: 988 Level: 12". Now if I put a breakpoint in @OmarShehata, I just tested with master and the issue is still present. |
Yes the black areas wouldn't have caused problems in older versions because we weren't trying to generate "fill tiles" that join up at the (non-existent in this case) edges. Your call to |
I tried producing black areas by navigating after switching my browser to You said "my best guess is that you have a quantized-mesh tile that is missing a corner point, or where the corner vertices are not quite exactly in the corners". |
Right, missing tiles won't break anything. Incorrect layer.json won't cause a crash, though it can cause unnecessary requests, or cause Cesium to not display terrain that actually exists. However, missing corner vertices in a tile can cause a crash in the latest versions of Cesium. I would consider corners required even though I didn't state it explicitly in the spec. Missing corners have always caused holes in the Earth, through which you can see stars, bits of the atmosphere, and other artifacts. When navigating with the mouse, accidentally clicking on a crack caused by missing corners would cause wild camera behavior. The crash is new, but missing corners have always been a problem. |
I'm going to remove the @gberaudo , we do keep all of our old talks up, might be worth looking there: https://cesium.com/presentations/ |
I activated the Cesium inspector and used an external viewer to display a broken tile. Here are the findings: Large portions of tiles are missing: This is confirmed when displaying one of the broken tile 11x2133x501 (/11/2132/1546.terrain): For the curious, here is how to download it: |
Hi @kring, we are using partial terrain (we only cover Switzerland). Is non-global terrain still supported? As long as all generated tiles have corner filled? I see it now exists a globe.cartographicLimitRectangle property. Is it related? |
@gberaudo I don't think non-global terrain has ever been supported. You at least need to provide the root tile(s), even if their heights are all zeros. Otherwise Cesium can't draw a globe (or at least it would have to fill with zeros itself). As discussed before, every tile must at least have vertices at its four corners as well. |
OK, thanks @kring. I will try that and see what happens. |
@gberaudo Have you found a workaround ? We experience the same issue with the same terrain (from Swisstopo), for example on this page when you zoom out: https://smapshot-beta.heig-vd.ch/visit/1790 Have you or should we report the issue to Swisstopo ? |
@imagoiq, unfortunately not. Another point is that Cesium is not supposed to work with partial terrain. |
Thanks @gberaudo for your reply, so we'll further investigate this issue and contact Swisstopo to coordinate. |
Hi @gberaudo, have you tried rendering this terrain as a 3D Tileset? See the 3D Tiles Next S2 Globe for an example. I think 3DTiles will be a better way to handle non-global datasets, so I will close this issue for now. Feel free to re-open if you think it's still an issue. |
Hi @jjhembd, Thanks for the idea, I did not notice that Cesium had advanced so much in this direction. There are still lots of things to address before it is plainly usable:
For everyone, there is a list of related issues here: https://github.com/CesiumGS/cesium/labels/3D%20Tiles%20as%20Terrain |
Hi,
I am upgrading an application from Cesium 1.44 to Cesium 1.58.
After some navigation an error is triggered from the terrain rendering code and Cesium freezes.
I would expect this custom terrain mesh to continue working with newer Cesium versions. Ideally the Cesium render would also not freeze.
The issue seems to trigger only when navigating near the Swiss border.
We generate tiles only inside Switzerland, outside we return 204.
Do you know of a change since 1.44 that could cause this issue?
Any hint would be welcome.
Here is a stack trace:
at new DeveloperError (https://cesiumjs.org/releases/1.58/Build/CesiumUnminified/Cesium.js:540:19)
at Object.Check.typeOf.number (https://cesiumjs.org/releases/1.58/Build/CesiumUnminified/Cesium.js:1793:19)
at Function.Cartesian3.multiplyByScalar (https://cesiumjs.org/releases/1.58/Build/CesiumUnminified/Cesium.js:7859:22)
at Ellipsoid.cartographicToCartesian (https://cesiumjs.org/releases/1.58/Build/CesiumUnminified/Cesium.js:9173:20)
at addVertexWithComputedPosition (https://cesiumjs.org/releases/1.58/Build/CesiumUnminified/Cesium.js:217648:34)
at createFillMesh (https://cesiumjs.org/releases/1.58/Build/CesiumUnminified/Cesium.js:217515:25)
at propagateEdge (https://cesiumjs.org/releases/1.58/Build/CesiumUnminified/Cesium.js:217193:17)
at visitTile (https://cesiumjs.org/releases/1.58/Build/CesiumUnminified/Cesium.js:217180:9)
at visitRenderedTiles (https://cesiumjs.org/releases/1.58/Build/CesiumUnminified/Cesium.js:217119:13)
at Function.TerrainFillMesh.updateFillTiles (https://cesiumjs.org/releases/1.58/Build/CesiumUnminified/Cesium.js:217057:13)
Here is the state of the variables (see the undefined and NaN values):
The issue can be reproduced using these 2 codepens:
Browsers / OS:
Chromium & Firefox on Linux/Ubuntu.
The text was updated successfully, but these errors were encountered: