-
-
Notifications
You must be signed in to change notification settings - Fork 36k
Closed
Description
Description
If an array of node materials e.g. MeshPhysicalNodeMaterial is used as the material for a Mesh, The Threejs WebGL renderer will exit with the following error -
Uncaught TypeError: Cannot set properties of undefined (setting 'value')
at getProgram (three.module.js:29540:38)
at setProgram (three.module.js:29740:15)
at WebGLRenderer.renderBufferDirect (three.module.js:28759:20)
at renderObject (three.module.js:29451:11)
at renderObjects (three.module.js:29420:6)
at renderScene (three.module.js:29289:36)
at WebGLRenderer.render (three.module.js:29107:5)
at animate (?editor_console=true:196:14)
It works as intended with other regular materials e.g. MeshPhongMaterial and used to work with old versions of the node material system (years ago).
Reproduction steps
- Add a mesh to a scene with an array of node materials
- Render
Code
const geometry = new THREE.SphereGeometry( 5, 12, 8 ).toNonIndexed();
geometry.addGroup(0, 252, 0)
geometry.addGroup(252, 252, 1)
const nodeMaterial1 = new MeshPhysicalNodeMaterial({color:new THREE.Color('red')});
const nodeMaterial2 = new MeshPhysicalNodeMaterial({color:new THREE.Color('yellow')});
const nodeMaterial = [nodeMaterial1, nodeMaterial2]
mesh = new THREE.Mesh( geometry, nodeMaterial );
Live example
Comment/Uncomment the mesh lines at the end of the script to toggle between regular and node materials.
(MeshPhongMaterial is uncommented by default)
Screenshots
No response
Version
156
Device
No response
Browser
No response
OS
No response
Metadata
Metadata
Assignees
Labels
No labels