Low polyline primitive performance in cesium for dynamically changing geometries

a b c

The reason a lot of dynamic polylines are slow is because rendering a polyline on the globe requires curving it along the surface, so the geometry needs to be recreated and re-sent to the GPU. The solution to this would be using dynamic buffers, to avoid the need to re-send everything to the GPU every frame, as noted here: https://github.com/CesiumGS/cesium/issues/932.

In the meantime, there may be a few optimization tricks you can do depending on what you’re trying to visualize in your application. I think moving 100k points in a primitive should be fast. You mentioned “different images + vectors”, are these images changing over time? Is the other vector data moving over time? Have you considered creating a pooling mechanism where you have a fixed number of points in the scene, and as the camera moves figuring out what entities should be represented in this view, and rendering only those? This is more or less the underlying principle behind 3D Tiles that allows you to visualize datasets with billions of points, for example, and I think is how the upcoming vector format of 3D Tiles would handle that for supporting time dynamic features.

a b c

You should be able to do this by setting the arcType of the line to none (see https://cesium.com/docs/cesiumjs-ref-doc/ArcType.html#.NONE). I’d be curious to see if this leads to a significant performance boost in your test cases.

a b c

This is already possible, you can pass a video HTML element or a canvas as the image to a material for your polygon. See: https://sandcastle.cesium.com/index.html?src=Video.html.

If this approach works out for you I’m sure it would be of interest to others to post your results here!

Trying to set the arcType of a PolylineGraphics to ArcType.NONE produces an error:
DeveloperError: Valid options for arcType are ArcType.GEODESIC and ArcType.RHUMB

Update: Whoops, that’s only true if the ClampToGround property is true at the same time. Polylines with ClampToGround set to false happily accept ArcType.NONE.

Update 2: switching from clampToGround polylines to ArcType.NONE dramatically improves performance in our app. You just need to ensure your polylines are slightly above the surface (height > .01). Also z-index ordering depends on the clampToGround property to be true, so you’ll have to adjust the height of individual lines to emulate z-index.

I am also using primitive polyline and having performance issues.
I would like to be able to render about 5k dynamic polylines , but in about 1k polylines the app gets real slow.
Any ideas?

P.S, I also render them in a collection.