Skip to content

Cameras and shots ​

A cinematic's camera goes where its shots say: a pose, a named view of the map, a rail along a path, a follow on a unit. Between shots it cuts, eases or plays a transition. It also dresses the frame (letterbox, fade, vignette) and finishes the picture (grade, depth of field).

Quick start ​

ts
await cut.shot({ at: { entity: boss }, distance: 15, pitch: 0.7, fov: 50 }, { seconds: 1, ease: 'inOutCubic' })
await cut.screen.letterbox(2.39, 0.4)
await cut.rail('road', { seconds: 6, distance: 15, pitch: 0.7, smooth: true }) // along a path of the map
cut.follow('hero', { distance: 16, pitch: 0.7, lead: 0.6, lag: 0.3, deadzone: 2 })
await cut.shot('gate', { transition: 'dissolve' })

Push in on the boss, bars in, run the camera down the road, follow the hero, then dissolve to the gate.

Common tasks ​

Move the camera like a film camera ​

ts
await cut.shot(['gate', { at: { x: 60, z: 30 }, lookAt: { entity: boss } }], { seconds: 4 }) // through several, smoothly
await cut.dolly(-5, 1) // closer by 5
await cut.zoom({ fov: 20 }, 1) // a long lens flattens the picture
await cut.orbit({ entity: boss }, { radians: Math.PI, seconds: 3 })
await cut.pan({ x: 10, z: 0 }, 1)
await cut.tilt(0.1, 1)

Follow and frame units ​

ts
cut.follow(['hero', 'giant'], { fit: { padding: 6 } }) // both always in the picture
await cut.fit(['hero', 'giant'], { seconds: 1 }) // framed once, as a shot
await cut.focus('giant', { distance: 9, seconds: 0.8 }) // push in
cut.lookAt('giant') // turned to it whatever the shots do; lookAt(null) lets go
cut.handheld({ amount: 0.3, speed: 1 }) // hand-held; handheld(null) steadies it
cut.shake(0.8)

A follow is a spring: lag (0 at once, 1 slowly; 0.5), lead (seconds ahead), deadzone (a ring the unit moves in freely), keep: 'free' (swing round behind), fit (keep a group in frame). A shot ends a follow.

Cut with a transition ​

ts
await cut.shot({ at: { entity: boss }, distance: 12 }, { transition: { id: 'iris', at: { unit: 'boss' }, seconds: 0.8 } })
cut.transition('wipe', { angle: Math.PI, seconds: 0.5, soft: 0.05 }) // then cut the camera yourself
cut.shot('gate', { transition: { id: 'dissolve', source: 'live', seconds: 1.5, old: (s) => ({ ...pan, x: pan.x + s * 4 }) } })

source: 'live' keeps the old shot moving during a dissolve (a second render a frame).

Make keys out of a path ​

ts
const keys = cameraKeysFromPath(road, { at: 2, seconds: 6, distance: 15, pitch: 0.7 })
keys.at(-1)!.value = { ...keys.at(-1)!.value, distance: 8, fov: 50 } // closer at the end
const intro = { id: 'td.intro', lanes: [{ id: 'camera', kind: 'camera', items: [opening, ...keys] }] }

The editor's Make keys of it does the same on a rail key.

Dress the frame ​

ts
await cut.screen.letterbox(2.39, 0.4) // `true` for the look's share, `false` for none
await cut.screen.aspect(4 / 3) // the picture in 4:3, the HUD inside
await cut.screen.fade('#000', 1, 0.6) // `cut.fade(1)` is the same to the look's colour
await cut.screen.vignette(0.6, 0.5)
await cut.screen.tint('#2040a0', 0.4)
await cut.screen.overlay('textures/frame.png', { opacity: 0.8, blend: 'multiply' })
await cut.screen.crop({ x: 0.25, y: 0.25, w: 0.5, h: 0.5 })
await cut.screen.blur(8)
await cut.screen.flash('white', 0.3)
await cut.screen.reset()

Each eases from where it is, on the cut's clock. It all resets as the cinematic ends, except a fade (a game that ends on black keeps it).

Grade the picture ​

ts
await cut.picture.grade({ saturation: 0.6, tint: [0.6, 0.75, 1], tintAmount: 0.3 }, 2) // cold, over 2 s
cut.picture.focus('boss', { aperture: 1.4 }) // depth of field
cut.picture.grain(0.3)
cut.picture.bloom(0.8, 0.5, { threshold: 0.7 })
await cut.picture.reset(1) // back to the map's picture

None of it shows where the quality's picture is off.

Slow time, change the hour or weather ​

