Hide/cull entities based on range?

I have several vehicle and building entities in my simulation environment. Frame rate performance takes a hit whenever they are within the FOV, regardless of range.

Is there a smart way to hide/cull entities based on range (other then explicitly tracking the range to each and hiding them manually)?

  • M

I have a partial solution but it’s not very satisfying. I create a CallbackProperty for the model.show for each building that checks range. The problem is that I have to pick a general center point for the buildings – essentially turning them all off/on at the same time. What I’d rather to do in the callback is check against the range for each individual building but I can’t figure out how to do that.

This will all become moot with streamed textured 3D tiles but in the meantime… any help?

function addBuildingEntity(hRef, lng, lat, alt, ps, th, ph) {

var entityPosition = new Cesium.Cartesian3.fromDegrees(lng, lat, alt);

var entityOrientation = new Cesium.Transforms.headingPitchRollQuaternion(entityPosition, ps, th, ph);


parent: buildings,

position: entityPosition,

orientation: entityOrientation,

id: baseName(hRef),

model : {

uri : hRef,

scale : 1,

show : new Cesium.CallbackProperty(checkBuildingRange, false)




function checkBuildingRange() {

var moffettCoord = new Cesium.Cartesian3.fromDegrees(-122.0537397314, 37.41299374617, 0);

var d = Cesium.Cartesian3.distance(moffettCoord, viewer.camera.positionWC); // hide buildings when more then 10 km away

if (d < 10000) return true;

else return false;