I am working on my animated short, in its first scene I want to make a flickering light(like horror movies) What should I do.
Keyframe the lamp's strenght (in my case 1.000) at the desired frame on a timeline with I. Go to the next frame and keyframe it again (light strenght may be the same, since the modifier will do the job).
EDIT I missed the bit that it should be for Blender Internal. Just read to the bottom, where I address that.
You can do this with drivers. To create a single randomly blinking light, you can use a setup like this.
In the scripting screen, add a text block named
randomizer.py, enable the "Register" checkbox, and paste in this code:
import bpy import random bpy.app.driver_namespace['random'] = random
This exposes the random module to Blender's drivers.
Add a control property to the lamp, which allows you to turn the blinking on or off. Make sure the value is set to 1, not 1.0, so that it's a binary (0/1) property. You can add this and the next property to the lamp data or the object, that's up to you.
Add another property to produce a random value between 0 and 1. Leave the default value to 1.0.
Right-click on the randomblink property and choose "Add Driver", "Manually Create Later (Single)".
Open the curves editor, and switch it to "Drivers"
Select the driver, tick the "Use Self" checkbox, then write
random.random() if self["blinking"] else 1 as Expr. This will produce a random number when you set the "blinking" property to 1, and just have a constant 1 value when you set "blinking" to 0.
Here is the rest of the setup:
The material setup has a Value node with a driver. The driver refers to the "randomblink" custom property, either on the object (as shown here) or on the lamp itself. Be sure to pick the right one, or it won't work.
The Color Ramp determines the ratio between "on" and "off" while blinking. It is set to Constant mode for hard edges between on and off. Just move the white point to change the on/off ratio of the blinking.
The Multiply node determines the strength of the lamp when it is on.
The downside of this approach is that there is a link between the lamp and the material. If you want to have multiple lamps, all blinking independently, you'll have to duplicate their materials too.
EDIT Only now do I see that it should be for Blender Internal, not Cycles. I'll update this answer when I have the chance -- the technique itself should work for Blender Internal too, though, just with a slightly different setup. The drivers are the important bit.
Try this: instead of setting up the lamp material nodes, go to the lamp's Energy setting. Add a driver to that, check "Use Self", and set Expr to
200 * (self["randomblink"] > 0.6). The
200 is the strength when on, the
0.6 determines the off/on ratio (higher means more off). This does require that you add the custom properties to the lamp, not the object.