---
title: "Photobooth"
url: "https://brandengarrett.com/experiments/photobooth"
author: "Branden Garrett"
datePublished: "2026-11-07T12:20:35.372Z"
dateModified: "2026-11-08T01:55:02.530Z"
description: "A webcam photobooth with 71 real-time effects written in Three.js, from shader filters to full 3D scenes, plus face tracking and background removal with MediaPipe. Snap stills, 4-up strips, or short clips. Everything runs in the browser."
---

# Photobooth

A webcam photobooth with 71 real-time effects written in Three.js, from shader filters to full 3D scenes, plus face tracking and background removal with MediaPipe. Snap stills, 4-up strips, or short clips. Everything runs in the browser.

- Try it: [bgrrtt-photobooth.vercel.app/photobooth](https://bgrrtt-photobooth.vercel.app/photobooth)

## What I learned

- **Measure before you plan.** I estimated background segmentation at 5 to 15 ms a frame. A spike measured 0.58 ms on an M1 Max, cheap enough to run inline at 60 fps. Face landmarks were the expensive part at 6.5 ms with two faces, so they run on their own cadence that steps down from 30 to 20, 15, then 10 Hz when frames run long.
- **The clever path broke quietly.** Sharing one WebGL context between MediaPipe and three.js worked in the spike, which had a canvas of its own. In the real app MediaPipe resized the visible canvas and left three.js's cached GL state stale, and the segmentation mask came back empty with no error. Each now gets its own context, and the mask comes back over the CPU at 20 Hz. Slower and correct.
- **WebGL fails black and silent.** A float texture with linear filtering samples as solid black on hardware without the right extension. A fragment shader that uses a uniform declared only in the vertex stage fails to compile, and three.js logs it instead of throwing, so eight new face effects rendered black with no error anywhere. And the segmenter's mask order belongs to the model, so taking mask 0 gave me an empty or inverted subject.
- **Small file formats matter.** The film looks are lookup tables generated from code. Written as plain PNGs they came to 3.3 MB; with per-scanline PNG filtering, 268 KB.

## How to help

- **Try it somewhere I haven't.** Safari's support for recording webm clips is partial, and phones only allow the camera over HTTPS. Tell me your browser and device and which effects or captures fail.
- **Face and background effects with a real person in frame.** The automated tests run on a synthetic pattern with nobody in it, so those effects get the least coverage. A description or a capture of one that looks wrong is useful.
- **Suggest the next effect.** Each one is a single file, so a good idea is cheap to try.
