Forum: Poser Python Scripting


Subject: Randon Light script

nyguy opened this issue on Feb 28, 2008 · 15 posts


bagginsbill posted Fri, 29 February 2008 at 1:45 PM

I'm sure someone will come along with a script, but here's another way to do it.

Did you know that lights have shaders? Yep they do.

And did you know that a shader can consult the Frame Number in an animation? Yep.

And did you know that you can use the Frame_Number to drive a Fractal_Sum (a kind of noise) node?

So here is a light shader that changes randomly, on or off. Of course the color can be anything you want.

Here's how to adjust it.

The Math_Functions node (the "Step") in the upper right controls the probability that the light will be on. Value_2 controls this. With a value of .5, it means on average the light will be on 50% of the time.

The Fractal_Sum node is generating the random sequence. To make more frequent changes, lower the X scale and Y scale values. To make less frequent changes, increase the X scale and Y scale. With the current settings (1) it changes about 3 to 7 times in 30 frames.

The Math_Functions_2 node is so you can make sure your lights are not synchronized. It causes the Fractal_Sum to move to a different plane in its internal 3D space. I'm showing my Light 2 here with a value of 50. For each light, add another 50. So for Light 3 use 100. For Light 4 use 150. Etc.

Be aware that the preview in the pose window does not show this going on. But the preview in the material room does. So you can select a frame with the frame slider and see if that light is on or off at that moment. Because Poser ignores the Light Intensity nodes in preview, if you're doing animation using the preview renderer, forget I said anything.

This light starts off, turns on at frame 8, off at 11, on at 17, off at 21 on at 23, off at 28, on at 30. That's as far as I checked it. With other values instead of 50, it will produce a different pattern.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)