COMP 238 Programming Assignment 3

Implement either a Light Field viewer or some other IBR renderer. (assignment)


I implemented a light field renderer. I used my own images (generated by my raytracer), beacuse no matter how much I tried tweaking, the images provided did not produce acceptable results.


I used the approach shown below in 2D:

From the camera point C, rays are shot just like in a ray tracer. Each ray's intersection with the UV plane provides the camera points P1 and P2 corresponding to the closest cameras whose images are considered. The ray's intersection with the object plane provides point W upon which the desired camera is "focusing". The intersection of segments WP1 and WP2 with the ST plane provide the exact locations of the point samples. I preferred simple geometry computations here due to their simplicity. This results in 2 point samples that are averaged together.

In 3D, samples are taken from four neighboring cameras. The four samples are averaged together into the final sample for the current ray, with weights inversely proportional to the distance between the intersection point of the ray with plane UV and each camera point. I factored out the common part of the intersection computations, and wrote the rest as incremental computations for each of the four samples.

I implemented free movement of the camera along the three dimensions and sliding of the object plane back and forth (which is perceived as focusing at a particular distance).

Although conceptually straightforward, this assignment was tedious to implement, due to the numerous non-trivial bugs I had to find and correct.


Below are some screenshots produced by my program:


Moving the camera left to right (animation here).


Focusing the camera (animation here).


Moving the camera up and down (animation here).


Last modified on October 15, 2002 by .