Low frame rate when updating polyline position frequently


I’m currently plotting the trajectory of a moving point with a PolylineCollection().

The issue I’m facing is that when the point moves I am required to update the entire array of positions in the polyline. as :

polyline.positions = Cesium.Cartesian3.fromDegreesArrayHeights(updatedBuffer);

This operation has to be done for every point added to the path.

I was using PathGraphics to visualize the path by providing the position as a TimeIntervalCollection however my application provides the new Points in the path at runtime and is not known beforehand.

I ran my application through the Chrome Profiler to see why the framerate was so low.

Based on the profiler the most time consuming operations are

  • updating the polyline positions in the above call
  • Scene.render()
  • In Scene.rende() the maximum time is taken in the call createVertexArrays()
    From this I perceive that Cesium creates a new VertexArray every time there is an update to position.

To improve performance I am considering disabling creation of a new l Vertex Array every time and instead creating one large array.

Subsequent calls to update position would cause the position to be added via a call to glBufferSubData().

Is this a viable solution and if so can someone point out how I should go about doing this?

#Attachment : Profile screenshot

Hi Sushrut,

We plan to optimize this case using dynamic buffers, see #932. However, I don’t know when this feature will be worked on.

In the meantime, you may be able to use multiple polyline collections, e.g., create a new one for every 1K or 2K points. I would try this first before considering modifying the Cesium engine code.


That worked very well…Thanks