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.

TypeError when copying MeshStandardMaterial to MeshPhysicalMaterial

See original GitHub issue
Description of the problem

When passing a MeshStandardMaterial to MeshPhysicalMaterial.copy(), the following error occurs

  TypeError
      at Vector2.copy 
      at MeshPhysicalMaterial.copy

https://github.com/mrdoob/three.js/blob/d39dabbdc5ff35326a0ae0512773ebca95fe3555/src/materials/MeshPhysicalMaterial.js#L74

source.clearcoatNormalScale is undefined on MeshStandardMaterial, which leads to the error.

Please also include a live example if possible. You can start from these templates:

Three.js version
  • Dev
  • [x ] r108
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, …)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
akutruffcommented, Sep 30, 2019

Actually, there is a problem still. After using the constructor version, the MeshPhysicalMaterial has .defines as STANDARD and not PHYSICAL. The .type property is also clobbered and is now MeshStanadardMaterial.

2reactions
akutruffcommented, Sep 25, 2019

Nice! Using the constructor seems to do the trick at first blush. Will keep monitoring.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error in three.js :- Materials[json.type] is not a constructor
It was an old object file from R72, and the type it was returning was "MeshFaceMaterial". But that type no longer exists in...
Read more >
MeshPhysicalMaterial – three.js docs
Any property of the material (including any property inherited from Material and MeshStandardMaterial) can be passed in here. The exception is the property ......
Read more >
three.js - Apple Open Source
fromArray( this.elements ); }, copy: function ( m ) { var te ... function MeshPhysicalMaterial( parameters ) { MeshStandardMaterial.call( this ); ...
Read more >
Module Specifiers Versus Relative Import References
Uncaught TypeError: Failed to resolve module specifier "three". Relative references must start with either "/", "./", or "../".
Read more >
ThreeJS Test - Github-Gist
Share Copy sharable link for this gist. ... else{var K=E.camera;p.copy(E.mapSize);p.min(n) ... isArray(a))throw new TypeError("THREE.
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