Compositing the Special Effects

WARNING: Much of the discussion about how the special effects shown on this web page were generated depends on your knowledge of various concepts used in the Photoshop image processing software package. If you are unfamiliar with Photoshop, then I suggest that you review the "Compositing the Transporter Dematerialization Effect" section of the Star Trek Projects Web Page or click here!

This web page discusses a technique that will allow you add very convincing light saber and laser special effects to digital images. For example, the technique discussed below would allow you to turn a raw scene such as Luke and Darth fighting with ligth saber sticks in the emperor's throne room set:



into a life and death struggle with dangerous light sabers:



The creation of the these special effects is accomplished through a multi-step process that involves the use of traditional and multiple exposure in-camera photography, back lit animation, and general and special purpose digital image processing and compositing software.


Recording the Background Plates

Each effect begins by shooting a background plate. The background plates are the base images that will have special effects added to them. In our example, we will use the below picture of Darth Vader's light saber as our background plate. No special measurements of the light saber had to be taken to support the effects effort. I basically just put the light saber on a stand and shot it under appropriate lighting.


Darth Vader's lightsaber background plate

Creating the Backlit Light Saber Animation

After the background plates were recorded onto a roll of 800 speed film, the film was taken to a regular photo processing lab where a 4x6 print of each background plate was then made. I then made a black and white Xerox enlargement of each of the 4x6 prints that I wanted to add special effects to. The Xerox enlargements will be used as a guide to determine where the special effects will be added to each background plate. The exact size of the enlargement didn't matter, I just made the enlargement big enough so that I could easily work on it with tools like a pencil and a knife. After I had made the enlargements of the background plates, I was now ready to start adding the effects.

I started by placing a piece of black construction paper underneath one of the Xerox copies, and then I taped both pieces of paper down to a table. I then used my pencil and knife to very carefully cut out a hole in the Xerox and construction paper combination where the actual light saber or laser beams should appear. Below is a picture of what it looked like with a hole cut out of the Xerox and construction paper artwork for an effect of me holding Darth Vader's light saber.


The Xerox copy of a background plate with an effects hole cut into it

Now that I had the holes cut out of the pieces of construction paper for each effect, I no longer needed the Xerox copies. The next thing that I needed to do was record the light saber and laser effects onto another roll of film. For our example, I taped the piece of construction paper containing the light saber effect down onto a large light table that I had access to. I then placed other solid pieces of black construction paper around the piece of construction paper that contained the effect so that no light could be seen through the light table except where the light saber effect was. Below is a photo of what the light table setup looked like for this step in the process.


The light table ready to record a lightsaber effect 

Next, I placed my camera on its tripod and positioned the tripod over the artwork on the light table. I then pointed the camera straight down and focused the camera on the artwork. I was now ready to record the light saber effect onto a frame of film in my camera. But how did I add the glow around the light saber beam? Obviously there was no intrinsic glow around the artwork as it lay on the light table.

The key to adding the glow around the light saber beam was to place a couple of fog filters up in front of the lens just before I took a picture. I also sandwiched a piece of yellow cellulose acetate material between the two fog filters. At this point, if you had looked through the view finder of the camera you would have seen a solid yellow glowing saber beam. I was now ready to record the effect onto the film so I turned off all the lights in the room and turned on the light table. The only thing now visible in the room was the white light saber effect.

If at this point I had simply put the fog filter up in front of the lens and made an exposure, then all I would have received was a solid yellow saber beam surrounded by a yellow glow. But that's not what I wanted for Darth Vader's light saber. For this particular effect, I wanted a solid white beam not a yellow beam. The way to get my white beam was to do a double exposure shot. The first exposure, usually done at 1/125th of a second, was simply a shot of the white saber beam without the use of the filter. The second exposure, usually shot at either 1/60th or 1/125th of a second, consisted of the saber beam recorded with the filter/acetate combination in front of the lens. Since I had already saturated the film with the initial white saber beam, there was no way that adding more yellow beam in the second exposure was going to change the final look of the white beam. What the second exposure did that was new was to add the yellow glow around the white beam.

I should note that only one exposure was needed to do the Star Trek phaser effect since both the resulting phaser beam and the glow were both blue. Also, don't let it bother you that I recorded all of the initial glow effects in yellow, even though the resulting effects show the glows as either red or blue. I later used Photoshop's Hue/Saturation command to shift the color of the yellow glows to their final red or blue color. The reason I chose to record all of the initial glow effects in yellow was because my film scanner seems to be more sensitive to the yellow glows in negative film than to other glow colors such as red or blue. Perhaps this is because yellow light is composed of both red and green components and my scanner therefore receives twice as much light energy as it would from a glow color that only contained one primary color such as red or blue.


