← Bookmarks 📄 Article

Cameras and Lenses – Bartosz Ciechanowski

Build a camera from scratch using interactive physics simulations—from bare photodetectors to understanding why f/1.4 lenses cost thousands and how aperture actually controls depth of field through cone geometry.

· photography
Read Original
Listen to Article
0:007:14
Summary used for search

• Starts with raw photodetectors capturing photons, adds Bayer filters for color, explains demosaicing—the full sensor pipeline visualized
• Shows why pinhole cameras fail (too dim, no focus control) then derives convex lenses by manipulating refraction angles until rays converge
• Aperture controls depth of field by changing the cone angle of light—smaller aperture = narrower cone = larger depth of field, with f-numbers defining the focal length to aperture diameter ratio
• Real lenses battle spherical aberration (spherical surfaces don't perfectly focus), chromatic aberration (different wavelengths focus at different distances), requiring multi-element designs
• Every concept demonstrated with draggable, adjustable simulations showing ray paths, wavefronts, and resulting images in real-time

This interactive guide builds a complete understanding of camera optics from fundamental physics. It starts with the sensor itself—photodetectors converting photons to electrical signals, Bayer color filter arrays (RGGB patterns), and demosaicing algorithms that interpolate full RGB values from sparse color data. The progression reveals why bare sensors produce useless images: every pixel sees light from the entire scene simultaneously.

The article then constructs solutions systematically. Pinhole cameras work by restricting each pixel to a narrow cone of light, creating recognizable (but inverted) images. However, they're fatally limited—tiny holes mean dim images requiring long exposures, and you get no control over which parts are sharp. The breakthrough comes from understanding refraction: glass with non-parallel surfaces bends light predictably via Snell's law. By shaping glass into a rotationally symmetric convex lens, you can gather a large cone of light from each scene point and converge it to a sharp focus. The thin lens equation (1/s_o + 1/s_i = 1/f) relates object distance, image distance, and focal length.

Aperture provides artistic control through geometry. By placing an adjustable iris in the light path, you change the cone angle without moving the focus point. Wider apertures (smaller f-numbers like f/1.4) create shallow depth of field because out-of-focus points spread into larger circles of confusion on the sensor. The f-number (focal length / aperture diameter) determines both light gathering and depth of field—it's why doubling focal length while maintaining the same f-number requires doubling aperture diameter to gather equivalent light.

The final section confronts reality: spherical lenses don't perfectly focus (spherical aberration), different wavelengths refract differently (chromatic aberration), and professional lenses use many elements to correct these flaws while balancing weight and cost.