Skip to content
Back to the lab

Photo parallax · Depth map

Depth in a photograph

Shift your viewpoint along the stone path to see the nearest torii pillar slide past the row behind it. Switch to the Bird’s Nest portrait to pull focus from the face to the distant steelwork.

Source · GitHub

Both photographs have a precomputed depth map. Brighter pixels are closer to the lens. As the viewpoint changes, the GPU shifts its samples by depth, finds the nearest visible surface and borrows background colour to fill newly exposed gaps. The portrait also uses depth for focus, keeping details at similar distances sharp.

Original project · img-auto-parallax by Anthony Fu

Source

Source files on GitHub:

Back to the lab