Search code examples
javascriptthree.jscollada

How to make COLLADA models cast shadow on its own in three.js?


I tried this:

dae.castShadow = true;
dae.receiveShadow = true;
scene.add(dae);

//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.


Solution

  • 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;
    
    } );