ajsmith8 Posted September 17, 2015 Share Posted September 17, 2015 I'm working on using Babylon.js to create a gaming benchmark. The primary test will measure the total time it takes to complete a game on different systems with an unlocked FPS. I've done some research and looked into the source code / docs and I could not find anyway to do this other than a few hacks My first attempt was to experiment with engine.fps and engine.fpsLimit. I tried to set engine.fpsLimit to an extremely high number, which I had hoped would unlock the frame rate, but it did not seem to do anything. Next I attempted to use this hack:www.chandlerprall.com/2011/06/beating-60fps-in-javascript/.In short, window.postMessage('','*') is added to the end of the render loop. Then you add an event listener that calls the render loop upon receiving the message, like this:window.addEventListener('message', runRenderLoop, false); This only worked somewhat. The logic within my runRenderLoop method was run at a much higher rate than 60fps, but rendering slowed to a much slower rate. engine.getFPS() only reported about 5fps, so this is also clearly unacceptable. Any ideas on how to unlock the FPS? Is there something that I am missing? Thanks for any help in advance! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 18, 2015 Share Posted September 18, 2015 Hello! Unfortunately, as we rely on requestAnimationFrame we cannot get more than 60fps. But you can still get an interesting number: the potential FPS which is 1000.0 / scene.getLastFrameDuration() ajsmith8 1 Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted June 21, 2016 Share Posted June 21, 2016 Sorry to up this topic, but i don't find after some searches a definition of potential FPS. What does 1000/scene.getLastFrameDuration() (what is the logic behind this) ? And how this is related to real FPS ? Thanks Quote Link to comment Share on other sites More sharing options...
davrous Posted June 21, 2016 Share Posted June 21, 2016 Hi, First of all, cool project! We had the idea in the past to work on such a project (benchmark) but never had the time to work on it. ;-) In the browser, the best way to render the frame with efficiency is to use requestAnimationFrame that will let the browser deciding when to call you back based on its current utilization. It's far better than using setTimeout(1000/60) for instance. Anyway even with setTimeout set to 8 for instance to try to have 120fps, all browsers will limit the rendering to 60fps. Some recent Chrome builds have unlocked the FPS to 90 for WebVR and Oculus/Vive support. In conclusion: you can't ask to the browser to unlock the FPS like you can do in Win32 apps. That's why @deltakosh shares what we're using inside our debug layer tool, the potential FPS. Indeed, we know inside our engine the time it tooks to compute the last frame. For instance, let's say the current fps is 60 but the potential FPS is 200, it means that your GPU & browser could potentially display 200 fps. Unfortunately, this is not that simple. There are cases a bit more complex. Let's take the Mansion scene of babylonjs.com. It runs at 30 fps on my small laptop and says the potential fps is 50. This means that I'm losing rendering performance due to some job done on the CPU side (collision, physics, whatever). For your benchmark, you need to think about an algorithm / tests cases that will mix: - complex scenes like Sponza or Mansion that will stress the complete system: CPU, GPU & Browsers' implementation. Your score will then be computed based on an average FPS during the sequence provided by requestAnimationFrame callbacks + the potential FPS provided by getLastFrameDuration - pure GPU side scenes (using a unique draw call for instance) without anything enable on the CPU side (no collision, no physic, no sound, no input). The potential FPS will be probably what you would get if the browser would unlock the FPS Bye, David V!nc3r, jerome, Boz and 1 other 4 Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted June 21, 2016 Share Posted June 21, 2016 Ok, thanks for explanations, i now understand better ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.