Limit Frame Rate

Hello, I want to limit my FPS to 30. anyone please help with any pointers on how to archive this.

Hi @DANIEL_S

Maybe @sebavan can help on this one ?

you could render 1 frame on two ? as long as your average frequency of request animation frame is about 30 ?

@sebavan I have something like this. it seems to slow for my camera. I wonder how I’d have bigger control forexample if I want to set FPS to about 45 or 50.

this.skip = false
            this._engine.runRenderLoop(() => {
                if (!this.skip) {
                    scene.render()
                }
                this.skip = !this.skip
            })

this would be almost impossible to control unfortunately as there is nothing for this in webgl.

The browser is deciding for you :frowning: and will tend to cap at either 60 or 30 if it goes below 45.

You would have to build your own renderloop and keep track of last render time :slight_smile:

something like this… (note, PG fps label is not accurate & don’t click run multiple times.)
https://playground.babylonjs.com/#ERBL2T

Also, it doesn’t care if the target fps is too high to render, it’ll just keep going and trying.

You can try this: