Lighting simulation by image blending

An easy Python/PIL/Tkinter program for visualizing lighting effects by superimposing photographs. Each image has one light on; the result is a weighted sum of the input images. If one of the inputs is called 'ambient', that image will be subtracted from all others before processing. (You can still add the ambient image into the result, of course.)

My program has the additional notion of an 'ambient' light. If there was some unmaskable light source during all your images, take an image of just that light source and call it 'ambient'. The program will subtract that image from all the others.

My test images reveal a flaw with the technique, since a few of the lights overexpose the light sensor on my camera. As you brighten those lights, the flares appear to dissolve in. A smaller exposure or HDRI images would solve the problem, of course.

Needs Python 2.2 (with Tkinter) and PIL. Not optimized at all; might suck on machines that are slower than mine. As you can imagine, this algorithm can be optimized enormously, without even resorting to writing C routines to do the image processing a little faster. That'll come in the next version, since our application wants about 75 layers.

The technique is described excellently here by Paul Haeberli.

We're considering using a tool like this for a bigger theater lighting system.


just ambienta mix with some other light sources