ts
await cut.speed.slow(0.25, 1.2) // slow motion
cut.speed.freeze() // until cut.speed.reset()
await cut.speed.run(1, 5) // the world goes on 5 s though the cinematic holds it
await cut.env.hour(22, 2) // this screen draws 22:00, eased
await cut.env.weather({ kind: 'rain', amount: 1 })
cut.hud.show(['minimap']) // parts of the HUD that stay
cut.units.hide('gate')
cut.units.tint('hero', [1, 0.4, 0.4])
const banner = await cut.prop('footman', { x: 30, z: 28 }, { facing: 1.2, clip: 'cheer' }) // a model for the cinematic alone
cut.fx('fire', { on: 'gate' })

All on this screen only, and put back as the cinematic ends.

Editor ​

  1. In the Cinematic panel, select a camera key.
  2. In the Inspector: set the shot by numbers, Set from view, or Look through to fly from it; or pick a map view or a rail (with Smooth and Turn within).
  3. Pick an ease from its curve, a path (straight, smooth, bezier), and a transition.
  4. With the cinematic selected, the camera's path is drawn on the map: drag a key's bead or a bezier handle to change it.
  5. Hover a camera key to see a picture of what it sees.

Reference ​

A camera key ​

FieldWhat
valuea pose (x, z, distance, yaw, pitch, fov (34 is the RTS view), roll, height, lookAt a point or { unit }), a view ({ "view": "gate" }), or a rail
easelinear, inQuad, outQuad, inOutQuad, inOutCubic, outBack… or yours
pathlinear, smooth (no corners), bezier with handles { in, out }
holdstays until the next key: a cut there
transition'dissolve', or { id, at, seconds, source, old }

A rail key: { "rail": "road", "from": 0, "to": 1, "distance": 15, "pitch": 0.7, "yaw": "along", "smooth": true }. It runs straight from point to point, or with smooth rounds its bends (smooth: 4: within 4 units of each point). In code: cut.rail(path, { seconds, ease, from, to, distance, pitch, yaw, fov, roll, height, smooth }) (4 s by default; a missing path is a warning).

The camera lane also takes clips: { at, for, follow, distance, pitch, yaw, fov, lead, lag, deadzone, offset, keep, fit }, { at, for, handheld: 0.3, speed }, { at, shake: 0.8 }.

While a cinematic holds the camera it goes anywhere, off the map too; as it lets go, lens, roll and height ease back (RtsCamera.easeTo). Pure samplers for lanes of your own: alongPath(poses, t, path), cameraPoseAt(items, t, view, { eases, path }), fitDistance(points, { padding, fov }), handheldAt(t, { seed, amount, speed }). Eases are a registry (kit.eases, cut.eases: EaseRegistry, 24 built in); add yours in GameView.cinematics.eases or kit.eases.add('bounce', (t) => ...).

Transitions ​

fade, flash, dissolve, wipe (any angle), iris (circle, diamond, star; reverse), push, slide (by direction), blur, zoom. 0.6 s by default. A transition plays as its key is reached, not on a seek. The last frame is copied once on the GPU and mixed with the new shot through a mask.

Your own: a TransitionDef in GameView.cinematics.transitions or client.transitions.add(def): a mask (GLSL body of float mask(vec2 uv, float t, vec2 at, float soft), 1 where the old shows; maskWGSL for WebGPU), or a whole pass (process, given textureSampler and oldSampler), with defaults.

ts
shotTransitions: [{ id: 'td.blinds', mask: 'return step(fract(uv.y * 10.0), 1.0 - t);', defaults: { seconds: 0.8 } }]

Screen clips (the screen lane) ​

{ at, for, in, out, ease, ... } with any of: letterbox (a ratio or true), pillarbox, aspect, fade (to fadeColor), vignette (vignetteSoft), tint (tintColor), overlay (a colour or picture, overlayOpacity, blend: normal, multiply, screen, add), crop ({ x, y, w, h }), stretch, blur, flash, barColor, barSoft. in and out are 0.4 s by default. A knob no clip names is left alone. It is drawn in the picture (LiteScreenPass, client.screenPass), so screenshots have the bars. Its look: GameView.cinematics.screen.look (barColor, barSoft, fadeColor, barShare), or a pass of yours (GameView.cinematics.screen.process). cut.tween(seconds, step, ease) eases anything else.

Picture keys (the picture lane) ​

{ at, value: { exposure, contrast, saturation, tint, tintAmount, bloom, sharpen, vignette, grain, aberration, focus: 'boss' | 12, aperture }, ease }, laid over the map's picture (WorldPicture.cinematic) and taken away after.

Time and environment lanes ​

Time clips: { at, for, rate } (run: true lets the world go on at that rate: World runs). Env keys: { at, value: { hour, weather, fog, mist, wind, over }, ease }, the hour sampled between keys. cut.time is the clock's seconds.