How to change SpotLight shadowCameraNear parameter in THREE.js?

241 views Asked by At

How do I change the shadowCameraNear and shadowCameraFar parameters of SpotLight?

In this demo, I change the shadowCameraNear parameter in the animation loop, but even though console.log() shows the change happened, the shadowCameraVisible helper object shows no change.

JSFiddle Demo

1

There are 1 answers

0
WestLangley On BEST ANSWER

Here is the pattern you need to follow if you want to change a light's shadowCamera parameters dynamically.

light.shadowCameraNear += 0.01;

light.shadowCamera.near = light.shadowCameraNear;

light.shadowCamera.updateProjectionMatrix(); // important

updated fiddle: http://jsfiddle.net/3h8h1pzd/21/

three.js r.69