Friday, February 3, 2012

A Basic Practical Lighting Demo

Hello!  This is a tutorial I've written that will demonstrate how to build a fairly simple practical light rig.  You can use these principles to set up a good foundation light rig to use in your animation exercises, or even as the basis for an environment in a short film.  Whatever the case may be, here is a method to help guide you on your way towards a clearly lit shot.

You can use the following Maya scene file to follow along.
Light Tutorial MA File (maya ascii saved in Maya Unlimited 2011)

Here is the scene as it appears through the shot cam without lighting.

Think of lighting a scene like doing an oil painting; start with your base color to set the tone, and from there you can layer in various shades to build up the environment until eventually doing details and highlights.  In this case we will start with a very large practical light source: sky and sunlight.  Since the sky is actually visible out the windows in this scene, we can start with setting the tone for the sky first, to give a feel for the intensity of the source.

Light out window / practical source lighting
With the base tone and feeling laid in, now it's time to start placing lights.  Let's put a practical light in to match the look of the practical source, this will help motivate the direction of the rest of the lighting in the scene.  We'll do this with a giant spotlight placed outside the windows that engulfs the entire shape of our set.  In this case we'll use a cone angle of 60, intensity of 1.5 with no decay, a very tight penumbra angle of about 1.8, and a light blue color.

We'll say that it's some pretty direct sunlight around mid-afternoon, so the shadows will be fairly harsh still.  To keep solid control over look of the shadows, we'll be using shadow maps in this demo.  Enable shadow mapping and use resolution of 1024, with the filter size at 10 and bias at 0.001.  Now render the view to see the results.

Right side light room fill
Now that we have a visual cue for the lighting laid in, we can start filling the room with general bounce lighting and ambient illumination.  Since we'll only be lighting one side of the room, we can do this with two large spotlights placed at the upper corners of the opposite side of the room.  Both will use depth map shadows to help suggest some ambient occlusion without the need for an AO pass.  You can think of these as two large flood lights in the corners of the room facing inwards, this will help visualize how they should look and be placed in the scene.  We'll start with the spotlight screen-right.  Make the cone angle about 80 and angle it so it faces outward from the corner, with the cone edges flush to the walls and ceiling as much as possible.  Penumbra angle should be left at 0.

Once you've placed it, set the color value to the same as your outside light with no falloff, and the intensity to about 0.25. As a general rule, when using a light array to simulate one large ambient fill, just divide the overal intended intensity amongst the number of lights you're using.  In this case, an intensity of 0.5 divided among two lights.  We'll use a shadow map resolution of 1024 here as well, filter size at 5, bias at 0.001.  Render the scene, and it should look something like this.

Left side light room fill
With the right side fill active, now the back wall and air vent is coming into view, and a tiny bit on our two key characters.  Now we'll do the same thing but on screen left.  Set up another spotlight with the cone angle at 80, placed in the corner, edges flush against the walls and ceiling.

Start by copying the settings from the previous corner spotlight, do a render and see how that looks.  You may find you'll want to tweak the settings a bit to get desired results.  In this case I modified my second fill light slightly to have an intensity of 0.19 and color a solid white.  This was to take the edge off the blue tone I was filling the room with, and give more weight to the light coming in from the right angle on our background and characters.  Doing a render now should give you this result.

Isolating light influence
This is a good place to demonstrate an effective technique for fine tuning the look of light and shadow in a scene.  Now that we're at a point where we have different lights interacting with each other and casting shadows that are blending together, it can get difficult to discern just how much impact each light is having, and which lights are responsible for what areas of the scene.

A way to easily isolate and fine tune each light, is to assign colors to both the light and shadow of a particular light source.  For example, in this scene, we'll take the screen left spotlight and change its light casting color to a solid green.

Here you can see the areas that light is affecting, and how it will mix with the other lights in the scene.  Now, one step further, we'll change the shadow color of that light to a bright purple and render the scene once more.

Similarly now, we can visually isolate just which shadows are being created by this spotlight and adjust the intensity of the light, falloff mode and amount, and shadow filtering properties, before setting the colors back to their original desired look.  Just imagine, a scene with 20 lights when you're adjusting for final render can easily get confusing.  This technique should help you zero in on your desired results.  Now, let's move on to lighting the characters.

