CubeCamera - Verge3D User Manual - Soft8Soft
Description: Learn how to use CubeCamera in your interactive 3D apps made with Verge3D

Object3D →

# CubeCamera

Creates 6 cameras that render to a WebGLCubeRenderTarget.

## Code Example

`// create cube render target const cubeRenderTarget = new v3d.WebGLCubeRenderTarget(128, { generateMipmaps: true, minFilter: v3d.LinearMipmapLinearFilter }); // create cube camera const cubeCamera = new v3d.CubeCamera(1, 100000, cubeRenderTarget); app.scene.add(cubeCamera); // assign car material const chromeMaterial = new v3d.MeshStandardMaterial({ color: 0xffffff, metalness: 1, roughness: 0.3, envMap: cubeRenderTarget.texture }); chromeMaterial.envMapAutoAssign = false; const car = app.scene.getObjectByName("Car"); car.material = chromeMaterial; // update the render target cube car.visible = false; cubeCamera.position.copy(car.position); cubeCamera.update(app.renderer, app.scene); // render the scene car.visible = true; app.renderer.render(app.scene, app.camera);`

## Constructor

### CubeCamera(near : Float, far : Float, renderTarget : WebGLCubeRenderTarget)

- near — the near clipping distance.
- far — the far clipping distance.
- renderTarget — the destination cube render target.

Constructs a CubeCamera that contains 6 PerspectiveCameras that render to a WebGLCubeRenderTarget.

## Properties

See the base Object3D class for inherited properties.

### # .renderTarget : WebGLCubeRenderTarget

The destination cube render target.

## Methods

See the base Object3D class for inherited methods.

### # .update(renderer : WebGLRenderer, scene : Scene)

- renderer — the current WebGL renderer.
- scene — the current scene.

Call this to update the renderTarget.

## Source

For more info on how to obtain the source code of this module see this page.