Skip to main content
Glama

Create optical flow

create_optical_flow

Compute motion-energy from video via frame differencing, outputting bright pixels for moving areas. Use as a lightweight drop-in for displacement or particle chains.

Instructions

Build a CPU motion-energy field from a video source (cheap drop-in for displacement / particle chains; NOT a real dense optical-flow solver). Output is a single-channel TOP: bright = motion, mid-grey = still, computed as gain × (current − previous luminance) + 0.5. In direction_from='edges' mode the result is multiplied by a Sobel edge map for a coarse where-is-motion-relative-to-edges estimate — still not a true dx/dy gradient flow. No CUDA, no external models — built entirely from stock TD TOPs: blurTOP (pre-blur), monochromeTOP, cacheTOP (previous-frame delay), compositeTOP subtract (frame diff), optional edgeTOP cross-multiply, mathTOP (sensitivity gain + 0.5 recenter), feedbackTOP+levelTOP (temporal smoothing). Defaults to TD's bundled Mosaic.mp4 test clip so the chain builds and previews standalone without a live camera (avoids macOS permission modal). Output is a nullTOP. Reads 0 when TD timeline is paused and the source is static — that is correct behavior. Returns a summary plus JSON with node paths, controls, warnings, and an inline preview image.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
blurNoSpatial pre-blur (pixels) on source before differencing — suppresses high-frequency camera noise. Maps to blurTOP size.
nameNoName of the container COMP created under parent_path.optical_flow
sourceNoAbsolute path of a TOP to analyze for motion (pulled in via selectTOP so it can live anywhere). Omit to use TD's bundled Mosaic.mp4 test clip so the chain previews standalone without a live camera (avoids macOS permission hang).
smoothingNoTemporal smoothing on the flow output (feedbackTOP cross-fade). 0 = raw per-frame flow (jittery); 1 = ghosted/laggy.
resolutionNoOutput resolution [width, height] in pixels. Default is half-HD — CPU optical flow is bandwidth-bound; larger resolutions are slower.
parent_pathNoParent COMP path the optical flow container is created inside./project1
sensitivityNoMultiplier on the raw frame difference (before the 0.5 recenter). Higher values pick up subtler motion (and more noise). Maps to mathTOP gain.
direction_fromNo'diff' (default, cheapest): scalar frame-difference luminance (temporal motion energy). 'edges': cross frame-diff with Sobel edgeTOP for a coarse where-is-motion-relative-to-edges estimate — more flow-like but still a scalar, not a dx/dy vector, and ~2× cost.diff
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond annotations (readOnly=false, openWorld=true, destructive=false), the description discloses detailed behavior: output is a single-channel TOP with bright=motion, mid-grey=still, the exact formula `gain × (current − previous luminance) + 0.5`, and the Sobel edge interaction in 'edges' mode. It also clarifies edge-case behavior (reads 0 when paused/static) and the return payload (summary + JSON with node paths, controls, warnings, inline preview).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is dense but not bloated; every sentence provides useful information, from the algorithm and implementation details to behavior under specific conditions. It is front-loaded with the core purpose, then expands into output format, internals, and fallback behavior. Slightly long but justified by the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 8 parameters and no output schema, the description fills important gaps: it explains the output format (single-channel TOP, nullTOP), the return value (summary plus JSON with nodes/controls/warnings/preview), performance characteristics (CPU, no CUDA), and the default test clip to avoid permission prompts. It also addresses a potential gotcha (reads 0 when paused) which users would otherwise misinterpret.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents each parameter thoroughly. The description adds algorithmic context (e.g., frame differencing, gain, blur purpose) but doesn't materially extend parameter-level semantics beyond what the schema descriptions already provide. The description mostly reinforces schema details such as the default test clip and direction_from modes.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific action: 'Build a CPU motion-energy field from a video source', and further differentiates it as a 'cheap drop-in for displacement / particle chains' and explicitly NOT a real dense optical-flow solver. This clearly distinguishes it from sibling tools like create_displacement_warp or create_motion_reactive.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context on when to use this tool: as a lightweight, CPU-only alternative to real optical flow, and notes the trade-offs of the 'edges' mode. It also explains the default Mosaic.mp4 clip avoids permission prompts, which guides usage in headless or non-interactive contexts. It doesn't name a specific sibling alternative but gives clear when/when-not guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lucasmaher-hash/touch-designer-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server