I’m currently using CesiumJS to plot 10k - 100k polylines. This runs fine in the 3D globe view, however performance drops heavily in the 2D view. Any advice on how to improve performance would be greatly appreciated!
Benchmarks:
15k polylines: 100 fps in 3D view, 40 fps in 2D view.
50k polylines: 70 fps in 3D view, 20 fps in 2D view.
107k polylines: 60 fps in 3D view, 10 fps in 2D view.
Notes:
All measurements were done from a static view, without any user input.
Performance does not vary much depending on whether or not I am zoomed in or not, so it doesn’t seem to be related to how many entities are on screen?
According to the profiler the ._setUniforms function is response for the majority of the performance cost in 2D, taking up ~42% of rendering time.
Tested in Firefox.
Structure:
The polylines are created using the entity API, as the user needs to be able to individually select them and view related information.
Polylines are grouped together into CustomDataSources, with each one consisting of between 100-1000 polylines each.
Polylines do not move and will only occasionally change color/visibility (all at once) based on user input.
Each line is defined by 3 points and uses the geodesic arctype.
The polyline materials only use the Cesium.Color class.
Our code does not differentiate between 2D or 3D view.
I’m facing the same issue even with only markers and clusters (>3K).
That and also a misplacement of the markers and clusters in 2D but not in Columbus as well (especially on the top of the map).
Also, it would be helpful if you could create and share a sandcastle example of what you are seeing, similar the useful sandcastle example the original poster shared? This will help in diagnosing the issue and testing potential fixes.
I added an FPS meter to monitor performance and a button to toggle clustering on/off. Here’s what I’ve observed:
Performance drops in 2D, but not in 3D or Columbus View.
Cluster behavior differs between modes: for example, Scandinavia doesn’t seem to generate any clusters in 2D, whereas it works as expected in 3D/Columbus.
Zooming over Norway in 2D, markers sometimes don’t appear, while they render correctly in Columbus View.
Replacing points with billboards worsens the issue in 2D, sometimes placing billboards outside the visible map.
Hopefully you can replicate and perhaps let me know if I am doing something wrong or perhaps it will help pinpoint the issue.
After experimenting with Sandcastle, I noticed that the misplacement and disappearance of markers in 2D doesn’t occur when using billboard entities instead of point.
Here’s a second Sandcastle example where the points have been replaced with billboards, and both clusters and individual markers are correctly rendered.