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 (A/Z{2})cos(theta)4, 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 with a good deal of extra work. Instead, I had my program output every intersection that occurred inside the lens during ray tracing as sets of 3D 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

blank300x300

hw3telephoto_512

Double Gausss

blank300x300

hw3dgauss_512

Wide Angle

blank300x300

hw3wide_512

Fisheye

blank300x300

hw3fisheye_512

Final Images Rendered with 4 samples per pixel

My Implementation

Reference

Telephoto

http://graphics.stanford.edu/cs348b-06/TomBrow/Assignment3?action=AttachFile&do=view&target=telephoto4.tiff

hw3telephoto_4

Double Gausss

http://graphics.stanford.edu/cs348b-06/TomBrow/Assignment3?action=AttachFile&do=view&target=dgauss4.tiff

hw3dgauss_4

Wide Angle

http://graphics.stanford.edu/cs348b-06/TomBrow/Assignment3?action=AttachFile&do=view&target=wide4.tiff

hw3wide_4

Fisheye

http://graphics.stanford.edu/cs348b-06/TomBrow/Assignment3?action=AttachFile&do=view&target=fisheye4.tiff

hw3fisheye_4

Experiment with Exposure

Image with aperture full open

Image with half radius aperture

blank300x300

blank300x300

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 f-stops (since one f-stop 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

blank300x300

hw3afdgauss_closeup

Double Gausss 2

mm

blank300x300

hw3afdgauss_bg

Telephoto

mm

blank300x300

hw3aftelephoto

Any Extras

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