1. A concise explanation of the problem you’re experiencing.
When I add a lot of entities to the scene, the engine renders a low frame rate,even though there are only a few entities in the field of view.It seems to be the frustum culling takes too much time.
2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.
var viewer = new Cesium.Viewer(‘cesiumContainer’, {
infoBox : false,
selectionIndicator : false,
shadows : true,
shouldAnimate : true
});
viewer.scene.debugShowFramesPerSecond = true;
//Create a model at the specified location
function createModel(url, lon,lat,height) {
var position = Cesium.Cartesian3.fromDegrees(lon, lat, height);
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 entity = viewer.entities.add({
name : url,
position : position,
orientation : orientation,
model : {
uri : url,
minimumPixelSize : 128,
maximumScale : 20000
}
});
}
//Create a specified number of models with random locations
function addModel(count){
for (var i=0;i<count;i++){
var lon = Math.random()*120.0 - 60.0;//(-60,60)
var lat = Math.random()*120.0 - 60.0;//(60,60)
var url = “…/…/SampleData/models/CesiumAir/Cesium_Air.glb”;
var entity = createModel(url,lon,lat, 50000.0);
}
}
addModel(5000);
var rectangle = new Cesium.Rectangle(Cesium.Math.toRadians(-60),
Cesium.Math.toRadians(-60),
Cesium.Math.toRadians(60),
Cesium.Math.toRadians(60));
viewer.scene.camera.flyTo({destination: rectangle});
``
3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
I want to support more than 10,000 dynamic entities with high performance in my application.
4. The Cesium version you’re using, your operating system and browser.
Cesium 1.5.2,Windows 10 x64,Google Chrome 71.0.3578.98.