Image Compositing Light and Shadow Techniques: Part 1

By Thomas Kryton

Dateline: December 11, 2006
More Photoshop tips
Discuss this in the Photoshop forum

When importing an object into a scene to create a new composite, some evaluation of the existing scene can go a long way towards making it appear that the object that you are importing is really part of the overall image. In scenes where there is only one light source, such as during daylight on a cloudless day, fitting a new object into scene is relatively painless. However, fitting an object into a scene with multiple light sources can be a little trickier. In this tutorial I used a scene from of two boys in a stairway scene and imported a clown from (also available on to demonstrate some approaches to consider the next time you're compositing an image. You can work along with this tutorial by downloading the clown and stairway images.

In the illustration below I’ve imported the clown into the background scene and added two layer masks. The mask on “layer 4” was created by using the supplied path in the file and the mask on the “clown” group was painted in. On “layer 4” I selected the supplied path on the paths palette, contracted it by 2 pixels on the selection menu and applied it as a layer mask to the layer containing the clown. Then a Gaussian blur of .8 pixels was applied to the mask on “layer 4” to help ease the transition from the background to the clown. I the grouped the “layer 4” layer to a group named “clown.” I added an additional mask to the layer group containing the clown, and the Light Values layer added later in the tutorial, which will mask out the bottom of the clown’s pants where he is sitting on the steps. I’ve added the group mask to help make it appear that the clown is really sitting on, and towards the back of, the step, similar to the view of the boys’ pants. By putting the clown inside the layer group I can add more layers to the group without having to re-mask the pants on the clown.

stage 1

At this point the clown is a reasonable match to the scene but because he was lit differently from the scene he still appears to be merely pasted in. The next stage is to evaluate the scene to gauge how the various light levels play out in the overall image.

To make the process a little easier, I've turned off the clown layer in the illustration below so that I can see the entire scene. The shadows and highlights in an image can help determine the location and number of light sources. In the case of this image, the background appears to have been shot with a flash positioned slightly off to the right and above the boys. The wall on the left side of the image also seems to have been used as a bounce surface, providing a bit of a fill light to the left side of the boys. There is also some light coming from the top right behind the stairs, which is introducing a greenish cast to areas of the image.

To confirm my initial estimates of the lighting in the scene, I created a threshold adjustment layer just above the background by clicking on the Create New Fill Or Adjustment Layer at the bottom of the Layers palette and selecting Threshold.... The advantage to using an adjustment layer is that it's a non-destructive adjustment, and can easily be discarded when you are done with it. By adjusting the slider in the Threshold dialog box back and forth you can get a visual confirmation of the light values in a scene. In the image at the right, I can see that the fall-off area of the flash is centered between the two boys, darkening as it spreads out from the center. I also get a feeling for how the wall on the left is acting a bounce surface and where the relative strengths of the two light sources, the flash and the window, affect each other.

light 02

The Eye Dropper is indispensable tool (use the shortcut I). By holding down the Shift key and clicking inside the image you can position up to four sample points that can be read, and retained, in the info palette. In the context-sensitive toolbar at the top, I've set my sampling area to a 3 by 3 average to give me a 3 by 3 pixel average for the lightness and color values. For example, by clicking on the Eye Dropper tool and moving from the foreground towards the background along the left wall up the stairs I can see that the values shift from a relatively color cast-free light gray with values of 231, 231, 231 (rgb) towards 208, 212, 211 (rgb)—pointing out that as the distance from the light source increases, the overall brightness drops off and begins to take on a greenish cast as it does so. Because I'm positioning the clown on the same step as the boys, roughly at my second Eye Dropper point, I now know that he is going to be slightly darker because of his distance from the flash. Since he is closer to the wall, he will also be slightly greener. The other thing to determine is just how much green light will be falling on him, versus the output of the flash.

light 03

Again the Eye Dropper tool can help a lot in making this determination. By again selecting this tool and Shift-clicking on the previously laid sample points, I can move them to new areas in the image. I've rearranged the markers from right to left along the steel trim of the stair, choosing the steel primarily because it will reflect the light in the scene the best, without introducing its own color cast, in this case what should be the most neutrally colored object in the scene. Because the clown will be occupying the same plane as the boys in the picture, I'm more concerned with the change in light from the hottest spot in the picture—the area between the two boys to the light being reflected by the wall—rather than the amount of depth the clown will occupy in the scene. Interestingly, the highlight between the two boys is predominantly red and drops to a neutral gray near the wall. The highlights between the two boys is the lightest, as expected, and drops off sharply between the first and second marker, while remaining fairly even between the second and fourth markers.

light 04

Using this information I can now further adapt the clown's light values to better fit the scene. I've created a new layer called Light Values just above the clown, which I've made visible again. With the new layer active select the Gradient tool (G), click on the gradient in the context sensitive tool bar when it appears, and launch the gradient editor by selecting New. I've positioned the gradient editor so that I can still see the Eye Dropper markers that I placed earlier and use them for this next step. By clicking twice just below the gradient bar I've added two stops to the gradient and positioned them so that they roughly have the same spacing as the Eye Dropper markers I created earlier. Then by clicking on each of the stops in the gradient to make it active I sample a color by moving up to the Eye Dropper marker I've laid out and use it to fill that stop with the appropriate color. The stop on the right will have the color sampled from the first marker, the next gradient stop on the left would be the second marker, and so on.

From there I create a radial gradient on the new layer that runs from the area between the two boys near their shoulders to the fourth Eye Dropper marker, giving me an approximation of the light values in the scene. A radial gradient will duplicate the light values from the center of the flash area outwards, similar to the values that we found when sampling the steel strip on the front of the stairs.

light 05

The only thing left to do is to copy the mask from the layer that the clown is on by holding down the Alt key and dragging the mask from that layer to the Light Values layer, masking out everything other than the clown shape. The final layer is set to soft light to help create that wrap around effect created by the flash and bounced light in the scene and I've set the layer opacity to 26%. The effect this way is very subtle yet yields a good result. With the light values established, all that remains is to add some shadows—one where the hand rail would fall on the clown, and additional ones on the stair risers being cast by the clown. Below shows the starting point, with just the clown added to the stairway image, with the final version at bottom (click to enlarge).

That's it for part one of this tutorial series, with the second and final installment covering the addition of shadows.

Don't miss the next Photoshop article on Get the free newsletter in your mailbox each week. Click here to subscribe.

Thomas Kryton owns and operates Digital Paint, a graphic and Web design company providing visual solutions enabling the small to medium business market to meet their marketing and branding goals.