## 1. Your prompt, rewritten

> "Animate my attached bot (a white sphere with two slanted black capsule eyes) using as many FX (effects) techniques as possible. Draw from early gaming through modern real-time 3D, film, video and painting. Think like an animator, director, game developer and fine artist. First give me the full catalog, ordered by sequence. Then build one bot at a time as a live, interactive demo. Keep the character consistent across all demos. Pause after each one. Flag any technique that needs an external API before you use it."
## 2. What option 26 shows

- **Focus moves; the camera doesn't.** Every 3.5 seconds the focus pulls between the front bot (about 3 m away) and the back bot (about 7 m). The sharp bot hops and glances at the camera; the soft one watches its partner. Focus acts like a spotlight for attention.
- **Blur comes from real depth.** The scene is rendered once, along with a depth image. Each pixel's blur size then depends on how far it is from the focus distance. The plant nearest the lens and the fairy lights far behind both melt, in opposite directions.
- **Bokeh shapes.** Bright points blur into shapes that copy the lens opening:

| Shape | Real cause |
|---|---|
| Round | Circular aperture (wide open) |
| 6-blade | Hexagonal iris when stopped down |
| Anamorphic | Tall ovals from squeeze lenses used in widescreen cinema |
| Cat's eye | Lens barrel clips light toward frame edges; centre discs stay round |

## 3. Experiments

1. **Aperture f/1.4, then f/16.** Wide open: creamy background, huge bokeh. At f/16 almost everything is sharp. Smaller openings give more depth of field.
2. **Tap the fairy lights, then the plant.** Tap-to-focus aims a ray into the scene and measures the distance to what it hits.
3. **Tick "Blur map."** Blue means in front of the focus plane, orange behind, black sharp. Watch the black band travel as focus racks.
4. **Tick "Focus peaking."** Sharp edges light up red. Real cameras use this so camera operators can pull focus by eye.
5. **Watch the frame edges during a rack.** With "Focus breathing" on, the view zooms slightly as focus shifts. Many real lenses do this; expensive cinema lenses are designed to avoid it.

## 4. Less obvious details

- **Bright lights dominate the blur.** Bright pixels get extra weight, so fairy lights bloom into crisp discs instead of dull smudges. Film and photo bokeh behave the same way.
- **The sharp bot doesn't bleed into the background.** Pixels behind an in-focus edge are limited in how much they can spread onto it. Skipping this rule gives a glowing halo around sharp subjects, the classic "cheap blur" look.
- **Each bokeh disc has the shape of the lens, scaled per pixel.** The shape test runs relative to each sample's own blur size, so big and small discs share the same outline.
- **Rack focus is storytelling.** The cut between two faces happens without a cut. The audience's eye follows the sharpness.

## Examples

**Blur size from distance**
```
camera ─┬───────── plant (1.4 m) ───── front bot (3.1 m) ───── back bot (7 m) ─── lights (11 m)
        │ blur:      ██ big (blue)       · sharp                ▓ medium (orange)   ██ big
blur ≈ aperture × (depth − focus) ÷ depth      (clamped to 4.5% of frame height)
```

**How one pixel is blurred**
```
for 80 samples in a spiral around the pixel:
    sample's own blur radius r
    if (offset ÷ r) is inside the bokeh shape → contributes
    if sample is behind a sharper pixel → limit its r
    weight × (1 + 7 × brightness³)
result = weighted average
```

**Rack-focus timeline**
```
0s ─────── 3.5s ─────── 7s ─────── 10.5s
front sharp │ pull (≈1s) │ back sharp │ pull … 
FOV 36° ────┴─ breathes to ~37.8° ─┴── back
```

Stack mention: option 26 does not name an implementation (SVG, canvas, three.js, etc.) in the original Claude writeup.

E. Film and video FX

#26 Rack focus / DoF

Share: /e/grokbot-animation/26/