6

How can I randomize a numerical value for a node? Is there any one node, or combination of nodes that can achieve this effect?

Thom Blair III
  • 16,535
  • 20
  • 75
  • 112

1 Answers1

6

Object Info Node's Random Output

I just discovered there is an Input node that can output a random value:
Input -> Object Info
However, it only works for Material Shader nodes.

Here is the Blender wiki description of this node:

Object Info
Information about the object instance. This can be useful to give some variation to a single material assigned to multiple instances, either manually controlled through the object index, based on the object location, or randomized for each instance. For example a Noise texture can give random colors or a Color ramp can give a range of colors to be randomly picked from.

Note that this node only works for material shading nodes; it does nothing for lamp and world shading nodes.

Location: Location of the object in world space.
Object: Index Object pass index, same as in the Object Index pass.transformed.
Material Index: Material pass index, same as in the Material Index pass.
Random: Random number unique to a single object instance.

Thom Blair III
  • 16,535
  • 20
  • 75
  • 112
  • That is only for shader nodes, right? – Greg Zaal Mar 26 '14 at 11:30
  • Yes, Greg, you're right. – Thom Blair III Mar 26 '14 at 16:26
  • 2
    Duplicate of this. My answer of using a driven value node is also available within composite nodes. – sambler Mar 27 '14 at 03:09
  • Sambler, thanks for the tip. That is exactly what I was looking for, but I have no experience coding. Do you have any suggestions on beginning tutorials for implementing your suggestion? – Thom Blair III Mar 27 '14 at 03:28
  • Sambler, can that technique be turned into a script to make a Random Value node? I know how to get a script for a node into Blender. That would be SO awesome! – Thom Blair III Mar 28 '14 at 02:52
  • Actually Sambler, I got it to work! Thanks! I just put #noise.random() in for the value...I hadn't realized you can do that. – Thom Blair III Mar 28 '14 at 02:59
  • Wait a second, I did NOT get it to work. When I add a Value node into a blank Compositor screen and set it's value to #noise.random(), after I click away, the value changes every time I move the node or move the mouse over the node. BUT, when I add the node to an existing node tree & enter #noise.random(), the value stays set to a fixed number and doesn't change, even though the field stays purple (indicating it's a calculated value I assume). Why doesn't it continue to be random when other nodes are present? – Thom Blair III Mar 28 '14 at 20:31