Processing the Light Saber Animation

Once the saber and laser effects have been recorded onto film and the roll is developed, I was now ready to bring the raw effect into Photoshop for further processing. The first thing I did was to scan the background plate of the light saber as well as its special effect into my computer. Next I brought the image of the saber beam up into Photoshop and used the Hue/Saturation command to shift the color of the saber glow from yellow to red, which is the color of Darth Vader's light saber. The below picture shows what the saber beam looked like just after the color shift operation.


A raw lightsaber effect before placement and scaling

The next thing that I did was to align the saber beam up with the background plate so that it looked like the beam was coming out of the saber handle. To do this I used Photoshop's layers. What I did was use the fence and cut and paste commands to fence cut out the saber beam and then plaster that buffer into a new layer created on top of the background image. By lowering the transparency value on the layer, I could see through the saber effect to the underlying background plate. I could then move the saber effect around on the layer until the saber beam matched up perfectly to where it should be located on the background plate. Of course, the saber image also had to be scaled as well so that it would be the correct width to fit into the saber handle.

After the saber beam image was correctly positioned and scaled on a layer in the background plate image, I then copied the layer containing the saber beam to a new Photoshop file that was exactly the same size as the background plate image. At this point I then filled in the holes in the beam image with black so that what resulted was a pretty red saber beam surrounded by black. The next thing that I did was to run a Gaussian blur filter on the saber to smooth the beam out. The below image shows what the saber beam looked like in its correct location relative to the background plate.


The raw lightsaber effect correctly scaled and positioned in frame 


Creating the Light Saber Effect Plate Element

The next thing that I needed to do was to create an image of the saber beam that will eventually be used to create the resulting special effect. The above image of the saber beam in its final location is actually not suitable for this purpose. The reason is because the glow effect fades to black in the above image. If I were to just use the above image in the generation of final effect, the glow in the final effect would have a black tint to it. Why? Because to generate the final effect, I will be combining the background plate with a combination of a variable density cover matte of the saber beam with the actual saber beam effect element. We will make the variable density cover matte shortly. Since the cover matte is used to combine the effect with the background plate, we want to use the cover matte to specify the look of the glow in the resulting image. Therefore we don't want to use the effect itself to specify the look of the glow.

In addition, the saber glow pixels in the above image are a mixture of both red and some degree of black. If we were to use this image as the effect, then this mixture of red and black in the glow will show through the cover matte to the resulting image. The resulting black tint in the glow would ruin the effect. I know this seems a little confusing but I will be talking more about this topic very soon and I believe it will become clear as we go along.

The way we get around this problem is to just create the saber effect without any glow around it, and then rely on the variable density cover matte to provide us with the glow in the final effect. To do this I first make a copy of the above saber effect in a new file. Then I use the paint brush set to the brightest red pixel color in the glow. Then I just paint the entire scene to be this bright red color except for the saber beam itself, which stays white. The below image shows what the correct saber beam effect element should look like.


The finished lightsaber effect element


Creating the Light Saber Cover Matte

We now have the background plate and the saber beam effect element. Next we need to generate a variable density cover matte element that can be used to combine the background plate with the above saber beam effect element. To do this we start with our glow effect element from above.


The starting point image to create the cover matte element 

The goal will be to turn this element into our variable density cover matte. There is several ways we can do this. One way is to take this element and bring it into Photoshop and simply desaturate the color in the image by using the Hue/Saturation command. This will certainly turn our color image into a black and white image all right. The problem with doing this is that the resulting black and white image you get from this is not very bright. For instance, if a pixel originally had a color of Red=255, Green=0 and Blue=0, and then you desaturate the pixel, what you get out is a black and white pixel with a value of 127. But we want to turn this red color into a black and white pixel with a value of 255 not 127.

To reach this objective, we need to look at the color of the pixel and say to ourselves, based on the color we have, what percentage is this color relative to the maximum brightness that this color could possibly be. Then we multiply this percentage by 255 to arrive at our black and white value. For example, lets say that we have a color of Red=210, Green=56, and Blue=112. The maximum brightness that this color could possibly be is Red=255, Green=101 and Blue=157. I obtained these color channel values by simply shifting all the color channels up in this color until one of them reached 255. Then I stopped. The color we have is 82.3% of this color value so we multiply .823 x 255 and we get a an equivalent black and white value of 210. Therefore we should make this pixel in the cover matte a value of 210. Another way to look at this is to simply make the pixel value in the cover matte whatever the maximum color channel value is for this pixel in the effect.

