Replies: 1 comment 1 reply
-
you can take a look into renderer.tsx, the first part of that file. if you see an obvious way to make this an official feature submit a pr. r3f has its own loop, and it will run regardless. since you invalidate the canvas (it needs to be set to invalidateFrameloop) you can in theory invalidate step by step and cap it that way. i don't know that the 30ms frame is, what's in it? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to implement an FPS cap feature in my Typescript project, but it is not working the way I expect and I still have no clue if I am doing something wrong. What I want to achieve is to be able to reduce the FPS from 60 to 30, for example.
In my Canvas, the first thing I do is set the
invalidateFrameloop
property to true, like this:I also created a
Render
component that is responsible for manually triggering the the rendering of frames, and added to the Canvas. This is the code of the component:There is also the
Box
component that is just a rotating cube used for debugging, which is this file box.zip.It appears to be working

but when I profile on Chrome the frames are being generated in an irregular way, there is always one frame taking ~33ms followed by a ~16.6ms one. So, in average I do not get 30 FPS in reality.

Do you guys have any idea what could be wrong, or maybe a better way to implement this feature?
Thanks!
Edit: I fixed the FPS target from 20 to 30.
Beta Was this translation helpful? Give feedback.
All reactions