---
name: 3d-product-film
description: Makes a vertical 4K product film in Blender 5.3, run headless with Python. One product (a maker's CAD, a GLB, or simple shapes) in a dark studio, a camera that cuts on the bass hits of a song, parts that open on springs and fall shut on the beat. The whole film is one shot.json. The user watches it playing in Blender and sees 4K Cycles stills before anything is rendered, and it renders once, after their yes. Use when the user asks for a 3D product film, a product video in Blender, a hero shot, a turntable, an exploded view, a product taken apart, a product cut to a song, or names this skill.
---

# 3D product film

You make one short vertical film of one product in Blender, and you are its director, its builder and its checker. This file is the method, the file format and the numbers. The scripts are yours to write: you write them once, beside this file, and test them. After that every film is one `shot.json`.

What comes out: `scene.blend` (anyone can open and change it), 4K stills of the frames that matter, and one master, 2160 x 3840, 30 fps, H.264. It has no sound until the song goes on at the end.

## How you work with the user

Three stops. Never skip one, and never render a draft video to show something.

1. **The shots.** Show the `shot.json` as a short table (second, shot, what the camera does) before you build.
2. **The film playing.** Give them the one-line command that opens Blender and plays it, with 4K stills of every shot beside it. Say what the window is: the real camera, timing, framing and materials, with softer reflections and no motion blur. The stills are the true look.
3. **The render.** Once, after a clear yes. Tell them the time first: seconds per still times the number of frames.

Also:

- **Ask before you download anything.** Name it, where it comes from and its size.
- **One heavy job at a time.** Two 4K renders at once can take a computer down.
- **Never put a real logo on an invented product**, and never invent a mark for a real one.
- **Look at every still yourself** before you show it, and measure it (check 5). Black, cropped, floating or blown out: fix it first.
- Take notes with their second ("at 4.0 it is too slow") and change `shot.json`, never the scene by hand.

## Set up, once

| Need | Check | If it is missing |
|---|---|---|
| Blender 5.3 | `blender --version`, or ask where it is | The portable zip or archive for their system from download.blender.org, checked against the sha256 list in the same folder, unzipped to their programs folder. No installer, no admin rights, nothing on PATH |
| A graphics card | run the GPU pick below | Stop and say so. A 4K Cycles film on the CPU is not worth starting |
| Python 3.10+ with numpy | `python -c "import numpy"` | `python -m pip install numpy` |
| ffmpeg and ffprobe | `ffmpeg -version` | Give the install line for their system |

Then:

1. Write `config.json` beside this file with the full path of their Blender program.
2. Write the scripts in `scripts/` (next section). If your write tool is blocked inside the skills folder, ask once, or write them in the project and copy them in with the shell.
3. Run the checks under "Prove it works".
4. Say in three lines what works, then ask for: the product, a file of it if they have one (CAD, GLB, photos), a song if they want cuts on the beat, and how long.

## The scripts you write

Plain Python, no packages inside Blender but its own.

| File | What it does |
|---|---|
| `scripts/bf.py` | the one command, run with the computer's Python |
| `scripts/in_blender.py` | runs inside Blender: `shot.json` to `scene.blend` (the camera and `motion` baked), stills, frames, the live window |
| `scripts/camera.py` | the camera keys baked frame by frame, and the cuts. No `bpy` in it, so it can be tested alone |
| `scripts/motion.py` | springs, falls, the second to let go. No `bpy` in it |
| `scripts/beats.py` | the bass hits of a song |
| `example.json` | the working example below, beside this file |

| Command | Contract |
|---|---|
| `bf.py new <project>` | a new folder with the example as `shot.json`. Refuses to overwrite |
| `bf.py build <project>` | `shot.json` to `scene.blend`. Renders nothing. Prints the frame count, the cut frames, the GPU it found |
| `bf.py stills <project> 1,60,135` | 4K Cycles stills of those frames into `stills/`. `--quick` is 25% size and 64 samples into `_look/` |
| `bf.py open <project>` | opens Blender on the camera, EEVEE, rendered view, playing on a loop. `--selftest` opens, reports, closes |
| `bf.py render <project> --yes` | every frame once as 16-bit PNG, resumable, then the master. Without `--yes` it refuses |
| `bf.py check <project>` | reads the baked camera and parts back out of `scene.blend`, for check 2 |
| `bf.py beats <song> <from> <to>` | the bass hits in that part, to the millisecond |

- Run Blender with `-b --factory-startup --python-exit-code 1`, or a failed script looks green.
- Preferences are not saved in a `.blend`, so every headless run picks the GPU again: try OPTIX, CUDA, HIP, ONEAPI, METAL in that order, set `compute_device_type`, call `get_devices()`, and enable only the devices whose `type` is that backend (the list holds every backend's).
- `open` must not block: start Blender as its own process and return.
- After the render, count the frames, encode, and check the master with ffprobe (size, frame count). Delete the PNG frames only when the count is right, and say what was deleted.
- The encode: `ffmpeg -framerate 30 -i %04d.png -vf scale=out_color_matrix=bt709:out_range=tv -c:v libx264 -preset slow -crf 10 -profile:v high -pix_fmt yuv420p -colorspace bt709 -color_primaries bt709 -color_trc bt709 -color_range tv -movflags +faststart master.mp4`
- The song goes on last, without touching the picture: `ffmpeg -i master.mp4 -ss <song start> -t <seconds> -i song.m4a -map 0:v -map 1:a -c:v copy -c:a aac -b:a 256k film.mp4`

## shot.json

Everything about a film is here. Paths are relative to the project. Metres, degrees, seconds.

```json
{
  "name": "example",
  "format": { "width": 2160, "height": 3840, "fps": 30, "seconds": 6.0 },
  "product": {
    "kind": "shapes", "height": 0.24,
    "parts": [
      { "name": "body", "shape": "cylinder", "r": 0.042, "h": 0.17, "z": 0.085, "material": "body" },
      { "name": "ring", "shape": "torus", "r": 0.042, "minor": 0.002, "z": 0.172, "material": "glow" },
      { "name": "neck", "shape": "cylinder", "r": 0.028, "h": 0.02, "z": 0.184, "material": "metal" },
      { "name": "cap", "shape": "cylinder", "r": 0.032, "h": 0.046, "z": 0.217, "material": "metal" },
      { "name": "badge", "shape": "box", "size": [0.018, 0.002, 0.03], "at": [0, -0.0425, 0.1], "material": "metal" }
    ]
  },
  "materials": {
    "body": { "color": "#111214", "roughness": 0.34, "bevel": 0.002 },
    "metal": { "color": "#E9E7E2", "metallic": 1, "roughness": 0.22, "bevel": 0.0012 },
    "glow": { "color": "#E8623C", "emission": 2.5 }
  },
  "look": {
    "background": "#050506", "floor": "#141416", "floor_fade": [0.4, 1.8], "floor_roughness": 0.28,
    "view": "AgX", "look": "AgX - Punchy", "exposure": 0, "world": 0.35,
    "lights": { "key": 22, "strip": 16, "rim_cool": 40, "rim_warm": 30, "top": 6 },
    "bloom": { "threshold": 1.4, "strength": 0.16 }, "dispersion": 0.006, "vignette": 0.22
  },
  "song": null,
  "camera": {
    "shots": [
      { "name": "hook", "from": 0.0, "keys": [
        { "t": -0.2, "az": -38, "el": 4, "dist": 0.34, "lens": 70, "tz": 0.2, "fstop": 8 },
        { "t": 2.2, "az": -14, "el": 9, "dist": 0.3 } ] },
      { "name": "whole", "from": 2.0, "keys": [
        { "t": 1.8, "az": 64, "el": 16, "dist": 0.72, "lens": 50, "tz": 0.12, "fstop": 8 },
        { "t": 2.18, "az": 40, "el": 14, "dist": 0.8 },
        { "t": 4.32, "az": 30, "el": 12, "dist": 0.84 },
        { "t": 4.7, "az": 6, "el": 10, "dist": 0.94 } ] },
      { "name": "end", "from": 4.5, "keys": [
        { "t": 4.3, "az": -32, "el": 3, "dist": 1.0, "lens": 65, "tz": 0.12, "fstop": 8 },
        { "t": 4.75, "az": -18, "el": 6, "dist": 0.96 },
        { "t": 6.0, "az": -12, "el": 7, "dist": 0.94 } ] }
    ]
  },
  "motion": [
    { "parts": ["cap"], "move": "open", "at": 2.0, "by": [0, 0, 0.06] },
    { "parts": ["cap"], "move": "close", "hit": 4.5 }
  ],
  "render": { "samples": 512, "adaptive_threshold": 0.01, "motion_blur": true, "shutter": 0.5, "clamp_indirect": 8 }
}
```

- **product** `kind`: `shapes` (cylinder, cone, torus, box, sphere; as above), `glb` (`"path"`, `"height"`, `"rotate_z"`; stood on the floor, centred, its front to -Y), or `script` (`"path": "product.py"`, a builder of the project's own for anything that comes apart).
- **frames** The first frame is 1. Frame f shows the second (f - 1) / fps, so a shot `from` 2.0 starts on frame 61.
- **camera** One camera on a sphere round a look point. `az` is degrees round the product (0 is its front, + moves to your right as you face it), `el` degrees above the look point, `dist` metres, `lens` mm, `tz` the look height, `fstop` the aperture; `tx` and `ty` move the look point sideways. A key that leaves a channel out keeps the value before it, and a shot's first key carries on from the shot before. Before any key: az 0, el 10, dist 0.6, lens 50, tz half the product's height, fstop 2.8, tx and ty 0.
- **shots** Each is shown from its `from` (snapped to a frame) to the next one's. One shot and no cuts is fine.
- **motion** What the product's own parts do, in order. `"parts"` names parts or a layer; `"stagger"` is the seconds between one part and the next. `{ "parts": ["cap"], "move": "open", "at": 2.0, "by": [0, 0, 0.08] }` lets go at 2.0 on the spring, 80 mm up. `{ "parts": ["cap"], "move": "close", "hit": 4.5 }` falls back to its rest from wherever it hangs at that moment, and lands at 4.5. A script product may add moves of its own.

## The scene

- **The floor is seamless.** A matte floor that takes soft shadows near the product and mixes into an emission of the background colour with distance (`floor_fade` in metres for a 24 cm product, smoothstep), so no horizon line shows.
- **The background is what the camera sees**, kept apart from the light that lights the scene: in the world shader, mix two backgrounds on the Light Path's Is Camera Ray. The one that lights is a cool grey (#C3CBDA) at strength `world`; the one the camera sees is `background` at strength 1.
- **Five area lights**, aimed at the look point and fixed in the world, so the reflections move as the camera does. The numbers in `look.lights` are each light's `energy` in watts, as they are, for a dark 24 cm product (a white one needs about half). With `s` the product's largest side over 0.24, distances and sizes are times `s` and watts times `s * s`:

| Light | Size (m) | az, el | Distance | Colour |
|---|---|---|---|---|
| key | 0.45 x 0.30 | -55, 42 | 0.85 | a warm white |
| strip | 0.06 wide, 0.9 tall | 38, 12 | 0.55 | white |
| rim_cool | 0.10 wide, 0.6 tall | 140, 22 | 0.6 | a cool white, #DDE6FF |
| rim_warm | 0.10 wide, 0.6 tall | -140, 18 | 0.6 | a warm white, #FFE9D6 |
| top | a disk of 0.5 | straight above | 0.9 | a cool white |

- **Link the lights to the product only** (`light_linking.receiver_collection`), and set `visible_camera = False`, or they show as white cards in the floor. The floor then stays near black and takes only the world's soft shadow. For a bright studio, leave the linking off.
- **The set carries no colour.** Colour comes from light: one accent, in a rim or a glow.
- **Materials make it read as real.** Bevel normals so every edge catches a thin line of light, a little noise in the roughness (a few hundredths, never one flat value), brushed anisotropy on metal (about 0.3). A black product needs its edges lit to be seen at all.
- **A glow under AgX turns white.** Use a tinted base colour (60% of the glow colour) with an emission near 2.5. If a glow is animated, give that part its own material, or every part that shares it lights up.
- **Focus on the front surface.** Focus distance is the camera distance minus the product's radius (half its widest horizontal size), keyed every frame. At 70 mm and f/2.2 the sharp zone is about a centimetre.
- **Frame it for a tall picture.** The sensor is 36 mm on the long side (`sensor_fit` AUTO, so the height), and the width you see is `2 * dist * 10.125 / lens`. The height you see is `2 * dist * 18 / lens`. Print both against the product (a raised part included) at every key. A close-up crops on purpose (the example's hook does); a shot of the whole product must fit.
- **A round product hides a whip**, because it looks the same from every side. Give the set thin bars of light to streak past and the product one feature that shows its front.
- **The lens.** A trace of dispersion (0.006) and vignette (0.2) make it a lens. More looks like a filter. The vignette is the Image Coordinates node's Normalized output (it runs from -1 to 1), its length, a smoothstep from 0.7 to 1.42, multiplied over the picture. Dispersion is the Lens Distortion node's.
- **Cycles:** 512 to 768 samples, adaptive 0.01, OpenImageDenoise with albedo and normal, high quality, on the GPU; motion blur on, shutter 0.5, centred; clamp indirect 8; persistent data on.

Blender 5.3 moved a few things:

- The compositor is a node group with a Group Output: `scene.compositing_node_group = tree`. Glare's Type, Threshold and Strength are input sockets. Its maths nodes are the shader ones: `ShaderNodeVectorMath`, `ShaderNodeMapRange`, `ShaderNodeMix` (for colour, inputs 6 and 7, output 2).
- F-curves live in the action's channelbag: `bpy_extras.anim_utils.action_get_channelbag_for_slot(action, slot)`.
- The engine id is `BLENDER_EEVEE`. Set `image_settings.media_type = "IMAGE"` before `file_format`.
- `matrix_world` is stale until the view layer updates: call `bpy.context.view_layer.update()` before you read it.
- Materials and worlds already have node trees; setting `use_nodes` only prints a warning.
- In the live window, looping and real time are `scene.sync_mode = "FRAME_DROP"` and `screen.animation_play()`.

## The camera

- **The position** is `(tx + sin(az) * cos(el) * dist, ty - cos(az) * cos(el) * dist, tz + sin(el) * dist)`, looking at `(tx, ty, tz)`.
- **Bake every frame**, positions and lens, with monotone cubic interpolation (the PCHIP slopes) on each channel, then set the keys to linear. It never overshoots and never stops dead at a key. Slopes are zero at a list's first and last key, so a camera that should already be moving starts its keys before the shot and ends them after it.
- **Speed is the angle between two keys over the time between them.** 15 degrees in 1.5 s lingers. 280 degrees in 0.7 s is a whip.
- **Cut on motion.** Start each shot's keys about 0.2 s before its `from` and end them about 0.2 s after the next cut, so the first and last frame of every shot are moving. Keep the direction the same across a cut.
- **Fast through the cut, slow in the middle.** Four keys per shot: just before the cut, 0.18 s after it, 0.18 s before the next cut, just after that. Big first and last steps, a small middle step. The last shot eases to rest and holds.
- **No blur across a cut.** A frame's shutter is 0.5 frames wide and centred. For a cut whose first frame is F, also key the shot before at F - 0.75 and the shot after at F - 0.25, so each frame's blur stays in its own shot.
- **Anything that switches on with a cut** (a light, a glow) is low on the frame before and full on the cut frame. Never ramp across it.

Moves that work: a crane reveal (el -1 to 7 over 1.4 s, lens 32 to 40), a drift (20 degrees in 1.5 s, closing a few centimetres), a push-in (dist and lens together, fstop down to 2.8), a whip (a slow key first, then 280 degrees in 0.7 s, then a slow one), a turntable (a key every 90 degrees so the speed holds). The first frame is a composed picture.

## Cuts on the bass

Cut on the bass, never on the drums. Every bass hit is a cut, and a double counts once.

1. **Decode** the part of the song to mono, starting 0.3 s early, so a hit at its very start has a quiet before it. Keep 30 to 90 Hz only, with a filter that adds no delay (zero the other bins of an FFT and transform back).
2. **Envelope:** RMS in 10 ms windows, every 5 ms. An onset is a rise over the lowest point of the 60 ms before it, at least 0.3 of the biggest rise. The next one can start 100 ms later at the earliest.
3. **Doubles:** a hit within 0.5 s of the hit before it, kept or not, belongs to the same run. Keep the first of the run. A double can still carry something inside a shot, such as a part landing. Before merging, look at the gaps between all the onsets: if most are under 0.7 s the song has a steady pulse, and merging would swallow it. Show the user the list and ask which hits to cut on.
4. **The attack:** for each kept hit, a 2 ms envelope, and the time it crosses half way from the quiet before it to its peak. Peaks land 15 to 135 ms late.
5. **The drop** is the first hit at or after the second the user named. The song's start is the drop minus the second of the cut out of the hook (the first shot, about 2 s), so the two land together.
6. **One shot per hit**, each cut on the nearest frame. End the film on a hit too, with the last shot held a second or more: if the length they asked for leaves less, move the end to the next hit and say so. A shot under 0.6 s gets two keys.
7. Put the list in `shot.json` as `"song": { "path", "start", "hits": [...] }`, and print each hit against its cut frame. The gap is never more than half a frame (17 ms).

## Motion that is physical

Eased moves look like rails. Bake these per frame:

- **Opening, a spring.** `y(t) = 1 - e^(-z*w*t) * (cos(d*t) + z / sqrt(1 - z*z) * sin(d*t))` with `d = w * sqrt(1 - z*z)`, damping `z` 0.6 and `w` 15 rad/s: about 9% past the top at 0.26 s, settled by 0.6 s.
- **Closing, gravity.** Let go from height h: it lands after `sqrt(2h / g)` with g 9.81, then bounces and keeps 0.2 of its speed each time. From 285 mm that is 0.24 s.
- **On the beat:** let a part go at `hit - sqrt(2h / g)`, so the impact is on the hit. Parts let go that way land together and never pass through each other. A hit that is also a cut counts as the cut frame's second.
- **A wave** spreads from one corner like a ring on water. Vary each piece's height and tilt a little from a CRC of its name, never from `hash()`, which changes every run.
- **Tilt only in the air**, and only with the part's origin at its own middle. An imported GLB part is in quaternion mode: Euler keys do nothing to it.

## Taking a product apart

- Sort every part into the layers it is built from, by the part's name. Show the user the list. One odd name is how a keycap ends up in the circuit board.
- Parent each layer to an empty and move the empty. Top layer first when it opens, last when it closes. The base stays.
- Show only parts that exist: from CAD, a teardown or the maker's own page.

## From the maker's CAD

Some makers publish real CAD (STEP). It is exact by construction, down to the springs.

1. **Read its licence to the user first**, before any download, and say what it allows. Many bar commercial use.
2. **STEP to GLB.** Blender cannot read STEP. In a project `.venv`: `pip install cascadio trimesh numpy`, then `cascadio.step_to_glb(src, dst, tol_linear=0.02, tol_angular=0.25, merge_primitives=True, include_materials=True)`. Every part stays its own mesh.
3. **Count triangles per part family** and drop what no camera sees. In a keyboard, 81 hidden springs were 8.3 of 13.5 million triangles; dropping 80 of them left 5.3 million.
4. **It may come in on its edge** (CAD is often Z-up) **or in millimetres.** Lay it flat, scale it to its real size, centre it, feet on z = 0, and bake that into the parts.
5. **CAD has shapes, not colours or lettering.** Take those from the maker's product photos, with the user's yes.

## Prove it works

Run these once after writing the scripts, and the first two after every change to them. Report each with its output.

1. **Build.** `new`, then `build` on the example: exit code 0, `scene.blend` exists, 180 frames, the cuts' first frames are 61 and 136.
2. **The camera and the cap.** Read the baked camera back out of `scene.blend`, frame by frame. The two biggest jumps in position are exactly between frames 60 and 61, and between 135 and 136. At 60.25 the camera is still in the first shot. At 60.75 it is already in the second. The cap is highest at frame 69, about 65.7 mm up (9% past 60), is still 30 mm up on frame 135, and has landed on frame 136, the cut.
3. **The gate.** `render` without `--yes` refuses and touches nothing.
4. **The window.** `open --selftest`: camera view, EEVEE, playing. It shows a window for a few seconds, so say so first.
5. **The look.** One quick still of frame 90, the whole product. Look at it, then measure it: the top corners are under 5 of 255, the bottom ones under 25, and under 1% of the picture is 250 or brighter in luma (the example comes out near 0.4%). In a close-up under 3% is fine. Blown out means the light powers are wrong, not the exposure. Fix it and measure again before you show anything.

## When something is wrong

| What you see | Do this |
|---|---|
| It will not render | Print which backends list a device. A render with no GPU stays refused |
| A still takes minutes instead of seconds | Something else is using the graphics card. Ask the user to close it (a video editor, a local AI model), and try one still again before any render |
| Blender is slow with the CAD | Find the parts no camera sees (step 3 above) |
| The model lies on its edge | Lay it flat and bake the placement into the parts |
| A part will not tilt | It is in quaternion mode. Key the quaternion, or switch the part to Euler first |
| The whip shows nothing | Fixed bars of light in the set, one feature on the product's front |
| The product is grey on black | Edge light: raise the strip and the rims, not the exposure |
| A cut smears | The shutter is not centred, or the keys at F - 0.75 and F - 0.25 are missing |

## Where this comes from

Written by Luka (instagram.com/omgluka) from the film he made of the Keychron Q1 Pro this way. The guide for people, with pictures: https://engram.media/guides/3d-product-film. Blender is by the Blender Foundation, cascadio by the trimesh project (MIT). The camera moves started from ideas in kevinbadi/blender-skills; some rules come from EL4CTEO/blender-skills and MartinRapcan/blender-claude-skill (both MIT).
