Creates 6 cameras that render to a WebGLCubeRenderTarget.
// 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);
Constructs a CubeCamera that contains 6 PerspectiveCameras that render to a WebGLCubeRenderTarget.
See the base Object3D class for common properties.
The destination cube render target.
See the base Object3D class for common methods.
Call this to update the renderTarget.
For more info on how to obtain the source code of this module see this page.