Depth Of Field

I added depth of field to the camera class. There are two parameters that affect the depth of field using this interface; focal distance and lens radius.

The focal distance corresponds to the distance of the focal plane which will have an infinite depth of field and is the same as the pinhole camera. This means that objects at the focal distance will be in focus.

The lens radius corresponds the the aperture which samples are generated on. The larger the radius the more peturbed the ray is and gives a shallower depth of field.

Below the gifs show the affect of changing one of the parameters while keeping the other one fixed.

render-aperture.gifrender-dof.gif

Advertisements

Revision: Software Rasterization

Some more revision for the graphics course. This time I created a software rasterizer using only the information and algorithms described in the lecture slides linked below. Its pretty slow.

In the slides it uses the shoelace algorithm for backface culling and z-buffer for visible surface determination. Below is a screenshot visualizing the depth values; smaller values means an object is closer.

http://www.dcs.kcl.ac.uk/staff/richard/6CCS3GRS/render3d1.pdf
http://www.dcs.kcl.ac.uk/staff/richard/6CCS3GRS/render3d2.pdf

zbuffer.png