Polyline collection limited to 16384 elements?


in my application I want to store ~16500 polylines in the same primitive collection. I can see that the polylines are all present in my data but the last ones (> 16384) do not appear on screen (tested with Cesium 1.33 under FF/chromium, debian stretch).

I couldn't find a clear explanation why but I suspect I am hitting a WebGL texture size limit so that my last lines are not sent to the GPU.

Can someone confirm? Is there a way to avoid this problem without splitting my data in several collections?

Minimal example for the sandcastle (20000 lines that should make a full circle):

var viewer = new Cesium.Viewer('cesiumContainer', { infoBox : false });

var collection = viewer.scene.primitives.add(
    new Cesium.PolylineCollection()

var attrs = {
    width: 2,
    material: new Cesium.Material({
        fabric: {type: 'Color', uniforms: {color: Cesium.Color.YELLOW}}

var R = 50;
var n = 20000;

for (var i=0; i < n; i++) {
    collection.add(Object.assign({}, attrs, {
        id: 'id_' + i,
        positions: Cesium.Cartesian3.fromDegreesArray([
            // 0, 0 + i/1000, 0, 1 + i/1000
            R * Math.cos(2*i*Math.PI/n),
            R * Math.sin(2*i*Math.PI/n),
            R * Math.cos(2*(i+1)*Math.PI/n),
            R * Math.sin(2*(i+1)*Math.PI/n),

var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function(click) {
    var pickedObject = viewer.scene.pick(click.position);
    if (Cesium.defined(pickedObject)) {
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

Hi there,

I’ve confirmed your issue and it looks like a bug. I’ve written a issue here and linked to this post so we can update you when we get a chance to look at this. https://github.com/AnalyticalGraphicsInc/cesium/issues/5538

Meanwhile, are you dynamically updating your lines? If not, PolylineGeometry will give you better performance and probably avoid this issue. http://cesiumjs.org/Cesium/Build/Documentation/PolylineGeometry.html

Also in the future, just for your convenience, you will find it easier to share code snippets via Sandcastle: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Hello%20World.html&label=Showcases

Here are some instructions: http://cesiumjs.org/tutorials/Sandcastle-Tutorial/

Hope that helps,

  • Rachel