• PaulTarjan/Assignment3

# Assignment 3 Camera Simulation

## Compound Lens Simulator

### Description of implementation approach and comments

Well, the implementaiton consisted of 4 parts:

1) Reading in the file. After learning how to use c++ streams this wasn't too bad at all. My main issue that cost me coutless hours is that the file is BACKWARDS from what I thought it was. We always trace rays from the camera, so naivly I thought that is how the file would be set up. Woe was me I output each ray as it was shot and plotted it in matlab. They all went the wrong way! They came inwards instead of going outwards.

I then created a lensSphere object that holds the center of the sphere, its radius, n, previous n, and apature size. This handles the intersection too.

2) Sampling the back lens. Not too hard.

3) Sphere interesection. This wasn't working for the longest time. I know how to use the Quadratic function properly so I did the quadratic formula myself. Thanks grade 12 math.

4) Snell's Law. I did this 3 ways. First I tried to rotate about the cross product of the ray and the normal by the correct angle. Didn't work. Then I found a paper on the vector form of snell's law. Worked. Then I found something on wikipedia, which also worked.

My images are still kinda funky. I have spent countless hours on this, in addition to the 1.5 hours that Kayvon and I spent fix them, but to no avail. If anyone has any ideas as to why there is some transparency in the middle and sides of my image please let me know!

### 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

This should be stopping down by 2 F numbers. This should correspond to an image with 1/4 of the brightness, since the apature is 1/4 the area. Interestingly we only get about a 1/2 reduction in brightness. 13.57% of the rays passed through instead of the usual 27.58%. This is because the original apature didn't block many rays at all, the apature of the lenses did most of the blocking. If we stop down from the 8.55 radius I expect to get 1/4 of the rays through. And drumroll please... 4.02% of the rays go throught. Here is the pic:

## Autofocus Simulation

### Description of implementation approach and comments

Well, this is not going well. I'm using the operator that is given in the paper, and it is fall monotonically as I move away from the lens. Here is a plot of the standard deviation of all the focus operator with step size 1 (3x3 grid) over the whole window.

And one without the first 10 data points:

### 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 .....

PaulTarjan/Assignment3 (last edited 2006-05-16 06:42:42 by PaulTarjan)