-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cesium CPU usage #1865
Comments
As mentioned in the above issue, using the visibility API might also help out here in some circumstances: http://www.smashingmagazine.com/2015/01/20/creating-sites-with-the-page-visibility-api/ |
I don't think the visibility API is the right answer here, as Question, what is the best approach to implement this? Would there be a flag on Scene or RenderState or Context or someplace that gets set "dirty" indicating that one or more of @kring's conditions have been met? |
Agreed re: the visibility API. It doesn't help. I think a dirty flag is a reasonable way to go. Ideally we would stop the |
Ken Russell touched on this topic in a recent WebGL-dev post. The first part of his message covers something we already do (aggregate events before rendering), but the next part talks about a flag that indicates whether requestAnimationFrame has yet been called for the very next frame. It's a little trickier in Cesium's case, since the requestAnimationFrame loop is handled all the way up at the widget level, and is optional even there, it can be handled at the app level (and some apps use custom render loops). Ken writes:
So, adapting this to Cesium's needs, we might do something like this:
Interestingly, this does not break backwards compatibility. Apps that relied on the default render loop will get the upgraded behavior automatically. Apps that had their own custom render loop will continue to have the old behavior: They will ignore the previously unknown event from Scene and simply call If an author wishes to upgrade such an app to the new system while keeping the app-specific custom render loop, the author removes the last line of their custom render loop where they call Old app code: (still works)
New app code: (uses new behavior)
|
Or we could encapsulate the event callback in Scene itself. There should only ever be one callback running at a time, so Scene could just be given a reference to it.
This can't go down into |
@kring this would badly mess up your target framerate watchdog stuff I think. |
Hey @emackey, you've pretty much described how it works in National Map. The main difference is we use the actual You're right that it messes up the framerate watchdog stuff. Our (fairly lame, but effective enough) approach is to ignore the watchdog if the animation shuts down before the watchdog finishes its sampling window. The assumption is that a low frame rate would make it take much longer than the sampling window to get to the point where we can stop rendering. |
I'm not sure. But if not, |
Another forum thread: https://groups.google.com/forum/#!topic/cesium-dev/X32mc77CTic |
Just wondering if there is any ETA on this issue? |
@chris-cooper no update other than #3476 will make this a bit easier. If you have the time, contributions here are appreciated. |
+1 |
@chris-cooper We have been extending ol3-cesium's AutoRenderLoop. It still isn't perfect, but it is much better than before. |
Brought up on the forum: https://groups.google.com/forum/#!topic/cesium-dev/nS_GzoZ4b5g |
I've posted our initial plans to tackle this issue on the forum here: https://groups.google.com/forum/#!topic/cesium-dev/E2XXB44zWew Please give us your feedback, including any of your thoughts or use cases there! |
For initial work here, please provide feedback on #6065. |
Feedback also welcome for additional work in #6107. |
Closing this since requestRenderMode was a success and as far as I know we don't have any additional short term plans. |
Congratulations on closing the issue! I found these Cesium forum links in the comments above: https://groups.google.com/forum/#!topic/cesium-dev/cGXhVoUacMg If this issue affects any of these threads, please post a comment like the following:
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
We talked offline about this yesterday so I figured I'd write up an issue for it. The default render loop in
CesiumWidget
andViewer
currently render at 60fps no matter what. Setting thetargetFrameRate
property can lower it, but is only useful in limited cases.What we really want to do is only render if we actually need to. This will reduce CPU load and also help with battery life (for devices where that's an issue). Here's the "rules" @kring previously came up with.
The text was updated successfully, but these errors were encountered: