three.js: [Enhancement] onBeforeCompile may break material's .clone() method
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:
- consider
Material.onBeforeCompilewhen cloning - document that there should be no cloning happening after setting this callback
- document that
.clone()is non deterministic, it’s going to be a different clone depending on the presence ofonBeforeCompile
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, …)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (11 by maintainers)
I agree, focusing on
NodeMaterialwould be a much better use of our time – and we could follow that up with a graphical API to go with it.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 andonBeforeCompile, or whether we should be spending time on that instead. For example, implement glTF’s spec/gloss materials asTHREE.NodeStandardSGMaterial.