Is there any way pass Mesh userData to tsl Node material ?
Use case :
*We can have multiple meshes with single shared node material.
*The color of the node material should depend of the mesh userData color.
You could do this in blender. The color of the material depends on the color data of each mesh.
dubois
2
Something like:
myNode.foo = myMesh.userData.foo
Should do the trick
This works but it sets the cubeMesh.userData.color
to every obj where the materialNode
is used.
const materialNode = new MeshStandardNodeMaterial()
const cubeGeo = new BoxGeometry()
const cubeMesh = new Mesh(cubeGeo, materialNode);
cubeMesh.userData = { color: "0xff00aa" }
const col = new Color()
col.setHex(cubeMesh.userData.color)
const ucol = uniform(col)
materialNode.colorNode = ucol;
There is this userData node. I am not sure, if we can use this to get the user data inside the node material
dubois
6
Wow interesting. With normal materials you would create an instance for each color.