Categories
Journals

I’m working on a Blender function which generates a pseudo-random sequence of numbers guaranteed to be as similar or dissimilar as you need. The current “random” in F-Curves sometimes spits out identical consecutive values and that annoys me. This function makes sure things keep moving when you tell them to.

The values generated are between 0.0 and 1.0. It’s available in Blender as a driver function so you can use it to “jiggle" whatever animation-ready value you want. (Or maybe I should rename it jitter. If I say "jiggle”, people might think of “jiggle physics”…)

Inputs are currently an arbitrary channel name (“x”, “y”, “rotz”, etc), minimum percent dissimilarity as a float from 0.0 to 1.0 and maximum percent dissimilarity as a float with the same bounds. The inputs are sanitised and sanity-checked on the way through to make sure they won’t break anything or crash Blender.

Because it’s in driver-land, you can send in variables from objects which can then be keyed, meaning you could start something fairly still then turn the jitter factor up and down over time by multiplying the function’s output with a variable that starts at 0.0, rises to 1.0 and goes back down to 0.0.

The channels allow the function to drive multiple things using the same iteration of the random variable. In the case of scaling, the first time you execute it on the “scale” channel, it’ll generate a random value. On immediately subsequent calls, the function just returns whatever value it last generated on that channel.

It would be nice (and probably not that hard) to add a smoothing function which keeps a cache for any channel and averages it. Maybe I’ll do a wrapper function with smoothing or something. It would also be better to make the “return last value on channel” thing something that has to be explicitly asked for instead of a default behaviour.

Looking ahead I’d like to offer it as an add-on but I’m still in the middle of fighting add-on API dragons for the first time. I’ll suss it out. 🙂

By quollism

A creator of quollity stuff.

Leave a Reply