# Sharing a NodeMaterial For Multiple Objects with Unique Uniforms

**URL:** <https://discourse.threejs.org/t/sharing-a-nodematerial-for-multiple-objects-with-unique-uniforms/77316>\
**Category:** Questions\
**Tags:** node-material, uniforms, materials\
**Created:** [January 30, 2025, 1:22pm UTC](https://discourse.threejs.org/t/sharing-a-nodematerial-for-multiple-objects-with-unique-uniforms/77316 "2025-01-30T13:22:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![michealmyers81](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/michealmyers81/32/35656_2.png) [@michealmyers81](https://discourse.threejs.org/u/michealmyers81)\
**Post date:** [January 30, 2025, 1:22pm UTC](https://discourse.threejs.org/t/sharing-a-nodematerial-for-multiple-objects-with-unique-uniforms/77316/1 "2025-01-30T13:22:36Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [January 30, 2025, 2:52pm UTC](https://discourse.threejs.org/t/sharing-a-nodematerial-for-multiple-objects-with-unique-uniforms/77316/2 "2025-01-30T14:52:05Z")

</div>

One option would be to update the uniform value of the material in the [onObjectUpdate](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language#uniformonupdate) callback, but there may be other ways as well.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [January 30, 2025, 3:04pm UTC](https://discourse.threejs.org/t/sharing-a-nodematerial-for-multiple-objects-with-unique-uniforms/77316/3 "2025-01-30T15:04:45Z")

</div>

The following example using node material should do what you are looking for: [three.js webgpu - instance uniform](https://threejs.org/examples/webgpu_instance_uniform)

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

---

<div class="post-metadata">

**Author:** ![michealmyers81](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/michealmyers81/32/35656_2.png) [@michealmyers81](https://discourse.threejs.org/u/michealmyers81)\
**Post date:** [January 30, 2025, 4:00pm UTC](https://discourse.threejs.org/t/sharing-a-nodematerial-for-multiple-objects-with-unique-uniforms/77316/4 "2025-01-30T16:00:58Z")

</div>

This is what i’m looking for. Thanks!
