Low frame rate when updating polyline position frequently

576 views
Skip to first unread message

Sushrut Shivaswamy

unread,
Dec 24, 2015, 9:33:16 AM12/24/15
to cesium-dev
Hi,

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       
profile.png

Patrick Cozzi

unread,
Dec 30, 2015, 8:15:24 PM12/30/15
to cesium-dev
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.

Patrick

Sushrut Shivaswamy

unread,
Dec 31, 2015, 4:04:49 AM12/31/15
to cesium-dev
That worked very well...Thanks
Reply all
Reply to author
Forward
0 new messages