Q:

select and modify material in a three.js scene

i have a scene(object) json file with this structure that i load with ObjectLoader.

Once added in a scene i want to modify texture to add parameters like THREE.SmoothShading, add an envMap...
i know how to find an object:   var obj = scene.getObjectByName( "bas", true );
but i have to idea how to select a material and make modification that apply to all object using this material
Can't find anything on the web, could someone help please ?
best regards

A:

This is how you can traverse your scene and set the castShadow flag on your objects. You can add more checks in there.
object.traverse( function ( child ) {

    if ( child instanceof THREE.Mesh ) {

        child.castShadow = true;

    }
});

