The result of using 64 samples of shadow rays (16 samples per pixel):
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.
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|
The code is here.