-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Performance Issue in updateHeights with High-Resolution Custom Terrain Providers #12476
Comments
Thanks for noting this and doing some initial exploration @calogeromauceri! At first glance, it appears that this could be helped by moving some of these operations out of the main thread and into a worker or over to the GPU. There's been some significant brainstorming for this over in #8481. It seems like your report here is covered by that existing issue. I'm going to close your issue to keep the discussion in one place, and if you have any further input on this, please post it there instead. Let me know if you think this is fundamentally a different issue, and we can reopen this one. |
Thanks for the detailed response, @ggetz! Fixing the globe picking slowness would be ideal, as it is causing significant issues in our high-resolution terrain. However, a quick solution for the specific issue I reported would be to avoid clearing the custom data for a tile at every render. Here's what I mean
This change ensures that tile custom data is retained when available, instead of being needlessly discarded and recomputed each frame. While optimizing globe picking would be the best long-term solution, this fix addresses the immediate issue effectively. I'm happy to help with fixing the underlying problem as well! |
Thanks @calogeromauceri! We're certainly open to a shorter-term fix if it's relatively targeted and general-purpose. I agree it seems like a major bottleneck that I'm a bit hesitant to rely on the position equality checks here though, as it could be error-prone. Looking through the relevant code now, we could definitely make improvements to how the "updateHeight" callbacks work across frames. If you have the bandwidth to look through a slightly broader solution here, we'd be happy to discuss. Perhaps it would make sense to create a cache for It also looks like there are some clues in #8006. |
What happened?
Summary
When using a high-resolution custom terrain provider (e.g., ArcGIS WorldElevation3D),
updateHeights
inQuadtreePrimitive
struggles to keep up with entity height updates. The intersections with the terrain take significantly longer (often exceeding 50ms), while the time limit forupdateHeights
is only 2ms.This results in a growing queue of
tilesToUpdateHeights
, leading to poor entity positioning and potential performance degradation. The issue does not occur when usingCesium.createWorldTerrainAsync()
.Reproduction steps
Sandcastle example
Observations & Debugging
To analyze the issue, I added logging inside
updateHeights
as follows:After all tiles have been loaded, I keep seeing these logs:
Key Findings:
tilesToUpdateHeights
to grow indefinitely, preventing entity heights from updating.Cesium.createWorldTerrainAsync()
eliminates the issue, suggesting that high-resolution terrain data slows down intersections significantly.Sandcastle example
https://sandcastle.cesium.com/#c=rVTbbhs3EP2VgdCHla2Qko00vihGDTtNAsSxYSntQ7ZwaO5oRZRLCuSsFNXwv2f2JkuN+5CgxALkkjNnzpwZUnsXCZYGVxjgNThcwQVGUxbij3ovSXu6/r/wjpRxGNJe/zR1qZN7qaOwhofUQQsgokaHgjAENr0JfmmyCrayAFArZahD1wEV4Z8+2GzamJ/HtdNJhf0IWpGeQ8IHPvSbCCvjMr8SymKg5MvvyljMgDxYr3huIAT88lD7PH5pcFK3JyuuP8/zPOi37yfTKtobi0tFxrvprp+YBV98CjZp3AHS3pxoEU+kxM7lMBMq6NxEoX0hm6UMGElGDEvDEstai02Mw0vZhuHV+0LlOGHDSv1BE+b/Fip1O9rk1t+jyHBB8ynTPM/ZK1JLiRuFQol1G8xKpyvCkCPdKg5dXM9mESlp6QSkMjhIrhTNRagN+OgFDMXLPuzxNKzH6BSkhEmhrIXGCnyNw+yqMLruU2QFmM2FCuTzoBZzo5lLW6rt3boml5gHxJgc/SqOD14O4OCVOD46Gg1g2K+jvWnQIJZFYWgriiNDBiNDf/6Lk5z5AIlFAsM7w1OexjCq5v39NsnGz3qXGyozfOJUZ02+Y/IMf/Hktf+9hlV1NvDcGD+O3jn9B/gTfJ31msHbPuhUECrLkoem6RY+mqrYJ9ua80q5wx3FNzkNNqwHcMxl7rfdW/gM7Qk8dFemGmUwJ3x3hJD8TVSxsHipSMnaNsom4pVy7eqOl9ym95sb0Yw5mnxOtzhjLZzGDdN3u/vi4sP51c3d9Pru7e31p4+XOxiFcaYoixvzFe3E/MMgo4OjXQv1tbKYaL5mfDocbp0+1uvHTt2NjosyzpNG5frSbd05Ckr/zS9MV4LO5/Ow6r/eoDeOtLZ41gX5zRQLH4glswmLRchi8XMa5X3JOCR0jE3nAIzltus4M0sw2etnXnXQVsXIJ7PS1lmnvbOxZPvvXKuXxLj8mtvNqnVlNh+dfWg2hRBjyb/Pe5L39l6FfyF/Aw
Environment
Browser: Any
CesiumJS Version: 1.126
Operating System: Any
The text was updated successfully, but these errors were encountered: