What is the best way to update 1000+ entity positon 10times per second?

Hi All:
I’ve got about 1000 car flow data on local, each car data will refresh 10times per second in order to update position and orientation. i have a very low performance on using callbackProps with box or plane entity and czml data also, use point entity could just have acceptable performance, is any best practice to update such amout and frequence of data? Sorry for new to CesiumJs :grinning:

@vincent_zhenglf Hi, you need more reading as Cesium optimizing.

In my project (but we use only 200-300 moving objects as simple 3d glb with height(for terraineProvider), orientation & coordinates) I use
…// function generated_or_update_entities(viewer){
viewer.entities.suspendEvents; // START optimizing add entitys
… your code
viewer.entities.resumeEvents; // END optimizing add entitys

it helped me. I hope also helps you

PS - for you real need ALL 1000 cars 10hz getting and redraw data?
may be use viewer.requestRender() mode also can help you

1 Like

Thanks dihand,i will read more about suspendEvents and requestRender.
Yes, 10hz is original data frequency, actually i wonder to smooth it to 25hz for showing car on xodr street. 1000 car is just for demo effect, actural car amount maybe up to ten thousand. Now i’m trying working on updating primitive to see if any imporvement. I’will keep updating if i success :grinning:

hi, i’m glad that you haven’t left an idea in the search yet - most people do not see the difference between 1.10 - 125. or 1/1 in fact is the basis - as a person with an artistic education and a vision of color after 10 years of photographing Kodak … so do not worry for most - unfortunately this is only a sign of advertising.

1 Like

I use ModelInstanceCollection to load about 10 thousand model into scene, and dynamic change modelmatrix and show/hide of primitive,and performance is just acceptable。
there seems to be no add remove method on ModelInstanceCollection,so i just load all the possible cars into scene at begin and change its properties.
may be its better to calculate the matrix at server to save the performance
let modelcollection = new Cesium.ModelInstanceCollection({
url: ‘./CesiumMilkTruck.glb’,
instances: cachedData

function animateCars() {
let positionScratch = new Cesium.Cartesian3()
let cars = modelcollection._instances
for (let i = 0; i < currentTickData.id.length; i++) {
const carId = Number(currentTickData.id[i])
const matrix = currentTickData.matrix[i]
cars[carId].modelMatrix = matrix.modelMatrix
if (i === 0) console.log(cars[carId])

Hi, I use ModelInstanceCollection to load 10 thousand flight model into the scene. In order to study and debug the source code, I build a .html file at the root directory of cesium-1.87.1 instead of sandcastle.

I can produce different ModelMatrix, instances.I make them a instanceCollection. The problem is there’s no flight in the screen, it seems that it doesn’t render inside. Do I miss something?

my code:

Cesium.Ion.defaultAccessToken = ‘eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI2NmMxMTllNi0wOWU1LTQzMzgtYTA0MC02OTBkNDJmNzNkYmMiLCJpZCI6MzQyMzAsImlhdCI6MTYzMDMzMDQ0N30.E_MM3nJ3-7tMf9wkoZcbMeZkSVujWZiPGAUr1n3g7M8’;
const osmImageryProvider = new Cesium.OpenStreetMapImageryProvider({
url: ‘https://a.tile.openstreetmap.org/
const osmImageryLayer = new Cesium.ImageryLayer(osmImageryProvider);
var viewer = new Cesium.Viewer(‘cesiumContainer’, {
baseLayerPicker: true,
imageryLayer: osmImageryLayer,
shouldAnimate: true,
timeline: true
var scene = viewer.scene;
var context = scene.context;
var instances = getInstances();
let instanceCollection = new Cesium.ModelInstanceCollection({
url: “…/Apps/SampleData/models/CesiumAir/Cesium_Air.glb”,
instances: instances
function getInstances() {
var count = 10000;
var spacing = 0.0002;
var instances = ;
var centerLongitude = -75.61209431;
var centerLatitude = 40.042530612;
var height = 50.0;
var gridSize = Math.sqrt(count);
for (var y = 0; y < gridSize; ++y) {
for (var x = 0; x < gridSize; ++x) {
var longitude = centerLongitude + spacing * (x - gridSize / 2);
var latitude = centerLatitude + spacing * (y - gridSize / 2);
var position = Cesium.Cartesian3.fromDegrees(
var heading = Math.random();
var pitch = Math.random();
var roll = Math.random();
var scale = (Math.random() + 1.0) / 2.0 * 100;
var modelMatrix = Cesium.Transforms.headingPitchRollToFixedFrame(
new Cesium.HeadingPitchRoll(heading, pitch, roll)
modelMatrix: modelMatrix
return instances;

the result:

You can see that there is no flight in the screen. Hope for your reply.Sorry for new to CesiumJS.


Hi @sophie_shang,

Thank you for your question! It is a little bit hard for me to follow the code that you provided. Can you please send over a sandcastle demo that showcases the issue that you are facing?


Hi,sam. Thank you for your reply. Here is the sandcastle demo:

Hi, sam. The purpose that I create this demo is I want to learn and debug source code. In a souce file named ‘ModelInstanceCollection.js’ , there are some functions that tell the process of instance,such as
function getVertexBufferTypedArray(collection);
function createVertexBuffer(collection, context);
function createModel(collection, context);

I don’t know how to write a demo that can help me debug functions above. Hope for your reply.