Simple PyConstraint: Noise

Made this for our last animation project - a new animator missed the noise controller in Max, so this filled the gap and was useful for a lot of things.

Basically, it gives random (yet deterministic) animation on an object’s location, rotation and scale, with variable speed scale. We used it for all sorts of things like applying it to a lamp, for a random flicker/shadow movement from a candle flame, or on a large scale, subtle swaying movements of a ship on the ocean.

Note: Due to a bug/limitation in pyconstraints, the constraint won’t work if it doesn’t have a target. Since this constraint doesn’t need a target, you can just insert the object’s own name into the target field and it should go fine.

Demo movie:

demo .blend:
script itself:

You could just do NUM_TARGETS=0, and do without the target field at all. There’s no need to specify a target at all (the doTarget() function in this case doesn’t do anything so it could be ommitted).

EDIT: weird… now why doesn’t that work right :confused:


I tried this, it doesn’t work - that’s the bug :slight_smile:

I miss linked x-forms from Max, think you could make one of those?

Hooks just don’t relay their information to the outside world.

broken: very cool script :smiley:

Question: when I loaded the script into my scripts folder - it’s physically there, but I can’t seem to load it from within blender (2.46 - it doesn’t show up anywhere…). But, I can play with it from within your .blend file.

Any ideas why the script itself won’t just show up in a new .blend?

EDIT: Never mind. I figured out what my problem was (is) :wink:

Thanks Broken - this is quite a useful script. I attached it to a camera object and it gave some great camera shake effects.

As with any constraint, greater control can also be had by keying the influence on specific frames and then altering the ‘inf’ IPO. Basically, you get get the influence to change over time.

Can the script be used to affect bones on rigged characters? I tried it with the bunny from BBB to get him to wave his arm about but didn’t have much joy.

I set the target object as ‘RabbitRig’ and an additional box appeared allowing me to set the Subtarget Bone. I entered ‘CTRL_FK_Humerus.R’ into this and it got accepted OK. I also saw that there was a ‘Pose Space’ target space and I set that too.

Even though it didn’t animate when I pressed ALT-A, the arm did move when I changed the frame number and hit ‘Refresh’ in the constraint’s box.

If you’re planning any new features in the future I have a few suggestions (I realise some of these can be achieved by combining with other constraints but thought I’d throw them out there all the same):

  1. Under ‘Options’, have XYZ toggle buttons to turn on/off the effect the constraint has on each of the dimensions. Have 3 sets - a set of XYZ toggle buttons each for Location, Rotation and Scale.

  2. Also under ‘Options’, have the ability to enter a random seed number so that different objects with the same constraint settings don’t all behave the same.
    Again, maybe have 3 different random seed entries - one each for Location, Rotation and Scale. Maybe you want two objects moving randomly in the same directions but rotating differently.

  3. Have a timing alteration setting or similar. Maybe you want several objects to have the same random Location/Rotation/Scale changes but be half a second or so out from each other.

(And yes, I do realise that using the words ‘the same random’ seems somewhat contradictory. :slight_smile: )

  1. Have the ability to record the random movements to the object’s IPO so that they can be tweaked (e.g. for a scenario where maybe a small portion of the movement doesn’t behave the way you want it too at a certain point in the animation but the rest is fine and altering the IPO would do the trick). Basically, the same way you’re able to record physics from BGE.

EDIT: Just found a thread by PapaSmurf - he’s written a script that’s able to bake any constraint to IPO so that’s this one answered. Here’s the thread:

  1. Have separate speeds for Location, Rotation and Scale with maybe a master speed that influences them all (just like it currently does). This is an optional extra because there is a workaround where multiple constraints can be added and each one only deals with either Location, Rotation or Scale.

Thanks for the great feedback, some nice ideas in there. I’ll definitely keep it in mind if I get a chance to work on this a bit further.

Perhaps Aligorith can shed some light on why it doesn’t work on armatures?

Hope there’s something of use in there somewhere, Broken.

Armatures are an area of Blender I haven’t used a great deal yet so it’s possible I might have overlooked something.

I was thinking over suggestion 1 - instead of having just on/off toggle, maybe have an influence slider for each dimension.

For example, for Location you could have X set to 1.00 (the full speed setting has affect), Y set to 0.50 (half the speed value) and Z to 0.00 (effectively turned off).

EDIT: Just realised I only mentioned the Speed setting with regards to influencing the XYZ dimensions. All the same XYZ controls should be available for the Amount setting under Options as well.

Just thought of another:
6) Have the ability to enter formulas so, for example, an object can move in a continuous orbit like a figure of eight, etc… The object follows a mathematically generated path but still with some degree of randomness.

Actually, this probably falls outside the remit of this particular constraint - might actually be something for another constraint altogether (call it an ‘orbit’ constraint or something). It would be a quick way to create animation rather than having to key specific frames (much like the noise constraint).

You could then add the noise and orbit constraints to your object - following an orbital path but still with some degree of randomness.

Here’s my try at implimenting your script:


Sweet, turned out pretty convincingly! For a while I was staring at the UFO wondering when it would start to move randomly, but then I realised it was used on the camera, and it wasn’t in fact a recorded+tracked camera shake. Cool!

Lol, thanks. Your script is pretty good, is there a place where I can learn to create my own scripts for Blender? I looked all over and never found any info other than just some scripts to download (maybe I was looking in the wrong place?).

This script is wicked nice!! But it just doesn’t do anything in 2.47. Anyone else getting the same problem?

bmud: Did you remember to enable scriptlinks in the buttons window? This is needed since 2.47 for Python functionality (drivers etc.) to work.

I’m using this great script…but I have just one question…I tried to have 3 objects with 3 different Noises…but even if I change speed, location and rotation values…I still get very similar movements (just faster or with wider movements)…It would be great to have a very randomly noise…for example…3 cubes, same speed, lacation and rotation amount that move in 3 different ways!!

I enjoy this script VERY Much! I use it when I need it, and keeps me looking forward to the motion modifiers in 2.5. Thank you for this script!


Hi, I’ve made an addition to the script with a new ‘seed’ value. You can find it here:

Probably might be good to add this to the 2.5 fcurve modifiers too…

Thank you so much broken…:wink: I’ll test it on monday…have a nice week-end! Ciao

So I tested it and it’s GREAT…thanks again broken…this script is for sure needed in anything that has to do with 2.5 :wink:

nice, a seed value too, even better!! THank you for sharing. I appreciate and use many of the elements that you have contributed to the development of Blender, Thank you VERY much for your talent and time invested in developing Blender for the world. From IBL, to Sim_physics, to constraint noise, thank you much :slight_smile:

Also, good point would be great to ad this to the fcurve mods in 2.5, which already rock!!


mixfra: 2.5 already has a much better system for doing this, so luckily this script won’t be necessary any more :slight_smile: I might bring over the seed though, that would be useful, I think.