In general, I follow the procedure taught in class. First, I assume the exit pupil to be the farest lens away from the film, so the first lens sample is sampled from that lens and the initial ray shoot directly to the sample point on that lens. Secondly, I have applied 2 sampling method: the concentric disk sampling and the uniform disk sampling([5], p.47). In addition, I have implemented 2 approaches to calculate the refractions: the Heckber's method and the method in [5], p.55.

For the bonus part, I simply follow the procedure describe in [1].

The second refraction method, the one with more division but less multiplication, was about 5% faster than the Heckber's method running on the NTU CSIE workstation (linux9).

The result images of the 4 scenes using 4 samples and 512 samples are shown as follow:

dof-dragons.dgauss 512 samples 4 samples

dof-dragons.fisheye 512 samples 4 samples

dof-dragons.telephoto 512 samples 4 samples

dof-dragons.wide 512 samples 4 samples

The images bellow are the rendered results of dof-dragons.fisheye.pbrt using the 2 sampling methods I have applied. We can noticed that the 2 result have little differences.

Sampling Method 1 Sampling Method 2

To switch between different methods, one have to change the #define's: for sampling methods, "#define SAMPLING_METHOD_1" and "#define SAMPLING_METHOD_2"; for refraction methods, "#define REFRACTION_METHOD_1" and "#define REFRACTION_METHOD_2".

Note that only one of the sampling methods and one of the refraction methods can be defined.Source code: realistic.cpp

- Craig Kolb, Don Mitchell and Pat Hanrahan, A Realistic Camera Model for Computer Graphics, SIGGRAPH 1995.
- Assignment #3, CS 348b, Stanford
- Assignment #3, CS 395T, University of Texas
- Assignment #3, CS 551/651, University of Virginia
- Course slides(Cameras)