I am working with 3D models that are structured like this:
https://i.sstatic.net/osXTl.png
My goal is to incorporate a cast shadow similar to this:
https://i.sstatic.net/DBrRr.png
Here is the code snippet responsible for handling the model:
var ambLight = new THREE.AmbientLight( 0x404040 );
this.scene.add(ambLight)
var loader = new THREE.GLTFLoader();
loader.load(path,function (gltf) {
gltf.scene.traverse( function( model ) {
if (model.isMesh){
model.castShadow = true;
}
});
this.scene.add(gltf.scene);
}
I implemented the castSHadow
part based on guidance from this StackOverflow thread.
I have attempted using model.castShadow = true
, as well as removing the if
condition and solely having castShadow
, but neither approach has yielded successful results. Is there a step I might be overlooking? For reference, the complete custom layer code can be found here.