Homework 1: Lighting Design in PBRT

Due: Thursday April 13th, 11:59PM

Description

This assignment is designed to get you acquainted with compiling and using pbrt, the physically-based rendering system you will use throughout this course. Along the way you will learn a little about lighting design. Your goal should be to get comfortable with the software by rendering several test scenes and reading the beginning chapters of the textbook. pbrt has been developed and tested extensively on Linux, MacOS, and Windows. Feel free to use whatever platform you desire.

Step 1: Install pbrt

All students should have a personal copy of pbrt, which comes with the text for this class. However, instead of installing pbrt from the CD-ROM, we strongly suggest that you download the latest copy of the software from the www.pbrt.org web site. (Please note: Students planning to build and run pbrt on the Sweet hall 'myth' Linux machines should obtain pbrt from the course directory: /afs/ir/class/cs348b/pbrt/pbrt1.02.cs348b.tar.gz). This archive contains modifications to the build process to allow pbrt to build correctly on these machines). Instructions for setting up pbrt on the various platforms is available at PBRTInfo.

Step 2: Render First Image

Now that you have successfully compiled pbrt, you will render your first image. Download the pbrt scene file and head model located here (also available at /afs/ir/class/cs348b/homeworks/hw1). To render the image, from inside your local directory containing a copy of the scene file, type: pbrt lighting.pbrt. Rendering the scene will take some time, and pbrt will print out statistics of the rendering process to the screen as well as output the image file lighting.exr.

Congratulations, you've rendered your first image with pbrt! You can view the EXR file directly using imageview (Windows, MacOS) or first convert it to a TIFF file using pbrt's exrtotiff utility.

To convert the EXR file to a tiff use the command: exrtotiff lighting.exr lighting.tiff

http://graphics.stanford.edu/courses/cs348b-06/homework1/lighting1.jpg

A correctly rendered image is shown on the left half of the figure above. In this scene, the camera is pointed directly at the model of a face. A single spot light shines on the face from behind the camera and slightly off to the right, casting a hard shadow onto the wall behind the model. The camera and lighting setup for this scene is illustrated in the drawing on the far right.

Step 3: Experiment With Lighting

Photographers use a number of light sources to illuminate a subject in a pleasing manner. In this assignment you will manipulate the lighting in the scene to create several images using pbrt. Try your best to imitate the provided renderings, using the illustrations as hints on where to position the light in the pbrt scene. In your final submission you will hand in a zip file containing each of your renderings and the scene files you used to create them (hand-in instructions are provided in step 4).

Configuration 1. Spot light from below: First, we will move the spot light so it points upward at the face from below. Open the lighting.pbrt scene file and find the description of the spot light in the file. It should look like this:

LightSource "spot" "color I" [50 50 50] "point from" [0.5 0 4.7] "point to" [0 0 0] "float coneangle" [60]

As expected, the light is located behind the camera down the Z axis and slightly off to the right ("point from" field). It is pointed at the center of the scene ("point to") where the model is located. Now move the light so that it is pointed at the model from the position and orientation shown below. A simple change in lighting completely changes the mood of the portrait.

http://graphics.stanford.edu/courses/cs348b-06/homework1/lighting2.jpg

Configuration 2: Area light from right: The light from a pbrt spot light originates from a single point in space. Light originating from a single point generates hard shadows that are objectionable in portraits. Area lights emit light from a large region in space, resulting in softer lighting of the face and the generation of software shadows. The pbrt scene file contains the following definition of an area light (commented out originally in the file):

AttributeBegin
  AreaLightSource "area" "color L" [10 10 10] "integer nsamples" [4]
# use camera coordinate system (optional)
  CoordSysTransform "camera"

# adjust light source position
  Translate 0 0 -2
  Rotate 90 1 0 0
Shape "disk" "float radius" [1.5] 

Light from this source is emitted from a region given by a disk of radius 1.5. The luminance emitted by this light source is given by the value "L". Replace the spot light from configuration 1 with this area light and produce an image similar to the one shown below.

http://graphics.stanford.edu/courses/cs348b-06/homework1/lighting3.jpg

You will notice an increase in rendering time when enabling the area light in the scene. This is a good time to discuss ways to speed up rendering to make the process of tweaking a scene go quickly. The simplest way of doing this is to decrease the size and quality of the rendered image. Notice that lighting.pbrt is set up to render 300x300 images. To render smaller images, change "xresolution" and "yresolution" in the Film defition in the lighting.pbrt file.

Film "image" "string filename" ["lighting.exr"]
        "integer xresolution" [300] "integer yresolution" [300]

Additionally, decreasing the number of samples (eye rays) that pbrt uses to compute each output pixel's value will also speed up rendering. The Sampler definition in lighting.pbrt instructs pbrt to sample each output pixel using two rays. We ask you to increase this value to 4 for your final hand in images, however while setting up your scenes you might wish to use only a single sample per pixel to minimize rendering costs.

 Sampler "lowdiscrepancy" "integer pixelsamples" [2] 

Configuration 3: Two light sources: Notice how the left side of the face is in shadow in configuration 2. In fact, it is so dark that no detail is visible at all. A photographer might use a additional lights to illuminate the subject more evenly. In this setup, a spot light shines on the model at an angle from the left, and a reflecting surface is placed to right of the model to reflect light back onto the dark side of the face, resulting in more even illumination. This second source of lighting on the model is referred to as fill lighting. One way to approximate this effect in pbrt is to use two light sources. Illuminate the model using a spot light from the position indicated in the illustration below. Then use a large area light on the right of the model to give the effect of fill lighting on the dark side of the face. Render a version of the scene without the fill lighting to oberve the visual difference.

http://graphics.stanford.edu/courses/cs348b-06/homework1/lighting4.jpg

Configuration 4: Many light sources: In practice, many lights are used to illuminate the subject exactly to the photographer's preference. Try and adjust the lighting conditions to recreate the scene below where four light sources are used to create a very pleasing illumination across the model. Notice that in this example you will also need to move the position of the camera to view the model from a slightly different angle. Camera settings are defined by the following two lines in the scene file. The LookAt directive specifies the position of the camera in world space, the location the camrea is pointed at, and the "up" direction of the camera.

LookAt 0 0 4.5  0 0 0   0 1 0
Camera "perspective" "float fov" [22]

http://graphics.stanford.edu/courses/cs348b-06/homework1/lighting5.jpg

Step 4: Submission

Your handin will be a zip file consisting of 4 rendered images (converted to jpg format) and 4 pbrt scene files corresponding to the 4 lighting configurations discussed in step 3. Please create a page on the course wiki and upload your submission as an attachment to the page before the due date.

Please adhere to the following guidelines when rendering your final images:

Final Words

We encourage you to experiment around further with pbrt over the course of this assignment. Of course, if you create beautiful images include them in your submission or post them on the wiki, we'd love to see them! Here are some additional things to try that might become useful to you later in the course:

Homework1 (last edited 2006-04-13 05:07:56 by PaulTarjan)