Derek 朕會功夫 Derek 朕會功夫 - 1 year ago 64
Javascript Question

How to make COLLADA models cast shadow on its own?

I tried this:

dae.castShadow = true;
dae.receiveShadow = true;

//spotLight is defined already.
spotLight.castShadow = true;

renderer.shadowMapEnabled = true;

But the model still does not have shadows? Did I do anything wrong? Please help.


You need to set castShadow and receiveShadow to true for all the objects in the hierarchy.

THREE.SceneUtils.traverseHierarchy( dae, function ( child ) {

    child.castShadow = true;
    child.receiveShadow = true;

} );