# Using random values on each instance in Node Shader

**URL:** <https://forum.babylonjs.com/t/using-random-values-on-each-instance-in-node-shader/20917>\
**Category:** Questions\
**Tags:** material\
**Created:** [May 18, 2021, 4:44pm UTC](https://forum.babylonjs.com/t/using-random-values-on-each-instance-in-node-shader/20917 "2021-05-18T16:44:03Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Raggar](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raggar/32/20672_2.png) [@Raggar](https://forum.babylonjs.com/u/Raggar)\
**Post date:** [May 18, 2021, 6:25pm UTC](https://forum.babylonjs.com/t/using-random-values-on-each-instance-in-node-shader/20917/4 "2021-05-18T18:25:07Z")

</div>

Here’s an example of your original version, simply changing your Vector2 to an attribute and rebuilding the material. That does the trick as well, and doesn’t waste buffer space.  
[https://playground.babylonjs.com/#QC0SPD#5](https://playground.babylonjs.com/#QC0SPD#5)

Unless you have some plan for the remaining color channels, I would go with a Vector2. Position, rotation and scale are all handled in the transform, so I don’t see the idea of using a shader to manually change those. You could instead use the channels to add effects like random sway, wind-dependent sway and other tree-behavior.

---

_[View the full topic](https://forum.babylonjs.com/t/using-random-values-on-each-instance-in-node-shader/20917)._
