Need a way to progressively show a polyline or some of its parts


I was looking into Cesium to find out how Polylines are shown or hidden and I was able to figure out that it is being done at shader level - in the Vertex-shader for Polyline gl_Position for a vertex is manipulated based on the value of show and is translated to ZERO(center of the earth) if Polyline is hidden and remains at its position if Polyline is shown, right?
This is a good approach indeed!

Here is my use-case - I want to visualize a trajectory and want to display it progressively and for that I have to create a PolylineCollection with large number of polylines, to progressively show/hide trajectory I need to play with show value of a polyline. Now, the problem is - this large number of polylines and so many polyline collections are causing FPS drop significantly.

I thought of a way to reduce the number of polylines - What I want do is create a single polyline for the complete trajectory and just pass on the indices to be drawn to the renderer.

This will require changes in the Cesium code, may be extending its classes? Can somebody guide me where to start or what else could be done or if something like this is already being done?


I’m going to followup with the team to see if there is an optimal method for handling this use-case.

Thanks Mike for the reply. It would be great if Cesium team could guide me through.
In WebGL there is a way where we can bind the buffer holding the vertex data for a geometry and just pass on the indices to be drawn (gl.drawArrays() is the concerned WebGL method, I guess). I don't know where to start the implementation for this? Where I have to make changes? Do I need to create a new geometry? Please help me out.


I don’t believe you can get direct access to the vertex data buffer. Matt may have some insight to that though. Depending on your use case the SampledPropertyCollection may work for you, or you can dynamically add more entries into the polylineCollection