The top frame of the image below shows an image formed on the screen (at right) of an object (pencil on the left) located at some distance $D$ from the lens. The lens focuses all the light rays hitting it from the top of the pencil onto the corresponding point on the screen.

The bottom frame shows the same setup, except with the top of the pencil missing. The point on the screen which previously had only light rays from the top of the pencil impinging on it, now has rays from other points to the left of the pencil (for instance, the triangle,square,circle, etc.) hitting it. Those points are all completely different light sources (different frequency, phase, etc.), their combination at the screen will not be coherent or of any single frequency.

This means that a lens focused on an object a distance $D$ from it (to photograph the bottom half of the pencil), should show make a screen image with the bottom half of the pencil sharp, but anything behind its (missing) top half completely blurry.

But then how come in reality, when we take regular photographs, even though we set the focus to capture an object some specific distance away, the objects (not too far) behind it still come out mostly properly (correct colors) and sharply? In other words, how come it is almost never the case that when we focus a camera or our eyes on some object, everything else in front or behind it is blurry?

2 Answers
2

Imaging a 3D object onto a 2D plane has inherent tradeoffs. The easiest way to state the tradeoff is between diffraction limited resolution and depth of field. In practical photography, there is also a tradeoff of how much light is making it to the sensor.

To explain what that means in less technical terms; all cameras have an adjustable aperture somewhere in the lens which can be wide open or can be closed to the size of a pinhole. In your diagram this is equivalent to the size of the lens.

In the case of a pinhole sized aperture, all rays from objects at any distance end up in the image plane of the lens because there is only one path for them to take through the pinhole. This has two deleterious effects on your image however; the first is that you can't get a lot of light through such a tiny hole, and the second is that the diffraction effects at this hole make it so that the smallest object you can resolve gets large so that the image will lose detail. In the case of a very large aperture, rays from different focal planes focus to different places. This is called depth of field in the photography community. This means that when you focus on a particular plane, planes far from the focused plane will be out of focus.

The image below from http://www.all-things-photography.com shows the effects of aperture size rather well. On the left hand side the aperture is closed so both the trees in the foreground and the water in the background are in focus. The water is blurred because the tiny aperture size requires a long exposure time. On the right hand side the aperture is wide open so the running water appears still because of shorter exposure time, but the foreground is blurry.

This is because usually you are taking pictures of objects that are in much greater distance from the lens than the focal length. In this case the photographed objects are all almost in "infinity" and the rays do not diverge that substantially.

In your drawings here you have the object in the same distance as the focal length, so it is more like a macro photography, where the depth of field is really very small and objects out of focus are very blurry.