glodrei
Version:
useful add-ons for react-three-fiber
33 lines (26 loc) • 844 B
text/mdx
title: Fbo / useFBO
sourcecode: src/core/Fbo.tsx
[](https://drei.vercel.app/?path=/story/misc-fbo)
Creates a `THREE.WebGLRenderTarget`.
```tsx
type FBOSettings = {
/** Defines the count of MSAA samples. Can only be used with WebGL 2. Default: 0 */
samples?: number
/** If set, the scene depth will be rendered into buffer.depthTexture. Default: false */
depth?: boolean
} & THREE.RenderTargetOptions
export function useFBO(
/** Width in pixels, or settings (will render fullscreen by default) */
width?: number | FBOSettings,
/** Height in pixels */
height?: number,
/**Settings */
settings?: FBOSettings
): THREE.WebGLRenderTarget {
```
```jsx
const target = useFBO({ stencilBuffer: false })
```
The rendertarget is automatically disposed when unmounted.