After importing an obj using this load function:
// triggered when the resource is loaded
function ( obj ) {
// For any meshes in the model, add our material.
obj.traverse( function ( element ) {
if ( element instanceof THREE.Mesh ){
//node.material = material;
//node.geometry.computeVertexNormals();
element.castShadow = true;
element.receiveShadow = true;
}
} );
obj.scale.set(0.5,0.5,0.5);
scene.add( obj );
parts[partName] = obj;
}
The obj loads successfully and casts shadows from the spotlights in the scene. However, when I try to apply a material to the mesh (hence why that part is commented out in the code above), the model no longer receives shadows.
The materials are applied node by node, and the materials are mapped as jpg's like this.
if ( node.isMesh ) node.material = material;
new THREE.MeshBasicMaterial( { map: new THREE.TextureLoader().load( 'materials/orange.jpg' ), shininess: 50, shading: THREE.SmoothShading }),
Any assistance would be greatly appreciated. Thank you, Ed.