Casting shadows on MeshPhongMaterial or MeshLambertMaterial in Three.js

I feel like I'm missing something simple here.

I used JSFiddle by @WestLangley , which shows how to cast a shadow from an object onto a plane.

Everything works as expected when the plane is filled only with color:

var groundMaterial = new THREE.MeshLambertMaterial({ color: 0xFF0000 }); 

enter image description here

Then I change it to use texture:

 var groundMaterial = new THREE.MeshLambertMaterial({ // color: 0xFF0000, map: texture }); 

.. suddenly, the shadow disappeared:

enter image description here

This happens with both MeshPhongMaterial and MeshLambertMaterial .

Please note that neither the camera position nor the shadow setting changes. Everything remains unchanged, but the shadow is gone.

Should the texture “say” to receive light, or is it something else?

Tested on r61, r66, r67.

+6
source share

Source: https://habr.com/ru/post/972196/


All Articles