Search the Community
Showing results for tags 'runrenderloop'.
-
I'm new to BabylonJS but one of the first things I notice is that almost all of the demos run slow (20-30 FPS is typical) on the same machine that is running three.js stuff fast. It seems like update/draw is not being called as often as it could be, as according to the debug overlay update and draw frame time is only 10ms in these same demos (so potential FPS is 100). Additionally I think BabylonJS suffers from timing flaws that other JS engines do, see this article: https://www.isaacsukin.com/news/2015/01/detailed-explanation-javascript-game-loops-and-timing In three.js I am using Mainloop.js to control update/draw timing logic. I think I would like to do the same in babylon.js, unless I am missing something. To expand further, physics should ideally be at a 30hz update rate in my game, but draw calls and other update logic should be at 60hz. Also update logic should be called at a very consistent 60hz, where draw can vary a bit from 40-60fps without real harm. (Draw lag spikes are permissible but update lag spikes should be dealt with by calling update twice to catch up and make game logic and especially physics have predictable behavior and equal time per step.) Is there a way without forking Babylon to override the update/draw timing logic? I notice the functions beginFrame() and endFrame() are public. Can I just call beginFrame, do my render calls, and then call endFrame? Will this break anything? What should "do my render calls" look like? Again I would prefer to not modify babylon.js itself, and instead just override its behavior because I don't want to maintain a fork.
- 5 replies
-
- fps
- requestanimationframe
-
(and 2 more)
Tagged with: