How do you generate a random value from between two values of my choosing? So, for example, I want to generate random evenly distributed values from between, say -.5 and 7? what is the node setup to achieve this?

Thanks JK

  • $\begingroup$ You mean "random" for each object? Using the Object info node and some math or "random" through the same object (ex: per face, per vertex..)? $\endgroup$ – Carlo Jul 10 '17 at 21:36
  • 1
    $\begingroup$ So you mean "random"... what? What kind of node editor are you interested in? Could you make an example of usage of this random value? $\endgroup$ – Carlo Jul 10 '17 at 21:41

Duarte Farrajota Ramos came up with a better suggestion with the Object Info > Random value. Then you just run it into a standard linear interpolation function t*(a-b)+b. If you're feeding in random numbers 0..1 it does not matter whether a<b or a>b. You still get a value in the range a..b.

enter image description here

The extra nodes at the bottom with the vector coordinate going into the noise texture will give you a solid color, but it will be identical on all objects that use that material.

  • $\begingroup$ imgur.com/b8mputo $\endgroup$ – JKCapeTown Jul 10 '17 at 21:58
  • $\begingroup$ Hi Mutant Bob - thanks - not quite right - can you see my imgur above? the material is then noisy. it should be a solid colour randomly chosen from within the wavelength limits - side question: shouldn't you subtract the small number from the large one? $\endgroup$ – JKCapeTown Jul 10 '17 at 22:00
  • $\begingroup$ @JKCapeTown Adding a Normal node connected to the Vector input of the noise texture will make the color solid. $\endgroup$ – Matt Ferndz Jul 10 '17 at 23:25
  • 1
    $\begingroup$ Use the same node setup, instead of a Noise texture as input use the Random socket of a Object Info node $\endgroup$ – Duarte Farrajota Ramos Jul 11 '17 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.