How to know if the scene is ready to display?

As I am starting to test my prototype with other people’s computers and Internet connections, I see the need to prepare the scene completely before displaying it, otherwise users do not understand what they’re looking at.

My app is going to be a (non-CZML based) multimedia presentation which animates a billboard (for now) along a route on the terrain. The highest level Cesium class I use is Scene. I would like to display something else while the Scene is being initialized which in some cases can be a long time (> 1 minute), as many high-level tiles have to be downloaded and rendered before Cesium gets to the desired zoom level.

I think there are at least 2 separate issues here:

a) The default LOD algorithm for terrain height maps & imagery always insists on loading zoom levels 0-N although my app will never zoom out too far. I think it would be great to have the ability to override streaming strategy, especially when an app knows precisely which tiles will be needed and at what zoom levels.

b) I can’t see a way to plug into the worker queue and/or rendering pipeline to gauge the level of activity. This is independent of (a), as even with LOD control, bandwidth and system speed determine how quickly the scene settles into the desired zoom level (and thus how long it takes for actual rendering activity to drop near zero).

I am finding it very difficult to come up with a default “wait time” and it will be wrong no matter what. Does anyone have any thoughts on this?

Thanks in advance,


Hi Peter,

a) Agreed, this would be a nice feature. Rather than an explicit override, I think Cesium should just be smarter about the order of tile requests. The current strategy is to request the least detailed tiles first, which results in the best average detail across the scene if you zoom in from space at a reasonable rate. But when the app starts zoomed in, it’s far from ideal. We can do better. I can’t promise how soon I’ll get to this, though.

b) It’s possible to determine this by rummaging around in CentralBodySurface, and it’s on my to-do list to make this (much) easier. For now you can determine that all terrain/imagery loading is complete (for the current view) by doing something like this:

var doneLoading = typeof centralBody._surface._tileLoadQueue.head === ‘undefined’;


Thanks Kevin. I got this to work, although it isn’t as straightforward.

For the benefit of anyone else in the same predicament, here is what I had to do inside the animation loop:

    var queueEmpty = typeof scene._primitives.getCentralBody()._surface._tileLoadQueue.head === 'undefined';

    if ( !queueEmpty )

      lastLoadTime = now;

    var readyToGo = now - lastLoadTime >= 5000;

It turns out that the queue is momentarily empty quite frequently during startup. The 5 second margin is arbitrary, but it proved adequate on a lowly 2008 Mac mini which is the slowest computer I own.