Friday, October 30, 2009

Bonus Lesson: Lighting Reviewed



Here is the exercise with which we wrapped up our final session. Do this exercise from time to time for review. It was inspired by a lecture Jeremy Vickery gave at Gnomon.

Create a Poly Cube, 10x10x10 units, with 3 divisions in each direction.



 Next delete the front faces and the middle face in the rear to create a room with a window:



 
Now decorate your "room" with some various NURBs or Poly primitives. Toruses and Spheres work nice, as do stacks of duplicated cubes.



Now lock off a camera somehow so you can start test rendering. 3 methods that work are: 
1. create a new perspective camera and lock its translate, rotate attributes
2. create a camera bookmark and go to the bookmark before each test render
3. set a key on the camera on frame one and then move the time slider to return to your keyed view before each test render




Now we light!
First we need a card to represent the light outside the window. Create a Poly plane and position it behind the room-box so it fills the window form the camera's POV. Create a new Lambert material for this card and turn its Incandescence value all the way up (a white "Surface" shader would work as well).



 Now create a spotlight and invoke Panels: Look Through Selected to help you position it outside the box partially illuminating your hero objects.



Name this light KeyLight. Turn ON Raytrace shadows. Check Render Settings and make sure you are using Mental Ray. On the  Quality tab switch to Preview. Test Render to see something like this:



We have a keylight established, now we will set the ambient lighting for the room. Never use an "Ambient" light, which tends to limit the value range and thereby "flatten" the scene. A better method would be to connect an ambient occlusion texture to the Ambient Color of the scene's shaders. This will create a fill color that varies in brightness according to the occlusion of each surface area (that is, how close it is to other objects).
Find the mib_amb_occlusion texture in the Mental Ray Textures area of Hypershade. If you middle-mouse-drag this onto lambert1 (the shader assigned to all objects) and choose to connect it to ambientColor you will make this connection. For the occlusion texture, set Samples to 100, Max Distance to 5.



If you set the Bright value in the occlusion texture to an upper-mid-value rusty orange and the dark value to a reddish black, you can get a very warm-toned image for effect. I also changed the Incandescence color of the "skydome" shader (the one on the card outside the window) to a warm off-white.



Now we will place a series of bounce lights at low intensity to represent the secondary light rays, or bounce lights. Create an Area Light and move, rotate and scale it to have it roughly cover the main area on the floor that the key light is hitting. It will represent the light that is bouncing off the floor toward other parts of the room. Try lowering its intensity to .1 or .2 and give it soft depth map shadows (with a filter size of 5-7). Also tone the light color slightly orange to represent the color bleed from the bounced light (secondary rays tend to pick up the local color of the first object they hit and "bleed" this color onto nearby objects). Name this light BounceLight1.



Duplicate this light and move and resize to any other areas that the primary light hits directly (the wall, other areas of the floor). Adjust intensities of all lights to balance the image.



Now create and resize an area light to fill the area of the "window". Call this light Fill1 and set it to be 3 or 4 times brighter than any of the Bounce lights (I used .25). This represents the scattered light entering through the window.



Duplicate this light and flip it 180 degrees, moving it out in front of the window a few units. This Fill light will approximate the "bloom" of the light source; in this case, the window. Reduce the intensity to something akin to the Bounce lights (like .1).



To boost the bloom effect, add a shader bloom to the lambert on the sky card, something like .1 (Special Effects section: Glow Intensity). Set the KeyLight to an Intensity of 2 to make the scene brighter to match the apparent "brightness" of the window.



That's the basic strategy: identify your primary direct light sources (in this scene, only one: the window), then do bounce lights located at the major surface areas the direct lights are hitting, then do fills to represent scattered light in the environment. Do all of this with some method of ambient lighting; here we used an ambient occlusion texture (keeping render times down to about 12 seconds). Final Gather or Global Illumination can be used instead, but often with much longer render times.

To take this exercise further, try adding "Rim Lights" to your hero objects or changing the palette by tweaking the Bright and Dark values of the ambient occlusion texture. Practice lighting with primitives like this until it starts to become intuitive.

Happy lighting!


No comments:

Post a Comment