Assignment 3 Camera Simulation
Tom Brow
Date submitted: ?? May 2006
Code emailed: 10 May 2006
Compound Lens Simulator
Description of implementation approach and comments
I represent the compound lens using a linked list of lens structs, each of which contains information about one lens surface or aperture stop. The surface of the element is represented as a pbrt Shape  a Sphere for a lens surface, and a Disk for a stop  and precomputed values for the refractive index ratio across the surface (i.e. n1/n2) and the cosine of the critical angle are stored as well. The compound lens structure also stores a Transform from camera space to lens space (and vice versa) so that the construction and intersection of lenses can all be done in lens space.
To generate a ray, the camera samples the aperture of the back element, then traverses the linked list of elements, applying the vector form of Snell's Law (source: Wikipedia) at each surface. The ray is terminated and returned with weight 0 if it either (a) fails to intersect or (b) is totally internally reflected from any surface. Otherwise, the modified ray is returned with the weight given by Acos(theta)^{4}/Z^{2}, where A is the area of the aperture of the back element, Z is the distance from the film plane to the back lens, and theta is the angle between the original, unmodified ray and the normal to the film plane (source: Kolb).
While testing by compund lens implementation, I found it useful to visualize the path of rays traveling through the lens. However, it would have been difficult to render the lenses and rays directly without a good deal of extra code. Instead, I had my program output every intersection that occurred inside the lens during ray tracing in 3D camera space coordinates, grouped by ray. Plotting these points in 2D and 3D space using gnuplot, I could visualize lens surfaces as clusters of intersections, and trace lines through groups of intersections to simulate rays. The 2D plots look like this: Upload new attachment "plot1.png", Upload new attachment "plot2.png", Upload new attachment "plot3.png", Upload new attachment "plot4.png".
Final Images Rendered with 512 samples per pixel

My Implementation 
Reference 
Telephoto 


Double Gausss 

Wide Angle 

Fisheye 
Final Images Rendered with 4 samples per pixel

My Implementation 
Reference 
Telephoto 


Double Gausss 

Wide Angle 

Fisheye 
Experiment with Exposure
Image with aperture full open 
Image with half radius aperture 


Observation and Explanation
As expected, the brightness of the captured image decreases, and the depth of field increases slightly. Reducing the radius of the aperture by a factor of two means reducing the area of the aperture by a factor of 4, or decreasing the aperture by two fstops (since one fstop corresponds to a decrease in area by a factor of 2). Recall that the ray weighting formula I used takes aperture area into account.
Autofocus Simulation
Description of implementation approach and comments
......
Final Images Rendered with 512 samples per pixel

Adjusted film distance 
My Implementation 
Reference 
Double Gausss 1 
mm 


Double Gausss 2 
mm 


Telephoto 
mm 

Any Extras
...... Go ahead and drop in any other cool images you created here .....