Part II · Geometry & The 3D World · Chapter 04

How Cameras Flatten 3D into 2D

Every photograph is a remarkable act of compression: an entire three-dimensional world of rooms, trees, and mountains squeezed onto a flat sheet of pixels. The secret behind how it happens is surprisingly simple — light travels in straight lines.

Imagine holding your thumb up at arm's length and closing one eye. With a tiny movement, your thumb can completely blot out a towering skyscraper or an entire mountain peak across the valley. Of course, nothing shrank the mountain. What you just discovered is the core rule of all cameras: apparent size is a tug-of-war between how tall something is and how far away it stands.

The Pinhole Trick: Taming Scattered Light

Suppose you take a bare light-sensitive sensor — the digital grid of pixels we met in Part I — and hold it outside facing a glowing tree. Do you get a picture of the tree? Not at all. Light from the treetop hits every pixel on the sensor, and light from the trunk also hits every pixel. Everything blends together into a muddy, featureless glow.

Now place a dark wall in front of the sensor and poke a single tiny pinhole right in the middle. Suddenly, order emerges from chaos. Light from the very top of the tree can only pass through that tiny hole along one straight path, so it lands near the bottom of the sensor. Light from the roots passes through the same hole and lands near the top. Every point in the 3D world now claims its own unique spot on the 2D screen — upside down!

Interactive Lab 4.1 Pinhole Camera Ray Tracer

Drag the glowing subject left or right in the 3D world, and drag the sensor screen behind the pinhole to change the camera's zoom. Watch the crossing light rays act like a seesaw!

Distance: 1.0× Image Height: 1.0× Sensor Depth: 1.0× Rule: Baseline size
✦ Key Relationship · The Seesaw of Size

Think of the pinhole as the pivot of a seesaw. Two simple trade-offs control how big an object appears on the sensor:

  • Push the subject twice as far away → its image on the sensor shrinks to half as tall.
  • Slide the sensor screen twice as far back → the rays spread out further before hitting the screen, stretching the image to twice as tall (a 2× zoom).

Real cameras replace the tiny pinhole with a glass lens so they can gather much more light without making the picture blurry, yet the geometry stays identical. Pushing the sensor screen farther from the pinhole is exactly what a camera's focal length does: a short screen depth gives you a wide view of the room, while a deep screen depth zooms in tightly on a narrow slice of the world.

? Pause & Think

In classic suspense movies, directors love a dizzying shot called the dolly zoom: the camera physically rolls backward away from an actor while zooming in at the exact same time. The actor stays the same height on screen, yet the hallway behind them seems to stretch and rush forward. Why?

Rolling backward increases your distance to the actor by a large fraction (say, doubling it), while barely changing your distance to a far-away wall. When you simultaneously pull the sensor screen back to zoom in and keep the actor at the same size, that extra zoom magnifies the distant background much more than the step backward shrank it — so the background looms dramatically closer!

Why Parallel Lines Meet at the Horizon

Now step inside the camera's viewpoint and look straight down a long, straight road lined with evenly spaced telephone poles. In the real 3D world, the left and right edges of the road never touch; they stay the exact same width apart for miles.

Yet on our flat 2D sensor, those parallel edges lean toward each other and collide at a single glowing dot on the horizon — the vanishing point. You already know why! Because apparent size shrinks as distance grows, the constant gap between the left curb and the right curb looks wide at your feet, half as wide further down, a tenth as wide near the hills, and shrinks all the way to zero at infinite distance.

Try dragging directly on the road below to move the camera up, down, left, or right — or slide the Field of View from wide-angle to telephoto — and watch how every set of parallel lines obeys that single vanishing point.

Interactive Lab 4.2 Vanishing Points & Parallel Roads

Drag anywhere on the scene to shift the camera's height and sideways position. Notice how the vanishing point always stays glued to eye level on the horizon.

Lens Feel: Natural Near vs. Far Pole: 4.0× taller Parallel Lines: Meet at 1 horizon point
★ Core Intuition · What a Single Camera Loses

Look back at the pinhole ray tracer for a moment. Imagine placing a tiny toy tree halfway to the pinhole, and a giant real tree twice as far away. Because both trees sit along the exact same pair of straight light rays, they paint the exact same pixels on the sensor!

Flattening 3D into 2D is a one-way trade: a single photograph preserves direction, but it throws away distance. To recover that missing third dimension, a vision system needs a second clue — which is where two eyes come in.

Chapter 4 Takeaways

  • A pinhole forces light from every 3D point onto one straight ray, creating a sharp, upside-down 2D image on the sensor.
  • Apparent size follows a seesaw relationship: twice as far → half as tall, while pulling the sensor screen back zooms in.
  • Parallel 3D lines appear to converge at a vanishing point on the horizon because their constant gap shrinks toward zero with distance.
  • Because any point along the same light ray lands on the same pixel, a single still photo cannot tell a small nearby object from a giant distant one.