question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some materials cannot copy from other material types

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
donmccurdycommented, Jul 2, 2018

I think no more work will be done on existing materials, because of the upcoming Node Material.

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Materials not copying to a copied classroom - Google Help
I have created a classroom for a Year 9 class I have and set out topics and added (lots of) materials. There are...
Read more >
How do you copy, paste, save and load materials in Lumion ...
1. There are five ways to transfer materials Copying and pasting a material. Saving and loading a material from a file. Saving a......
Read more >
Copy-Paste Values Additional Material Properties - YouTube
Copy -paste any of the additional material properties. ... try restarting your device. Your browser can't play this video.
Read more >
Blender 2.8 Tutorial: Copy Material - YouTube
I quick and easy method for copying materials to another object.#Blender # Material #Tutorial.
Read more >
Copy Material Master Record -- All Answers will be rewarded
Hello All, I need to copy the set of materials from one plant to another plant. Say I need to copy Materials from...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found