COMP870: Homework 2

Huai-Ping Lee

Soft Shadow

The result of using 64 samples of shadow rays (16 samples per pixel):

soft shadow

The light source is a quad. When shooting shadow rays, 16 samples are created on the quad using Halton sequence, and a shadow ray is created for each of these samples.

Thin Lens Camera Model

The following pictures shows results using different focal length and aperture radius (one sample per pixel, 64 eye rays per sample). When focal length = 0.4, it seems to focus on the green ball. Also note that depth of field is affected by aperture size. The smaller the aperture is, the larger the depth of field becomes (less blurred). The shape of blurred objects may look like "square" because the aperture used in my program is actually a square. I used Halton sequence to create samples on the lens and shoot rays towards the focused point. The focused point is computed with the thin lens formula.

raperture = 0.02 raperture = 0.10
f=0.2 f = 0.2, r = 0.02 f = 0.2, r = 0.10
f=0.4 f = 0.4, r = 0.02 f = 0.4, r = 0.10

Code

The code is here.