Assignment 3 - Realistic Camera Model (Part II)

Q: What steps you think you completed correctly (assign yourself a grade based on the scale below).
A: I think I have completed most part of the homework but I am not sure if the image is exactly corret. The camera can demonstrate depth of field and focus on different positions.

Q: Links to the tarball of your source code.
A: Here for the extended OpenGL application, still under Windows platform.
Here for the realistic camera source code. realistic.cc, len.h and math2d.h

Q: An image (of your choice) showing the rendering system and the principal planes and the exit pupil.
A: Here is the image with exit pupil
Here are images showing the rendered results, two of them have camera focused near, two focused far; also two of them is shot with fstop 4 and two with fstop 16.

Q: A description of algorithms you used and anything else that is important.
A: The exit pupil is computed like this: compute the lens subsystem parameters (principal planes, focal length), subsystem is the part of lens between the aperture and the image plane. Then image the aperture through the subsystem and it will be the exist pupil.

For this assignment, I am not shooting rays toward the exit pupil, but rather shooting rays toward the rear most len. I used the fstop value specified in .rib file to somehow simulate controlling the aperture: the value is used to decide the ratio of the rear most len that will be shoot rays on. So smaller fstop value means rays will be shot onto larger range of the rear most len, which means larger aperture, and vice versa.

Samples are taken from the film plane as well as the len, then using the thick len approximation, the out-going ray is computed and returned back to ray tracing system. I am not sure about this but seems I have to negate the z and x values of the out-going ray in order to make the final image look right.

User interface:
most are the same as before:
-Mouse: left button to translate, right button to zoom in and out
-Keyboard: 'r' to reset transformation, 'n' to toggle display of normals, 'c' to toggle display of the two extended lines whose intersection defines the principal plane. up_arrow and down_arrow to raise or lower tracing rays. esc to exit.

added:
-'s' to switch to exit pupil view, the green line is the tracing line toward the exit pupil.