Sharing a NodeMaterial For Multiple Objects with Unique Uniforms

I want to know how I can use one shared NodeMaterial for multiple objects, each with different uniforms. From what I’ve gathered on this forum, with the old material system, you could only achieve this using a ShaderMaterial and the .onBeforeRender() method. Is there a better way to do this built into the new material system?

One option would be to update the uniform value of the material in the onObjectUpdate callback, but there may be other ways as well.

The following example using node material should do what you are looking for: three.js webgpu - instance uniform

The example extracts a value from a 3D object (color) and uses it to update a uniform value.

1 Like

This is what i’m looking for. Thanks!