On this page

Juicing Your Cameras With Math

What the talk teaches

  1. Trauma, not shake. Keep a trauma value from 0 to 1. Each hit adds to it (about 0.5 for a hard hit, 0.1 to 0.2 for a small one) and it drains at a fixed rate per second. The shake is trauma squared or cubed, not trauma itself. Light, moderate and heavy hits then look clearly different, a run of small hits builds up, and a linear mapping by contrast shakes for a long time and then stops dead.
  2. 2D and 3D want different shakes. In 2D, translation plus a little rotation feels best. In 3D, translation looks wrong: distant scenery barely moves while near geometry jumps, and the camera can end up inside a wall. Use rotation only (yaw, pitch and roll as Euler angles, each with its own limit). Avoid shake in VR altogether.
  3. Never move the camera itself. Build the shaken view every frame from the clean base camera plus an offset of max angle (or distance) x shake x a value from -1 to 1.
  4. Noise instead of random values. A new random value every frame has, in his words, "effectively an infinite frequency regardless of how slow the time is". Smooth noise (Perlin) sampled at game time slows down with slow motion, does not depend on the frame rate, can be replayed, and has a frequency to tune: slowed down, it becomes a handheld-camera sway. Give each channel its own seed, or x and y (and yaw and pitch) move together.
  5. Asymptotic averaging for a lazy follow camera: each frame x += (target - x) * k, with k = 1% (slow), 10% or 50% (fast). Rates can differ per axis and direction: follow vertically only after landing, catch up faster when falling. "One last fix, this doesn't time scale well": a fixed k per frame depends on the frame rate. His fix scales k by the frame time, which he calls a linear approximation with a small error.
  6. Points of interest and focus (not taken, below), and Voronoi split screen for co-op (not taken, below).

What the kit took

Measured

Not taken, and why