New Video! Randomize Properties in Blender

April 16, 2012

Update: New in Blender 2.64 — For randomizing material properties, the new Object Info node and its random number output could be an alternative to the driver technique described in this video.

This tutorial shows how to attach random number drivers to selected properties to make endless variations of an object in Blender 2.62.

Video Link >>>   Variations: Random Number Drivers in Blender

Go from this

a lego-like model in Blender

a lego-like model in Blender

to this

variations of lego-like blocks automatically generated

variations of lego-like blocks automatically generated

I found it easy to work with drivers on object and mesh properties. But I found it surprisingly difficult to get drivers to work on properties in material, texture, and node datablocks. This video will show you the secrets to coercing drivers to work anywhere:

  • learn multiple ways to create a driver; when one method fails, another will work
  • learn how to fix broken drivers after copying an object
  • workflow tips for managing many drivers, objects, and datablocks
This video is for the intermediate Blender user who already feels comfortable with the Blender UI, but no prior experience is expected with drivers or Python scripting. I’ll do my best to show you not just what buttons to click, but why.


Here is the copy-n-paste part referred to in the video:
import bpy
import random

# Random floating point number between lo and hi

def randf(lo, hi):
    return random.uniform(lo, hi)

# Random integer from lo (inclusive) to hi (inclusive)

def randi(lo, hi):
    return random.randint(lo, hi)

# Random values given mean and standard deviation

def gauss(mean, stdev):
    return random.gauss(mean, stdev)["randf"] = randf["randi"] = randi["gauss"] = gauss


5 Comments to "New Video! Randomize Properties in Blender"

  1. Germano Cavalcante wrote:

    Hello David,
    great tutorials
    I wonder if there is some way to apply individual drivers for each particle in a field of grass.
    for example a drive “Render Resolution U” a function of distance between the camera and each particle (which is a Besier curve).
    thank you

  2. Mitch wrote:

    Thoroughly enjoyed your tutorial and managed to drive my material colours by sampling an image while listening, that outliner datablock trick is a great thing to know I had tried driving materials previously with no luck.
    Thanks so much.

  3. Stephen Norrington wrote:

    Hi Dave,thanks for this randomizing tutorial, very helpful – I’m using your method to randomize the mapping of textures over thousands of rigid body objects.

    Related question: when duplicating an object that has a material that has a driver controlling a node’s factor value, if that driver references the original object, the duplicate copy of the driver still references the original object (when it should rationally have updated itself to reference the duplicate object)

    I tried unsuccessfully to apply your method of fixing broken drivers but have not been able to find a way to cause drivers to update their references upon duplication.

    Any info you can offer will be much appreciated.

    Thanks, best, Stephen Norrington

  4. Dave wrote:

    Hi Stephen, and thanks for the note.I’m afraid I don’t know of any additional tricks beyond what was shown in the video. You might want to tell us the output location of the driver. That’s the python expression that is shown in the Active F-Curve pane of the driver properties panel. Maybe there’s something in that string that can be tweaked.
    — drm

  5. shaheen wrote:

    Such a well-paced and thorough tutorial. I had never used coding in blender before and was hesitant. But this tutorial was so clear that I felt happy I knew exactly what I was doing. It was very very useful and multipurpose. I used it in a generated texture, size variation, gamma flickering, etc. Very very helpful. Thanks a LOT!!

Powered by Wordpress and MySQL. Theme by Shlomi Noach,