We at Raytheon have been working with some overlapping layers, some of which don't have extremely fast servers and are trying to optimize our layer load performance.
We've come up with a method that cuts tile requests/load times (jumping to a low altitude) by 40-60%, but I'm seeing some side-effects.
What we're trying to do is limit our tile requests by only loading tiles that are within our view extent. Pretty much all we've done is to add an overlaps() method to Core/Extent and then tweak queueChildrenAndDetermineIfChildrenAreAllRenderable() (quite a method name)
function queueChildrenLoadAndDetermineIfChildrenAreAllRenderable(surface, frameState, tile) {
var allRenderable = true;
var go = false;
var children = tile.getChildren();
var extent = new Extent(tile.extent.west, tile.extent.south, tile.extent.east, tile.extent.north);
/* Queue children if in the view extent */
if (extent.overlaps( Cesium.lastExtent )) {
for (var i = 0, len = children.length; i < len; ++i) {
var child = children[i];
surface._tileReplacementQueue.markTileRendered(child);
if (child.state !== TileState.READY) {
queueTileLoad(surface, child);
}
if (!child.isRenderable) {
allRenderable = false;
}
}
} else {
/* Always return false for tiles that don't overlap with the view extent so we don't try to refine */
return false;
}
return allRenderable;
}
Pardon my global Cesium.lastExtent.
As I said, this provides some significant performance gains and overall does pretty well. I am seeing a tendency for tiles to not refine as much as they otherwise would (even if they're within the view extent). It's possible this is partially due to some poor view extent calculations when viewing at an angle, but I thought y'all might be able to shed some light on it.
The other thing I've tried that provides still better performance is to actually refrain from queuing any children that aren't in the view extent and instead simply returning "true" even when the out-of-sight tiles aren't renderable.
The impact of this is to cause those tiles that don't get loaded to be black (rather than simply a lower-res version because the parent is replaced but not all the children load to replace it (if my understanding is correct). Obviously this doesn't look great because you see black tiles when you move around and sometimes the tiles will black out momentarily as you're zooming out. I don't know if it's feasible to push things this far, but I thought I'd mention it.
Do y'all already have plans for optimizing? We're on 14b, so a bit behind. Anything we should know about in current or upcoming versions?
Thanks!
-- David