-
How can we get the references to the scene (camera is easy, just add one to the markup and use The simplified answer, so you don't have to scan below, is to use r3f's const {gl: renderer, scene, camera} = useThree()
// ...
renderer.render(scene, camera) // manually render the scene If you defined your own camera (f.e. with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
you can always call gl.render inside but you can also take over the render loop by providing an index: https://codesandbox.io/s/react-three-fiber-viewcube-py4db if there's a non zero index the renderloop belongs to you, and you can even chain render passes like that (bigger index comes last). once the component unmounts the renderloop goes back to normal (automated by r3f) |
Beta Was this translation helpful? Give feedback.
you can always call gl.render inside
useFrame((state, delta) => state.gl.render(state.scene, state.camera))
, for instance if you wanted to render into an off-buffer: https://codesandbox.io/s/r3f-render-target-qgcrxbut you can also take over the render loop by providing an index:
useFrame((state, delta) => ..., index)
https://codesandbox.io/s/react-three-fiber-viewcube-py4db
if there's a non zero index the renderloop belongs to you, and you can even chain render passes like that (bigger index comes last). once the component unmounts the renderloop goes back to normal (automated by r3f)