Next, we can dynamically change the apature. I will tell the program to focus on the background, so that the closer objects are out of focus. When I change the apature, more and more cameras will be used to calculate the final rendered image. Thus, as I increase the apature bar, the out of focus parts of the image will become very blurry.
We can try this with different focal distances. For the next few images, I am focused in the middle -- the cookie monster and guitar will be in focus. Notice how most other objects become blurry, even though with an low value on the apature bar, a few things look in focus.
To implement these effects, I used a Gaussian to weight each image, and then I simply summed each one. The shape of the Guassian is determined by the apature slider.