Then if we were to provide this pixel in the cover matte with a color value of Red=255, Green=101 and Blue=157, then the cover matte would knock the color down in the resulting special effect to the desired value of Red=210, Green=56, and Blue=112.

The problem is that Photoshop doesn't have any way of doing this, so I had to write a special purpose image processing program to do it for me. Below are two plates of what results when you simply desaturate the saber image in Photoshop, which is the image in the center, and the image you get when you run the saber through my software, which is the image on the right.

. . . .

Original element  Photoshop matte  My matte     

You can see how much brighter my cover matte image is relative to what Photoshop produces. The reason that we need such a bright cover matte is because if we start out with a pixel in the effect that is a pure red color Red=255, then we want this same full red color to show up in the resulting effect. To do that, we need this pixel's cover matte value to be 255 so that the cover matte will let all of the color through to the background plate. If we used the desaturated cover matte version, then the resulting color we would get is Red=127 not Red=255. As a result, the desaturated cover matte would produce a glow effect that would look very subdued, but we want a very bright glow. You would get your bright glow by using my cover matte.

You should also notice how the glow definition is actually being stored in the cover matte and not in the effect itself. The effect itself only stores the maximum red color in the glow. We're relying on the cover matte to provide the definition of how the glow should taper off in the resulting effect.


Generating the Final Effect

We now have the three elements that we need to composite the final effect. As shown below, we have the background plate, our cover matte to control the compositing of the effect, and the effects element that will be applied to the background plate.

. . . . . .

BG Plate  Cover Matte  Saber Effect  Final Effect

At this point we have to figure out how to combine the elements together. One way to do this is to use Photoshop. We start by loading the background plate up into Photoshop's background layer. Next we would create ourselves another layer and load the effects element into this layer. We would then append a layer mask onto this effects layer and paste our cover matte into this layer mask. This would be enough to actually composite the resulting effect. We would even have control over how transparent the effect is relative to the background plate. There is only a problem with this approach.

Although we do have control over how transparent the effect is relative to the background, we do not have transparency control down to the pixel level. We can only say that the entire effect will have some overall transparency value. The problem is that we actually need transparency control down to the pixel level. The reason is that lets say that our light saber crosses an area on the background plate that's very white such as my shirt in the below picture.


Analysing the lightsaber glow in light and dark areas of the frame

In this picture, notice how the saber's glow fades when it passes in front of my white shirt. You would expect this to happen since the film in the camera cannot produce a color brighter than white. So if the film has already been exposed such that it will produce a white image when its printed, it shouldn't matter how much additional saber glow is added to this area of the film, it should still look white. But if I am producing the effect in Photoshop and I have the transparency value set to 100%, then the red glow effect will completely block my white shirt from showing through.

Now you can argue that you can just reduce the transparency value down to maybe 70%, and that way you can still get most of the saber glow to come through, but you can also see through the glow to a 30% extent. But when you do this, you have to remember that you're also reducing the saber glow to 70% in dark area's of the background plate, where the glow really should be at 100%.

What it comes down to is that we really should be looking at the background plate to help us determine how intense the glow should be at any particular point in the image. Of course, we will still have to factor in what our cover matte's going to have to say about all of this. To do this we need to have transparency control down to the pixel level but unfortunately Photoshop just can't give us that amount of control. As a result, I have had to create another special purpose compositing program to give me control to the pixel level.


Light Saber Compositing Program Details (Advanced)

My custom compositing algorithm works by first opening and reading in both the background plate, the effects plate, and the cover matte images. The program also opens the output image file. It then looks at these four images one pixel at a time, but as it's looking at a pixel it is looking at the same pixel in each of the four images. To determine what the color should be for each particular pixel in the resulting effect, the algorithm first assumes that the background plate is going to be represented in the output image at its full color. That means that if any saber effect is going to affect the background plate, then the effect is going to be added to the color of the background. Doing this insures that the background is not going to be blocked out by the saber glow. The program then looks at the red, green, and blue color channels in the saber glow for the current pixel, and it essentially scales the effect into the unused portion of each of the color channels in the background plate. The cover matte's transparency value is also factored into the calculation as well. Once the effect has been integrated into the background plate for each pixel in the image, then the resulting image is then written out to the disk as a raw 3 channel color image. This raw image is then imported back into Photoshop where the image is scaled to the correct size and saved out as a JPEG file for display.

