The copy
function on a number of materials assume that they are copying from the same material type and don’t check if a field exists before trying to copy it, resulting in an error.
In this case, the Phong material tries to copy the specular
color from the Lambert material, which does not exist.
(new THREE.MeshPhongMaterial()).copy(new THREE.MeshLambertMaterial());
// Throws error on
// https://github.com/mrdoob/three.js/blob/dev/src/materials/MeshPhongMaterial.js#L122
One possible fix would just be to check if a field exists before trying to call copy on it.
I don’t think that has been suggested. Even if NodeMaterial were merged into
src/
immediately, we’d still want to keep a backward-compatible interface for existing materials, and functional.copy()
methods should be part of that.