![blender donut tutorial randomize not working blender donut tutorial randomize not working](https://i.ytimg.com/vi/rKPSB8tcXhQ/maxresdefault.jpg)
I've recently used another way to randomly scatter objects, also haphazardly affecting their scales and rotation in the process: select the objects, and open the Object menu → Transform → Randomize Transform. These are two obvious ways which I'm not going to discuss here, there's plenty of other good tutorials explaining how that's done. Obvious ones are particle systems – think sprinkles in Andrew Price's doughnut tutorial – and physics – which you could have used to have a large number of object acting as sprinkles be subject to gravity and fall on top of the doughnut (much like in real life). 3 Randomising Transformsīlender offers several ways to randomise object transforms such as location, rotation and scale. So in essence, the randomisation isn't generated at object creation, but rather at script execution. This is what the snippet will do every time you hit the Run Script button. The API is so convenient and Python so readable that this listing pretty much reads like English: for each selected object in the file, set its material to a random choice from all the materials available in the file.
![blender donut tutorial randomize not working blender donut tutorial randomize not working](https://i.ytimg.com/vi/jCl3Hyb09T0/maxresdefault.jpg)
Open the Scripting workspace, create a new text data-block and throw the following code in it:
![blender donut tutorial randomize not working blender donut tutorial randomize not working](https://i.pinimg.com/originals/60/86/80/6086801f380f6e8a45df06fc07cf734c.jpg)
And easier way might be to leave it to Blender's superb Python interface. These approaches lead to complex and unmanageable node setups. Randomising colours is a good start, but what about randomising textures? Or even whole materials? Various solutions are offered on the web, many of which suggesting to use the Object Info's Random output together with the GreaterThan and LessThan operations of the Math node. open the ColorRamp's Interpolation menu whose value defaults to Linear, and choose Constant instead. If you want to have just red, or just green, or just blue, etc. You may not want to have this setup choose from the near-infinity of colours the gradient range offers, as in very red, or slightly less red and a bit more green, or somewhere between green and blue, etc. Its resulting Image output will therefore be a random colour picked from the gradient.Ĭanonical Node Setup for Randomising Colours Connect it to the Factor input of a ColorRamp node, as the Factor socket is used in this node as an index for its gradient. 1 Randomising ColoursĪ very common trick which I first learned from Andrew Price (as with everything else) is to use the Random output from the Object Info node, which generates a random number unique to the object. An overview of the random ways Blender makes it possible to randomly randomise random things, randomly ranging from colours, to materials, to transforms.