A RenderTexture can be used to render a scene to a texture automatically by assigning it to the Camera component's targetTexture property. You can then assign the RenderTexture.texture to materials to be displayed

// create new RenderTexture with a resolution
const rt = new RenderTexture(256, 256);
// assign to a camera
myCameraComponent.targetTexture = rt;
// assign to a material
myMaterial.map = rt.texture;

Hierarchy

  • WebGLRenderTarget
    • RenderTexture

Constructors

Methods

Constructors

  • Parameters

    • Optionalwidth: number
    • Optionalheight: number
    • Optionaloptions: RenderTargetOptions

    Returns RenderTexture

Methods

  • Render the scene to the texture

    Parameters

    • scene: Object3D<Object3DEventMap>

      The scene to render

    • camera: Camera

      The camera to render from

    • renderer: WebGLRenderer | EffectComposer

      The renderer or effectcomposer to use

    Returns void