Skip to content
Ciwb

Share

Cutscenes for games

A film you make in the film timeline can play inside your game as a cutscene. Export Cutscene bakes the whole film, every character, prop and camera, into one .glb, and writes what your engine needs around it: a ready scene for Godot, or a script that builds the cutscene for you in Unity or Unreal.

Open it with File > Export > Export Cutscene…, the Cutscene button in the film timeline, or Ctrl+K and "cutscene".

The export window

SettingWhat it does
EngineGodot, Unity or Unreal. The .glb and the JSON are the same for all three; the engine decides the extra file.
Frame rateHow many poses per second are baked: 24, 30 or 60. Use your game's frame rate, or 30 if you are not sure. Cuts always land on whole frames.
RangeWhole film, or In – out to export only the part between the film's in and out points. Time 0 in the engine is the start of the range.
SoundMixes every sound track in the range into one WAV. Only shown when the film has sound.

The bar under the engine cards is your cut list: one block per shot, as long as the shot. The list at the bottom shows exactly which files will be written. Pick a folder and they are all saved into it, side by side.

What you get

FileWhat it is
Name.glbThe whole scene, with one animation named after the cutscene that moves everything, and a glTF camera for every camera used by a shot
Name.cutscene.jsonThe shots, cameras, markers and sound, for your own code and for the engine scripts
Name.wavThe film's sound, mixed
Name.tscnGodot only: a scene that plays it all. See Cutscenes in Godot.
Editor/CiwbCutsceneBuilder.csUnity only: builds a Timeline. See Cutscenes in Unity.
build_cutscene.pyUnreal only: builds a Level Sequence. See Cutscenes in Unreal.

The cutscene is named after your project. Names are made safe for every engine: Don't Touch the Gold becomes Dont_Touch_the_Gold, and a camera called Camera S01 Something breathes becomes the node Camera_S01_Something_breathes.

How the baking works

Each frame of the range is posed exactly as the film plays it: strips with their trims, loops and speeds, crossfades where strips overlap, IK and constraints. Every part that moves gets a position, rotation and scale key on every frame, relative to the part it hangs from. Parts that never move get no keys at all, so a big set stays small. Hidden parts shrink to nothing while hidden, as they do in a normal game export.

Cameras are baked the same way, in world space. A glTF camera cannot animate its zoom, so each camera's field of view per frame goes in the JSON, and the Godot scene and the Unity and Unreal scripts animate it from there. The first frame's lens is also stored on the camera itself, in its extras.

Shot cuts follow the film exactly: where two shots overlap, the later-starting one is on screen, just as when you play the film. Gaps with no shot are left out of the cut list.

Things to know:

  • Springs are not part of films. Use Bake into keys on a clip if you want its follow-through in the cutscene.
  • Sizes use Voxels / m from Export for Game (16 unless you changed it), so the cutscene matches your other exports.
  • Lights stay in Ciwb. Light the cutscene in your engine, where the rest of your game is lit.

The cutscene JSON

Name.cutscene.json is plain JSON, written for people and for code. All lists of numbers are flat (x, y, z, x, y, z, …) and every per-frame list has one entry per frame, so frame i is at i / fps seconds.

{
  "format": "ciwb-cutscene", "version": 1,
  "name": "Dont Touch the Gold", "engine": "godot",
  "glb": "Dont_Touch_the_Gold.glb", "animation": "Dont_Touch_the_Gold",
  "fps": 30, "frames": 1051, "duration": 35, "filmRange": [0, 35],
  "units": "meters", "up": "+Y", "cameraForward": "-Z",
  "shots": [
    { "name": "S01 Something breathes", "camera": "Camera_S01_Something_breathes",
      "start": 0, "end": 2.5, "startFrame": 0, "endFrame": 75, "fov": 30, "focalLength": 44.785 }
  ],
  "cameras": [
    { "node": "Camera_S01_Something_breathes", "name": "Camera S01 Something breathes",
      "fov": 30, "focalLength": 44.785, "sensorHeight": 24, "near": 0.05, "far": 1000, "animatedFov": false,
      "position": [], "rotation": [], "forward": [], "up": [], "fovs": [], "focus": [] }
  ],
  "markers": [ { "t": 0, "name": "S01 Something breathes", "kind": "cut" },
               { "t": 3.2, "name": "footstep", "kind": "event" } ],
  "audio": { "file": "Dont_Touch_the_Gold.wav", "start": 0, "duration": 35 }
}
FieldMeaning
animationThe name of the one animation in the .glb
fps, frames, durationBaked frame rate, number of frames (including the last pose) and length in seconds
filmRangeWhere the export came from in the film, in seconds
shotsThe cut list in order. start and end are seconds from the start of the cutscene; startFrame and endFrame are the same in frames (the end is exclusive). camera is the camera's node name in the .glb. fov is the vertical field of view in degrees at the cut, and focalLength the same in millimetres on a 24 mm high sensor.
cameras[].positionWorld position per frame, in metres
cameras[].rotationWorld rotation per frame as quaternions (x, y, z, w)
cameras[].forward, upThe direction the camera looks and its up direction per frame, handy for engines with other axes
cameras[].fovs, focusVertical field of view (degrees) and focus distance (metres) per frame. animatedFov is true when the zoom changes.
markersEvery cut ("kind": "cut") and every clip marker such as a footstep ("kind": "event"), at the time it lands in the film. Use them to fire game events.
audioThe WAV next to the JSON and when it starts, or null

The same shots and markers are also in the .glb scene's extras under cutscene, for code that only has the model.