Below is the basic C/C++ program for implementing the above algorithm. Some of the basic input/output work you see is just pseudo code, but the main compositing engine of the program is shown in C/C++. You should note that this same program was used to composite my holographic image onto the Trade Federation battleship.

//Notes:  The color input and output images are assumed to
//be stored as RAW, interlaced, 8 bits per channel, 3 channel
//red, green, blue ordered images.  The matte input file is 
//stored as a RAW, 8 bits per channel, 1 channel grayscale image. 
//The background plate, effect, matte, and output files are all
//processed one scanline at a time.

/*******************************************
 Program: Composite
 Written By: Timothy S. Fox
 Date: May 25, 1998
*******************************************/

Open the background plate input file
Open the special effect input file
Open the matte input file
Open the output file

for (number of rows in the image)
   {
   Read in a scanline from the background plate
   Read in a scanline from the effect plate
   Read in a scanline from the matte plate

   //process the output image's scanline one pixel at a time

   for (column=0; column < width_of_image_in_pixels; column++)
      {
      //normalize the matte value which is between 0-255 .
      //This calculation only needs to be done once for the
      //red, green, and blue channels of this pixel.

      mask_value = matte_pixels[column]/255.0;

      //normalize the the red component of this pixel.

      effect_value = special_effect_pixels[column*3] / 255.0;

      //apply the matte to the effect's color value to obtain
      //the red color value that is to be scaled into the
      //unused portion of the background plate's red
      //color component.

      composite_value = mask_value * effect_value;

      //now scale the adjusted effects red color value into the 
      //unused portion of the red color channel of the
      //background plate

      result_color_comp = background_plate_pixels[column*3] +
           ((int) ((((255 - background_plate_pixels[column*3]) /
                     255.0) * composite_value) * 255.0));

      //do bounds check and assign this pixel's final red channel 
      //of composited special effect into the output array

      if (result_color_comp > 255) 
         output_image[column*3] = 255;
      else if (result_color_comp < 0) 
         output_image[column*3] = 0;
      else
         output_image[column*3] = result_color_comp;

      //Perform the above calculation for the green and blue 
      //components of this pixel except that the output_image[],
      //special_effect_pixels[] and background_plate_pixels[] 
      //arrays should be accessed as [column*3+1] for the green
      //component and as [column*3+2] for the blue component.  
      }

   Write this scanline to the output file
   }

Close all of the input and output files.
You are done!!!!


The Results

The result of running my image processing algorithm on the above three elements shows that when a saber glow crosses in front of a white area in the background, the saber glow automatically blends into the white as you would expect. But when the saber glow crosses over a dark area of the background plate, then the glow is allowed to stay its brightest. This result is what you'd expect to get if you were to just superimpose onto film the background plate with the effect. See below. At this point the effect is now complete.

. . . .

Background Plate  Saber Effect  Composite Effect 

Creating The Original Trilogy's Light Sabers

The technique described on this web page for generating light saber effects is actually very close to the way that Industrial Light and Magic generated the light saber effects for the Star Wars trilogy. To create the effect of Luke Skywalker holding his light saber, George Lucas would start by filming Mark Hamill on the set doing whatever he was supposed to be doing with his light saber. During filming, Mark's light saber actually had a rod sticking out of the handle that was supposed to be the length of the saber beam. (Refer to the first picture on this web page.) This rod later helped animators to gauge where to insert the saber beam in each frame.

Next they would develop the film and then load it into an animation camera mounted above an animation table. For each frame, the animator would place a piece of clear plastic, called a cell, onto the animation table into a series of pegs called registration pins. The registration pins provided a way to precisely align the cell with the image being projected onto it from the above camera.

Next the animator would project a particular frame from the previously shot film down onto the animation table. The artist would then use a pencil to very carefully trace out on the cell the image of where the light saber beam was for this frame. This cell was then taken off the table and placed in a stack with other cells that already had saber beams recorded on them from other frames. This process would continue until all of the frames in the sequence had saber beams recorded on them. Below is a picture of one of ILM's animation tables.


A.J. Riddle programs a shot on an ILM animation camera

At this point, the animator would go back and take each cell in the stack and paint in the sabers in either red or blue cartoon paint, depending on who's light saber was being seen on a particular frame. Once the stack of cells had all of the light sabers painted in, the animator would load the animation camera with a cartridge of unexposed film. But instead of using the animation camera to project frame images down onto the animation table, the camera was now going to be used to record the saber images painted on the cells.