Key on Woman
The room lighting is looking more believable, but unfortunately, this does not showcase our characters well, so we'll have to introduce some key lights to pull them off the background.  We'll start with the woman. Again, we'll use a spotlight and place it out of frame above her, cone angle wide enough to cover her body, about 80.  An excellent trick for accurately placing a spotlight and making sure its covering your entire subject, is to select the light and in your viewer select "Look through Selected".  In this view, you can use the light like a camera and angle it interactively to look at your subject, and you can see directly if the angle is wide enough to envelop all the area you need.  See below.

Once you've placed the spotlight where desired, we'll set the falloff on this light to linear.  Due to the size of our scene, this will require us to set the intensity to 17 to get a good result.  Set color to a light blue, and penumbra angle to 7 to let the edges falloff a little.  Shadows will be on, we'll use a resolution of 1024, filter size at 3, bias at 0.001.  Rendering the camera view will demonstrate our character is now far better showcased.

Key on Man
The same process can be repeated for the man on the left.  Create another spotlight with a cone angle about 80, place it out of frame, and look through selected to help you quickly get the desired affected range within the angle of the spotlight cone.

We'll make the color of this light a bit warmer to suggest another practical light source out of frame.  The falloff will be linear for this one too, with an intensity about 11, the color tone will be a warm pink, and penumbra of about 8 like our other key light. Again, shadow resolution at 1024, but with filter size of 5 and bias of 0.001.  Also, you may find the shadows to be too intense on your subjects, in which case you'll want to change the shadow color from solid black to a mid-grey.  In this case, I've changed the shadow color to about 50% grey.  Our two key lights are set up now.  When we render the camera view, the characters will be far more readable.

Ceiling and ambient room fill
Something that remains distracting about the background scenery is the ceiling.  Because our corner lights are aimed to cover the walls and floor, the ceiling is left nearly solid black.  To remedy this we'll use a single directional light facing diagonally upwards, this will act as a natural bounce light and give some ambient fill to the ceiling.

This of course will also give a bit of under lighting to our characters.  Since we're only using this to take the edge off the darks, we'll do no shadows.  Directional lights by nature have no falloff, so we'll use an intensity of .175, and use an off-white color to suggest bounce of the general color of the room.  A new render of our camera view should look like this.

Character fill
At this point, the light rig is sufficient enough that we can now see our scene, there are adequate shadows to ground the objects in the environment, and our characters are satisfactory lit and contrast from the background.  However, it may be a good idea to put one more fill light in just for our characters in case we need it to accent the acting.  This spotlight can be positioned on the ground facing up at our characters just in front of them below frame.  Use a cone angle of about 80.

Similar to the directional light, this will be used to take the edge off the shadows currently in place, so we'll treat it similarly to our ambient fill;  no shadows turned on, but with a linear falloff to localize the effects to just our characters.  Intensity should be set around 5 and color will be same as our ambient fill light, an off-white.  These settings can be adjusted of course depending on the amount of shadow you want to remove.   Rendering the camera view should yield this result.

Negative lights
The scene is now entirely lit, and only one detail remains.  Since we are not using ambient occlusion, and now that our characters have a significant amount of lights affecting them from multiple angles, their mouths get a bit lost in the face.  To counter this and give more contrast to the mouths, we'll use negative lights to fake an occlusion area.  Create a point light with a quadratic decay, this will ensure that it is localized just to our characters mouths.  Use a negative value of about -0.7, and then parent constrain it to a joint on the character either at the top of the neck, or the base of the tongue if available.

Do this for both the boy and girl.  Try a render of our shot camera, and you should get a result similar to this.

Compare this with our previous render.  You'll see this creates a nice black void in our characters mouths, helps define that shape much better for lip sync and posing, and overall creates a more natural lighting look for the characters face.

We're Done!
That wraps it up for this light rig.  Once you have the whole rig set up, you can now make whatever tweaks are necessary to mute or highlight various aspects of your shot.  One last thing, be mindful of hotspots in your render.  You don't want to blow out areas of your shot, nor do you want areas falling into absolute darkness either.  Overall it's a good idea to keep the overall range within clipping limits, you can always tweak your render in a compositing software and stretch the tone and values later.  Happy rendering!


Anonymous said...

I love this thanks..... Charles Izzi

Anonymous said...

Hey Natalie, we're going to have to attach this negative light to the back of your tongue, that's cool, right?

Oh, and can someone please turn off the shadows from that floor light? thanks.

Computers are amazing.