Matching Real Lighting
The Old Fashioned Approach
Matching lighting which is part of a photographed background is a staple art of Technical Directors and FX artists. Whilst techniques such as using ambient occlusion and HDRI are now commonplace in visual effects production it's worth knowing how to tackle this problem when such tools are not available. The "traditional" way of matching lighting in a photographed plate is an art more than a science and hopefully the techniques I present here will merely begin to get you thinking along the right lines when you have to tackle such an assignment.
It will take a lot of practice to be able to convincingly match real world lighting. This technique uses no raytracing, no Global Illumination and no HDRI. This is because in real-world production it is usually prohibitively time consuming to render using these techniques. The majority of FX shots you see in film are produced using nothing more sophisticated than depth-map shadows and reflection and environment maps.
OK, so how do we tackle this problem? Well the first thing to do is have a good look at your background plate. For this shot I had been asked to add an CG aircraft taking off to a photographed backplate. I had been given no reference images and no tracking data. I duplicated the shot's camera move by hand in Maya and I animated the aircraft to the CG camera move. Once this was done It was time to look at the plate and extract the information I would need to light the CG elements in the shot.
Scene black levels
Film and video seldom represent true black in their images. In this plate the circled area is scene black i.e. it is in total shadow. However, looking at the pixel values shows that the average shadowed pixel is roughly R=30, G=29, B=32. Therefore I should not let any element of my CG lighting become darker than that, as it will stand out when it is composited. To achieve this I add an ambient light to the scene.
Ambient light lifts the blacks
Here is a render showing the ambient light's contribution to the scene. This is as dark as the CG elements will get. This was achieved with one ambient light tinted to match the slightly blueish cast of the shadows in the background plate.
Key light direction
As I had been given no reference for this scene it was necessary to estimate the light direction from objects present in the photographed plate. This water fountain's shadows gave a good indication of the angle and intensity of the key light and I was able to set my CG light to match this angle.
Key light colour
This area of wall which is actually only just off-white indicates that the key light should be an orange/pinkish colour. It is always a good idea to find an object in direct light in your backplate which is close to white as this will give you your cue as to what colouration should be given to the keylight.
Key light pass
Here is the render of the key light's contribution to the scene. Its intensity, direction and colour are all derived from looking at the background plate. Now all that's left to do is add the fill light to the scene.
Fill light pass
Adding the fill lights is a bit of a black art. There is no rule of thumb on this other than that they are generally a similar colour to the ground or walls in a scene (they represent bounced light after all) and that generally they are placed in the opposite direction to the key light. Using the backplate as reference, keep adding fill light till the ratio between light and shade looks similar to the photographic backdrop.
The complete render
Once all ambient, key and fill light passes are combined they look like this. All that now remains is to composite these elements with the background plate and to add any effects passes, like particles for example, to complete the shot.
By adding some noise to the CG elements, blurring their edges and tweaking the values of the colour balance and contrast etc. the final composite can be produced. Rendering all the passes as separate elements gives your more control over your final image in comp. By this I mean you can increase or decrease the amount of key or fill by tweaking the individual layers rather than having to render the whole sequence again from scratch. This sequence also has a particle pass rendered from the exhausts which was also used as a matte to add some heat haze to the background plate.
This is not an exhaustive guide to matching real lighting by any stretch of the imagination but I hope it gives you some methods and strategies for tackling this complex problem. This was a pretty simple example, there are no contact shadows nor reflective surfaces with elements in the background plate for example which would complicate matters, but none the less it's a real-world example of how I tackled one pretty simple shot for a film.
This work is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License.