Cesium- high cpu usage when idle, and other general questions

Hi,
First, thank you very much for cesium. I use it a lot; it's a great library and impressive project.

I have some general issues/questions and I want to ask here to know if it's necessary to open issues for them.

1. If I show terrain (For example- STK, it also happens in the sandcastle), the CPU usage is kept high even when all terrain tiles were finished to download and were processed.

2. I couldn't find a roadmap for kml regions (especially for networklinks loading), despite it listed in the kml features roadmap issue. Is there a planning to support it in 2015?

3. I want to try a local cache based on IndexedDB for terrain tiles. The problem is that the work with it is done asynchronously.
if I change the requestTileGeometry function, to return promise to cache answer and then to check this answer, return it if exists or chain another promise for download it (if it not exists)- then, if the throttleRequestByServer is return undefined (when it exceeds the number of connections)- this value is not treated properly.

My code looks like:

var cacheAnswer = getCacheItem(url);
cacheAnswer.then(function(answer){
  if (!defined(answer)){
     return throttleRequestByServer(url,loadArrayBuffer); //this value is returned in a promise therefore is not treated properly if it's undefined
  }else{
    return answer;
  }
});

This is also a problem when additional information is needed in order to request remote data, so another request for metadata is needed before the request for the data itself.

Thank you very much

Hi,

  1. Cesium’s CPU usage is high in all scenarios, not just when using terrain. There’s an issue for this with some discussion here:

https://github.com/AnalyticalGraphicsInc/cesium/issues/1865

Also, in my Cesium-based app, I’ve implemented a hacky way of stopping rendering when Cesium is idle. The code is here in case it’s helpful:

https://github.com/TerriaJS/terriajs/blob/master/lib/Models/Cesium.js

  1. I’ll leave this one to someone else.

  2. The easiest solution is to put the throttleRequestByServer ahead of the cache lookup. For example:

return throttleRequestByServer(url, function() {

return getCacheItem(url).then(function(answer) {

if (!defined(answer)) {

return loadArrayBuffer(url);

} else {

return answer;

}

});

});

This may seem a little weird, because there’s no request (yet). But it’s still beneficial to limit the number of in-flight getCacheItems (otherwise, Cesium could generate hundreds of them in some scenarios), and throttleRequestByServer is an easy way to do that.

Kevin

There is an open issue for KML support https://github.com/AnalyticalGraphicsInc/cesium/issues/873. We are actively working towards supporting as many of the KML features as possible.

If you’re able to share a KML sample implementing the regions, when we go to implement that feature we can make sure that Cesium is compatible with it.

Hi Kevin and Mike -

Thanks a lot for your replies.

  1. The information in the links is very useful. However, I prefer to wait for official release, if it’s planned for the near future. Do you have any plans for that?

  2. I added two files:

a. simple.zip- simple region based network link- composed of 2 files- root.kml and rome.kml. the root.kml link to rome.kml and the trigger for this link is the region activation.

b. large.zip- dataset from wikimapia which was divided to region based kmls by regionator script (placemarks.py) from:

https://code.google.com/p/regionator/

The purpose of this example is to demonstrate the usage of this feature with large datasets (9000 placemarks in this case, but could be much larger dataset).

  1. Thanks for this solution. I will try it…

simple.zip (1.33 KB)

large.zip (2.21 MB)

No, sorry, there’s currently no specific timeframe for reducing Cesium’s CPU usage. My second link shows how it can be done externally with an official version of Cesium, however.

Hi kevin,
your second link looks great. Thanks!