Pmndrs.docs

CubeCamera

A THREE.CubeCamera that returns its texture as a render-prop. It makes children invisible while rendering to the internal buffer so that they are not included in the reflection.

Using the frames prop you can control if this camera renders indefinitively or statically (a given number of times). If you have two static objects in the scene, make it frames={2} for instance, so that both objects get to "see" one another in the reflections, which takes multiple renders. If you have moving objects, unset the prop and use a smaller resolution instead.

import { CubeCamera } from '@react-three/drei'
;<CubeCamera
  resolution={256} // Size of the off-buffer (256 by default)
  frames={Infinity} // How many frames it should render (Indefinitively by default)
  fog={customFog} // Allows you to pass a Fog or FogExp2 instance for a smaller frustrum
  near={1}
  far={1000}
>
  {(texture) => (
    <mesh>
      <sphereGeometry />
      <meshStandardMaterial envMap={texture} />
    </mesh>
  )}
</CubeCamera>