Using random values on each instance in Node Shader

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

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.

1 Like