Flickering/Flashing of entities when streaming CZML and the viewer is tracking an entity

I am streaming CZML on a websocket and also creating entitys in javascript code at the same time. When I do this and I track an entity with the viewer, there is flickering

or an artifact forming of the entities on the screen. This only happens when the camera is tracking the entity.

Here is the code for loading the streamed CZML:

                var czmlDataSource = new Cesium.CzmlDataSource();
                // Set up websocket for czml streaming
                var czws = new WebSocket("ws://" + location.host + "/czmlFeed");
                czws.onmessage = czmlPacket => {
                    try {
                        var czml = JSON.parse(czmlPacket.data);
                    } catch(err) {


Here is an example of the CZML packet being streamed in:



Here is the code snippet for creating an another entity not using CZML and updating it’s position:

                    var entityCurrentPosition;
                    var entityCurrentOrientation;
                    entityStateUpdaters[entityName] = es => {
                        entityCurrentPosition = new Cesium.Cartesian3(es.positionECEF.x, es.positionECEF.y, es.positionECEF.z);
                        entityCurrentOrientation = Cesium.Quaternion.fromHeadingPitchRoll(-es.orientationEuler.psi, -es.orientationEuler.theta, es.orientationEuler.phi + Cesium.Math.PI);
                        id: entityName,
                        position: new Cesium.CallbackProperty(() => entityCurrentPosition, false),
                        orientation: new Cesium.CallbackProperty(() => entityCurrentOrientation, false),
                        model: {
                            uri: availableModels[ms.options[ms.selectedIndex].value],
                            scale: 1.0

               // Set up websocket for entity data
                var ws = new WebSocket("ws://" + location.host + "/liveEntities");

                // called when entity data is received from server
                ws.onmessage = entities => {
                    JSON.parse(entities.data).forEach(e => {


Any ideas?



Hi Bobby,

Hmm, I haven’t seen a problem like this before. It happens when you’re tracking one entity and creating another? Are the entities all polylines? Would there be an easy way to reproduce the behavior in a Sandcastle example?



Hi Hannah,

The entity that is being streamed in as CZML is a polyline. The other entity created in the javascript code is a 3D GLTF model entity. So when the camera tracks the 3D model entity and a CZML packet gets rendered it flickers. This only happens when the CZML packet is rendered.

I will see if I can get an example of this in Sandcastle.



I am able to recreate the problem in Sandcastle.

Here is the code I used in Sandcastle:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var czmlDataSource = new Cesium.CzmlDataSource();


var czmlString = '[\

































var czml = JSON.parse(czmlString);


var position = Cesium.Cartesian3.fromDegrees(-118.2437,34.0522,20000);

var heading = Cesium.Math.toRadians(135);

var pitch = 0;

var roll = 0;

var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);

var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);

var url = ‘…/…/SampleData/models/CesiumAir/Cesium_Air.glb’;

var entity = viewer.entities.add({

    name : url,

    position : new Cesium.CallbackProperty(function() {return position;}, false),

    orientation : orientation,

    model : {

        uri : url,

        minimumPixelSize : 128,

        maximumScale : 20000



var i = 0;

viewer.trackedEntity = entity;

setInterval (function () {

position = Cesium.Cartesian3.fromDegrees(-118.2437+i,34.0522,20000);

i += 0.0001;       

}, 200);

setInterval(function () {


}, 100);


Thanks for putting together than example. I see what you’re saying now, that is a really strange interaction.
Is there a reason you’re not adding the model with the CZML as well? That might fix the problem.


I have a different interface where the server streams out position and orientation for an entity that is represented as a 3d model. Preferably, I want to keep this interface. I store certain information on the client and have my own custom interface for this part of my app.

I am surprised this problem is happening because it does not show up when the entity is not tracked.

Is there some other way?


Sorry, I’m not sure what would be causing this problem, but I’ve filed a bug report here for us to look into it: https://github.com/AnalyticalGraphicsInc/cesium/issues/4647