nodeObject
Creates a placeholder in a shared material that allows it to dynamically read data from each individual object's properties (userData) at render time.
Core Advantages
By decoupling data from logic, it allows thousands of objects to share a single material while retaining individual properties, achieving ultimate performance and memory efficiency.
Common Uses
Batch customizing the color of different objects
Independently controlling the effect strength or switch for a single object
Adding random offsets for crowd animations
How to adjust
At runtime, by changing the node stored in an individual object's `userData` (e.g., swapping a static color node for another), that object's shader behavior can be changed in real-time and independently, without affecting other objects sharing the same material.
Code Examples
1// In material: use nodeObject as a placeholder
2material.colorNode = perObjectColor;
3
4// On object: provide the actual node via userData
5mesh.userData.perObjectColor = color( 'red' );