For each frame of cell animation, the animator would place a cell onto the table and into the registration pins. The lens was covered with a diffusion filter so that the resulting light saber would have a glow around it. An exposure is then made and the film was advanced one frame. The next cell is then placed on the table and this process continues until the entire sequence has been recorded on the unexposed film. At this point the film is developed and what results is a light saber glowing and dancing around against a black background.

Next, the light saber film and the original background plate are sent to the optical department. The optical department then takes these two pieces of film and runs them through an optical printer to double expose their images onto a new piece of unexposed film. The act of double exposing the two pieces of film onto the new piece of unexposed film effectively composites the saber beam with the background plate. What results is that Luke is now holding a glowing light saber.

As you can see, the process I used to generate my saber effects is in many ways very similar to the way actual light saber effects are generated by ILM. The minor differences are that ILM registers the light saber effect with the background plate at the time the cell animation is created, while I wait to do image registration until after the effect has already been created on film. And whereas ILM achieves its saber glows by front lighting the cell animation, I backlit my animation. Finally, while ILM uses very fancy and expensive equipment to composite the resulting effect, I use a computer program to do my compositing for me.


Creating The New Prequel's Light Sabers

Unlike the original trilogy's photochemical process used to generate light sabers, the new prequel's sabers were generated completely in the digital realm. The process began by again having actors dueling on stage with their stick light sabers. After the film was processed, the original negative film sequence was scanned into a computer frame by frame.

Next, the rotoscope team would create an articulated matte of each of the blades as they danced around the scene. A compositing team would then take these mattes and plug them into an ILM proprietary compositing program called Comptime. Comptime was then responsible for actually generating the look of the sabers and compositing them into the scene. After all frames had been processed in this way, the scene was then recorded back out to film for sound editing and integration into the finished film.

Previous Efforts

This is actually not the first time I've ever used the technique described on this web page. Back in 1993, I did some test light saber and phaser effects using a slightly modified version of this technique. The problem with what I was doing back then was that I was doing the entire process described here as an multiple exposure in-camera effect. This means that I was putting both the background plate image and the saber glow effects down onto the same piece of film through the use of double and even triple exposures.

The problem with using this technique is that I have no knowledge about where the effect should be superimposed on the film. Remember, you have just taken a picture of someone holding a light saber or phaser that you want to add an effect on top of. How do you figure out on the second exposure where to put the saber effect? Although this technique was able to produce very good pictures when I was able to align the background plate with the effect, I found that this was a very difficult way to do it. In fact, until I entered the digital realm, I had completely abandoned this version of the technique.


Summation

Well I hope you've enjoyed learning about the techniques described on this web page. I had a lot of fun figuring out how to do them and then producing pictures with them. I realize that this technique is neither particularly easy or quick to do, and it couldn't be used for producing anything but a few frames. But a few frames are typically all I need so I'm willing to go to the effort. You may be asking yourself if there isn't some easier way to produce these effects?

The answer is yes, there are probably other ways these effects could be produced, but I can't figure out a way to produce light saber effects with this level of realism in any other way. Trying to produce saber effects strictly with Photoshop results, in my opinion, in an "airbrushed" or "painted on" look to most pictures. My pictures have certain random quality to them and the background is used to actually modulate the effect. I think it would be difficult to better the results I'm able to get, at least for few frames.

What kind of time is involved in producing effects this way? Well its not exactly for the faint of heart. Most of the pictures on my hand props page required about 7 hours each to do from start to finish, but my Logan's Run sandmand pistol shot required an incredible 19 hours to create! The reason the pistol shot required so much time was because I had to spend 3 hours to just get the "flame" effects onto film, plus several hours to record the pistol background plates. Then, each of these "flame" elements had to be twisted, scaled, and color shifted to get them into the correct position within the frame. In addition, I had to do 8 separate compositing steps to form the resulting picture.

I hope this discussion has inspired you, and not scared you, to go grab your camera and start playing around. I've always been amazed at what can be done with a few hundred dollars worth of equipment, some spare time and some imagination. Hey, for a few bucks I just managed to duplicate an effect that was originally done on equipment that costs many hundreds of thousands of dollars. Well, good luck!!!


Last Updated: March 10, 1999
HTML URL: http://geocities.datacellar.net/~special_effect/prop_comp_effect.html
E-Mail: special_effect@geocities.com or click here
1