Reputation: 107
I'm trying to get my head around three.js shadows. Currently have a scene set up with an object set to cast shadows and a floor set to receive them.
floor.receiveShadow = true;
Unfortunately the shadows aren't showing up. I'm sure i'm doing something daft. Any ideas would be great!
Example here: http://codepen.io/popmatik/pen/oLwPrk?editors=0010
Thanks
Upvotes: 1
Views: 1716
Reputation: 8423
The following code worked for me (thanks @Ramil Kudashev):
let spotlight = new THREE.SpotLight(0xfdf8d8, 0.3, 400, 0.8, 0.5, 1);
spotlight.target = <Some3DObjectToPointAt>;
spotlight.shadow = new THREE.SpotLightShadow(new THREE.PerspectiveCamera(20, 1, 1, 250));
spotlight.castShadow = true;
//Add to scene somewhere
Ramil suggested using THREE.LightShadow
, I had to pass THREE.SpotLightShadow
(v0.110.0)
Tried changing camera FOV
and FAR
, but it did not seem to change the result.
Upvotes: 2