sparkhead95 sparkhead95 - 22 days ago 9
HTML Question

ShadowMap not casting shadows on mesh using three.js

I'm trying to use three.js spotlight to cast a shadow from a ball mesh (phong material) onto a floor mesh (phong material), however it doesn't seem to be working - here is what I have https://jsfiddle.net/m6t43ob5/1/

As you can see, I have enabled the shadow map using:

renderer.shadowMap.Enabled = true;


And my light is definitely casting shadows:

spotLight.castShadow = true;


My floor mesh is definitely set up to receive shadows:

floor.receiveShadow = true;


And my ball mesh is set up to cast shadows:

ball.castShadow = true;


So I just don't understand what I could be missing to cast my shadow? I've researched and it seems most other people have fixed it by adding the shadowmap enabled value but I've added this and it still doesn't work.
Appreciate the help!

Answer

Should be:

renderer.shadowMap.enabled = true;