Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make ShadowCamera visible in three.js r73?

Light.shadowCameraVisible = true;

gives a warning

THREE.Light: .shadowCameraVisible has been removed. Use new THREE.CameraHelper( light.shadow ) instead.

on adding

Scene.add(new THREE.CameraHelper(Light.shadow ));

gives an error

Uncaught TypeError: this.camera.updateProjectionMatrix is not a function (three.js :35002)
like image 472
ArUn Avatar asked Feb 03 '16 08:02

ArUn


1 Answers

The CameraHelper constructor takes a Camera object:

var light = new THREE.SpotLight( 0xFFAA55 );
light.castShadow = true;

var helper = new THREE.CameraHelper( light.shadow.camera );
scene.add( helper );

Three.js r107

Example: http://jsfiddle.net/kvnc1g4y/

like image 52
Falk Thiele Avatar answered Oct 10 '22 02:10

Falk Thiele