Assignment 3: Camera Simulation
Due: Thursday May 4th, 11:59PM
Questions? Need help? Post them on the Assignment3Discussion page so everyone else can see!
Please add a link to your final writeup on Assignment3Submission.
Many rendering systems approximate the light arriving on the film plane by assuming a pin-hole camera, which produces images where everything that is visible is sharp. In contrast, real cameras contain multi-lens assemblies with different imaging characteristics such as limited depth of field, field distortion, vignetting and spatially varying exposure. In this assignment, you'll extend pbrt with support for a more realistic camera model that accurately simulates these effects.
Specifically, we will provide you with data about real wide-angle, normal and telephoto lenses, each composed of multiple lens elements. You will build a camera plugin for pbrt that simulates the traversal of light through these lens assemblies. With this camera simulator, you'll explore the effects of focus, aperture and exposure. Using these data you can optimize the performance of your simulator considerably. Once you have a working camera simulator, you will add auto-focus capabilities to your camera.
Step 1: Background Reading
Please re-read the paper "A Realistic Camera Model for Computer Graphics" by Kolb, Mitchell, and Hanrahan.
Step 2: Implement a Compound Lens Simulator
Copy this zip file to a directory at the same as the directory containing the 'core' directory. This archive contains the following:
- A Makefile for Linux and a Visual Studio 2003 project for Windows.
- A stub C++ file, realistic.cpp, for the code you will write.
- Five pbrt scene files
Four lens description files (.dat files)
- Binaries for a reference implementation of realistic.cpp for Linux
Various textures used by the scene files located in the /textures subdirectory
Modify the stub file, realistic.cpp, to trace rays from the film plane through the lens system supplied in the .dat files. The following is a suggested course of action, but feel free to proceed in the way that seems most logical to you:
Build an appropriate data structure to store the lens parameters supplied in the tab-delimited input .dat files. The format of the tables in these file is given in Figure 1 of the Kolb paper.
- Develop code to trace rays through this stack of lenses. Please use a full lens simulation rather than the thick lens approximation in the paper. It's easier (you don't have to calculate the thick lens parameters) and sufficiently efficient for this assignment.
Implement the RealisticCamera::GenerateRay function to trace randomly sampled rays through the lens system. For this part of the assignment, it will be easiest to just fire rays at the back element of the lens. Some of these rays will hit the aperture stop and terminate before they exit the front of the lens.
- Render images using commands such as 'pbrt hw3.dgauss.pbrt'. For your final renderings be sure to use the correct number of samples per pixel. The final handin should contain images rendered with both 4 and 512 samples per pixel.
You may compare your output against the reference implementation, (realistic.so on Linux RedHat 9.0 and realistic.dll on Windows).
Here are some example images rendered with 512 samples per pixel:
Step 3: Play around with Cameras
Step 4: Autofocus