Replies: 1 comment
-
when you disable the render loop it will stop rendering the model. i don't know why you would expect it to keep on rendering. frameloop=demand will not run a loop. it only renders (once!) per change made to anything in the component graph. or, when you have controls that are active. if it wouldn't render you wouldn't see movement, orbitcontrols for instance must invalidate the frameloop if they're active. it will immediately shut down afterwards and only wake up on changes again. there are other routes you must go to get performance on mobile: lesser models, lesser textures, smaller pixel density. other than that, i don't know how you are using r3f in rn. there is no official target yet and #1384 doesn't see to go forward. if there is a better way for RN i'd be glad if you could take the pr over and fix that, too. personally i know nothing about rn, i wish i could help ... |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using the library with React Native to render some simple graphics on an iPhone 6S but I am finding that CPU shoots to 100% (measure with Xcode 12.5) and stays there regardless of 3D model complexity. FPS is around 5-7.
After much debugging I found that it's due to the constant JS function calls using
requestAnimationFrame
. Unfortunately for React Native, any calls to a timer causes the "bridge" to serialize the call (to JSON), carry it over to native code, schedule the timer, trigger the timer, serialize again, call in native, deserialize in JS, call JS. This process repeats infinitely, causing any attempt to use things like OrbitControls to be a terrible experience.I understand that v6 will have the ability to disable the render loop / set it to 'on demand' but I fear that if the default will still be badly performing. Given that the renderloop doesn't actually render the model and simply disabling it will actually still render the model, and both React Native and web browsers have event-driven UIs, it should be possible to make it work without an infinite loop.
Are there plans to default to disabling the render loop or perhaps have a different API that can easily be leveraged? Otherwise this library doesn't really work well for mobile use cases for more than a few seconds, as the battery will quickly drain regardless of model complexity.
This is v5.3.19, React Native 0.63. iPhone 6S with iOS 13.3. An iPhone X will reach maybe ~30 fps (estimated, not measured).
Beta Was this translation helpful? Give feedback.
All reactions