Welcome, Jiyue  [Logout]
Assignment 1: Studio lighting
By taodu

Due date: Thursday April 9th, 2015 by 11:59PM PDT.

This assignment is designed to help you get pbrt, the physically-based rendering system you will use throughout this course, set up and running on your machine, as well as teach you a bit about lighting design. Along the way, you'll familiarize yourself with the software by rendering several test scenes and reading the first few chapters of the textbook. The pbrt system has been developed and tested extensively on Linux, MacOSX, and Windows; feel free to use whatever platform you're most comfortable with.

Step 1: Building PBRT


Detailed instructions for setting up pbrt on various platforms are available here. For the remainder of this assignment, we'll assume that pbrt is correctly built and that the pbrt binaries are in your path.

Step 2: Rendering Your First Image


Once you have successfully compiled pbrt, you can render your first image. Download the Assignment 1 starter files here . From within the directory containing the scene file, render an image with the command:

pbrt lighting.pbrt.

After pbrt is done rendering, it will print statistics of the rendering process to the screen and output the image file lighting.exr.

Congratulations, you've rendered your first image with pbrt! Convert it to a TIFF file using pbrt's exrtotiff utility and then open it using any image viewing program. (Alternatively, you can view the EXR file directly using programs such as Photoshop or OpenEXR's exrdisplay.)

A correctly rendered image is shown at left in the figure above. In this scene, the camera is pointed directly at the model of a face. A single spotlight 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 location of the camera and spotlight are illustrated on the right.

Before you move on, please open lighting.pbrt and read all the comments carefully. Try to understand the positions of the camera, the spot light and the head model. Keep in mind pbrt uses left-handed coordinate system. It is also highly recommended that you take some time to go over Cameras, Lights and Area Lights in pbrt-v2/docs/fileformat.pdf before you start doing the assignment.

Step 3: Lighting the Scene


In this assignment you will manipulate the lighting in a simple test 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 lights.

Configuration 1: Spotlight From Below

First, we will move the spotlight so it points up at the face from below. Open the lighting.pbrt scene file and find the description of the spotlight 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]

By inspecting the the "point from" field, we see that the light is located behind the camera and slightly off to the right. It is aimed at the center of the scene (the "point to" field) 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!

Configuration 2: Area Lighting From The Right

The light from a pbrt spotlight originates from a single point in space. Light originating from a single point in space results in hard shadows that photographers generally find visually objectionable. Area lights emit light from a large region in space, resulting in a softer lighting of the subject and the generation of shadows with penumbra. The pbrt scene file contains the following definition of an area light (commented out):

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
define the shape of the arealight to be a disk with radius 1.5
Shape "disk" "float radius" [1.5]
AttributeEnd

Light from this source is emitted from a disk of radius 1.5. The luminance (or energy) emitted by this light source is given by the value "L". Take out the spotlight from Configuration 1 and modify the area light definition above to produce an image similar to the one shown below.

You will notice an increase in rendering time when you enable the area light in the scene. This brings up an important point: sometimes you'll want to speed up the rendering process so that you can tweak a scene's properties more efficiently. The simplest way to do 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 definition in lighting.pbrt.

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 the value of each output pixel will also speed up rendering. The Sampler definition in lighting.pbrt instructs pbrt to sample each output pixel using 4 rays.

Sampler "lowdiscrepancy" "integer pixelsamples" [4]

We ask you to use at least 4 samples for your final hand-in images. However, while setting up your scenes you might wish to use only a single sample per pixel to reduce rendering time.

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 additional lights to illuminate the subject more evenly. In this setup, a spotlight shines on the model at an angle from the left, and a reflecting surface is placed to the right, in order to reflect light back onto the dark side of the face and produce 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 spotlight 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 the scene with and without the fill lighting to observe the visual difference.

Configuration 4: Many Light Sources

In practice, photographers use many lights to illuminate a subject so that the resulting image conforms precisely to their preferences. Try to adjust the lighting conditions to recreate the scene below, in which four light sources are used to create a visually pleasing effect. 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. The LookAt directive specifies the position of the camera in world space, the location the camera is pointed at, and the "up" direction of the camera. Camera settings are defined by the following two lines in the scene file:

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

The following 4 images show the separate effect of the four light sources.

The main light is on the side of the face away from the camera.

The fill light is close to the camera on the opposite side from the main light.

The accent light shines toward the upper part from the back of the subject. Normally, it is used to highlight the texture of hair. In our case, we'll use it to accent our model's embarrassing lack of hair.

The background light separates the subject from the background. It is placed behind the subject and to one side, facing toward the backdrop.

Submission and Grading


This assignment will be graded on a credit/no credit basis. Credit will be given if the example renderings are reproduced to reasonable accuracy. Try your best to mimic the lighting configurations in the example renderings, but don't worry if your images aren't perfect matches. For example, for configuration 2 , you solution is acceptable as long as you put the light source to the left of the head model and manage to get highlight and shadow on the face. The important thing is that you become familiar with pbrt and manipulating properties of its scene files.

To submit your work, please send your username to cs348b-spr1415-staff@lists.stanford.edu, and we will create a wiki page for you to write your report. This wiki page should contain:

1. Images you rendered in the steps above: one for configuration 1; one for configuration 2; two for configuration 3(with and without the fill lighting) and five for configuration 4(four for each single light source and one for all). You should render all these images at a resolution of 300x300, with at least 4 samples per pixel and at least 4 samples per area light source.
2. LightSource and AreaLightSource in your pbrt scripts for each step.
3. A summary(in a few sentences) of the process you followed to develop the correct scene configurations. This summary might include problems you encountered with the pbrt build/installation process, steps you took to speed up the render/view/render process, other experimentation you performed, etc.

You are currently subscribed to this thread! You are not currently subscribed to this thread.