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.

[Enhancement] onBeforeCompile may break material's .clone() method

See original GitHub issue
Description of the problem

onBeforeCompile seems to be ignored when cloning materials:

https://codepen.io/anon/pen/yjPLrJ?editors=1010

Expected result is equal amount of yellow and red cubes.

Proposing to either:

  1. consider Material.onBeforeCompile when cloning
  2. document that there should be no cloning happening after setting this callback
  3. document that .clone() is non deterministic, it’s going to be a different clone depending on the presence of onBeforeCompile
Three.js version
  • Dev
  • r92
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 5 years ago
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
WestLangleycommented, May 7, 2018

I guess I’m wondering whether we should try to keep improving hooks for replacement into shaders and onBeforeCompile, or whether we should be spending time on that instead. For example, implement glTF’s spec/gloss materials as THREE.NodeStandardSGMaterial.

I agree, focusing on NodeMaterial would be a much better use of our time – and we could follow that up with a graphical API to go with it.

2reactions
donmccurdycommented, May 7, 2018

As of 2015 there was the idea that NodeMaterial might eventually be in src/*… I guess I’m wondering whether we should try to keep improving hooks for replacement into shaders and onBeforeCompile, or whether we should be spending time on that instead. For example, implement glTF’s spec/gloss materials as THREE.NodeStandardSGMaterial.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Material#onBeforeCompile – three.js docs
Materials describe the appearance of objects. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you...
Read more >
THREE.ShaderMaterial cannot perform antialiasing
I created a ShaderMaterial to draw a box in three.js using the following key code: //magnetic orientation let magnetMaterial = new THREE.
Read more >
v7 Changelog | Viewer | Autodesk Platform Services
Fixed. FusionSim panel gets cloned when a new model is loaded reusing the same viewer. Thumbnails of PDF sheets not loading in Document...
Read more >
Unity on Apple silicon and Big Sur: Known issues and ...
Be prepared for Apple to break it though by Beta 4 ! lol ... Is there any way we can get Unity 2020.2b1...
Read more >
ChangeLog - external/v8 - Git at Google
Classes: Add super support in methods and accessors (issue 3330). ... Don't expose Array.prototype.values as it breaks webcompat (Chromium. issue 409858).
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