Inheritance: EventDispatcher → Object3D →
A special type of camera that is positioned in 3D space to render its surroundings into a cube render target. The render target can then be used as an environment map for rendering realtime reflections in your scene.
// Create cube render target
const cubeRenderTarget = new THREE.WebGLCubeRenderTarget( 256, { generateMipmaps: true, minFilter: THREE.LinearMipmapLinearFilter } );
// Create cube camera
const cubeCamera = new THREE.CubeCamera( 1, 100000, cubeRenderTarget );
scene.add( cubeCamera );
// Create car
const chromeMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeRenderTarget.texture } );
const car = new THREE.Mesh( carGeometry, chromeMaterial );
scene.add( car );
// Update the render target cube
car.visible = false;
cubeCamera.position.copy( car.position );
cubeCamera.update( renderer, scene );
// Render the scene
car.visible = true;
renderer.render( scene, camera );
Constructs a new cube camera.
near
The camera's near plane.
far
The camera's far plane.
renderTarget
The cube render target.
The current active mipmap level
Default is 0.
The current active coordinate system.
Default is null.
A reference to the cube render target.
Calling this method will render the given scene with the given renderer into the cube render target of the camera.
renderer
The renderer.
scene
The scene to render.
Must be called when the coordinate system of the cube camera is changed.