shader-gen
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseShader Generator
Shader 生成器
If or are not loaded yet, load them with before calling them, so you use their real parameters instead of guessing.
submit_shaderinspect_itemToolSearchSubmit-only: creates a backend generation job, returns . Use the tool for job lifecycle after submission.
jobIdtrack_progressAlways use for new shaders. Manual authoring is only for editing existing asset code — never as a fallback when generation fails.
generate.ts如果 或 尚未加载,请先使用 加载它们,再进行调用,以确保使用其真实参数,而不是靠猜测。
submit_shaderinspect_itemToolSearch仅用于提交:创建一个后端生成任务并返回 。提交后,使用 工具跟踪任务生命周期。
jobIdtrack_progress**新 Shader 始终使用 。**手动编写仅用于编辑已有资产代码——绝不能作为生成失败时的后备方案。
generate.tsCatalog-first rule — try existing assets before generation
目录优先原则——生成前先尝试已有资产
Before generating a shader, call unless the user names an exact asset id that is already visible in .
browse_librarybrowse_assetsbrowse_librarybrowse_assetsApply catalog entries with , do not call .
edit_itemsubmit_shaderGood catalog searches:
text
browse_library(query: "zoom")
browse_library(category: "transitions", query: "dissolve")
browse_library(category: "audio-fx")Generate only when no catalog entry matches the user's intent closely enough.
在生成 Shader 之前,除非用户给出了一个已经在 中可见的精确资产 ID,否则先调用 。
browse_assetsbrowse_librarybrowse_librarybrowse_assets使用 应用目录条目,不要调用 。
edit_itemsubmit_shader有效的目录搜索:
text
browse_library(query: "zoom")
browse_library(category: "transitions", query: "dissolve")
browse_library(category: "audio-fx")builtin:zoom
uses the same track-bound placement as every effect
builtin:zoombuiltin:zoom
与所有效果一样使用绑定轨道的放置方式
builtin:zoomEffects always have timeline geometry. For a whole-clip effect, pass ; ChatCut resolves it to a clip-anchored range covering that clip. For an explicit timeline range, pass + + .
targetItemIdtrackIdtrackBoundFromtrackBoundDurationInFramestext
undefined效果始终具有时间线几何结构。对于整段片段效果,传入 ;ChatCut 会将其解析为覆盖该片段的、以片段为锚点的范围。对于明确的时间线范围,传入 + + 。
targetItemIdtrackIdtrackBoundFromtrackBoundDurationInFramestext
undefinedZoom on the entire video clip
Zoom on the entire video clip
edit_item(json: '{"adds":[{"type":"effect","assetId":"builtin:zoom","targetItemId":"<clip-id>","propertyOverrides":{"magnification":1.5,"shape":"hold"}}]}')
edit_item(json: '{"adds":[{"type":"effect","assetId":"builtin:zoom","targetItemId":"<clip-id>","propertyOverrides":{"magnification":1.5,"shape":"hold"}}]}')
Zoom on a sub-range of the clip (e.g. frames 90–150 only, a punch zoom on a beat)
Zoom on a sub-range of the clip (e.g. frames 90–150 only, a punch zoom on a beat)
edit_item(json: '{"adds":[{"type":"effect","assetId":"builtin:zoom","mode":"track-bound","trackId":"<trackId>","trackBoundFrom":90,"trackBoundDurationInFrames":60,"propertyOverrides":{"magnification":2,"shape":"punch"}}]}')
Use `preview_timeline({views:["timeline"],tracks:["V1"]})` to obtain track item ids and timeline-frame ranges. Use `inspect_item({itemId:"..."})` when exact item detail is needed.
| Key | Type | Range / values | Default | Notes |
| --------------- | ------ | ------------------------------------------ | ------- | ---------------------------------------------- |
| `magnification` | number | 1–4 | `1.5` | Zoom factor; 1 = no zoom, 2 = 2× in |
| `focalPointX` | number | 0–1 | `0.5` | Horizontal focal point (0 = left, 1 = right) |
| `focalPointY` | number | 0–1 | `0.5` | Vertical focal point (0 = top, 1 = bottom) |
| `shape` | select | `punch` / `hold` / `slow-push` / `instant` | `hold` | Animation curve |
| `focalMode` | select | `auto` / `manual` | `auto` | `auto` picks subject; `manual` uses focalPoint |
| `easeInFrames` | number | 0–60 | `8` | Frames to ramp in |
| `easeOutFrames` | number | 0–60 | `8` | Frames to ramp out |
Omit `propertyOverrides` entirely for default zoom. Send only the keys you want to change — patch semantics.edit_item(json: '{"adds":[{"type":"effect","assetId":"builtin:zoom","mode":"track-bound","trackId":"<trackId>","trackBoundFrom":90,"trackBoundDurationInFrames":60,"propertyOverrides":{"magnification":2,"shape":"punch"}}]}')
使用 `preview_timeline({views:["timeline"],tracks:["V1"]})` 获取轨道项 ID 和时间线帧范围。需要精确的项详情时,使用 `inspect_item({itemId:"..."})`。
| 键 | 类型 | 范围 / 值 | 默认值 | 说明 |
| --------------- | ------ | ------------------------------------------ | ------- | ---------------------------------------------- |
| `magnification` | number | 1–4 | `1.5` | 缩放倍率;1 = 无缩放,2 = 放大 2× |
| `focalPointX` | number | 0–1 | `0.5` | 水平焦点(0 = 左侧,1 = 右侧) |
| `focalPointY` | number | 0–1 | `0.5` | 垂直焦点(0 = 顶部,1 = 底部) |
| `shape` | select | `punch` / `hold` / `slow-push` / `instant` | `hold` | 动画曲线 |
| `focalMode` | select | `auto` / `manual` | `auto` | `auto` 自动选择主体;`manual` 使用 focalPoint |
| `easeInFrames` | number | 0–60 | `8` | 渐入所需帧数 |
| `easeOutFrames` | number | 0–60 | `8` | 渐出所需帧数 |
若使用默认缩放效果,请完全省略 `propertyOverrides`。仅发送需要更改的键——采用补丁语义。Clip-anchored vs adjustment-track
片段锚定与调整轨道
Effect items have two placements, both with a concrete time range:
- Clip-anchored: pass for the whole clip, or include an explicit range that intersects the clip. The stored range is local to that clip and follows it when it moves.
targetItemId - Adjustment-track: pass +
trackId+trackBoundFromfor a range over empty track space. The range is absolute on the timeline.trackBoundDurationInFrames
Use for whole-clip effects. Use explicit track geometry only when the requested range differs from a clip's full duration.
targetItemId效果项有两种放置方式,二者都有明确的时间范围:
- 片段锚定(Clip-anchored):传入 应用于整段片段,或包含一个与该片段相交的明确范围。存储的范围是片段内的局部范围,并在片段移动时随之移动。
targetItemId - 调整轨道(Adjustment-track):针对空白轨道空间上的范围,传入 +
trackId+trackBoundFrom。该范围在时间线上是绝对位置。trackBoundDurationInFrames
对于整段片段效果,使用 。仅当所需范围与片段的完整时长不同时,才使用明确的时间线几何信息。
targetItemIdBuilt-in LUT properties
内置 LUT 属性
text
edit_item(json: '{"adds":[{"type":"effect","targetItemId":"<clip-id>","assetId":"builtin:slog3-s709","propertyOverrides":{"intensity":1}}]}')| Key | Type | Range | Default | Notes |
|---|---|---|---|---|
| number | 0–1 | | LUT strength; 1 = full applied |
To swap: delete the effect and re-add with a different . To remove: delete the effect item.
assetIdUser-uploaded LUT assets take this exact same shape — only differs. See "Applying an Existing LUT Asset" below.
.cubeassetIdtext
edit_item(json: '{"adds":[{"type":"effect","targetItemId":"<clip-id>","assetId":"builtin:slog3-s709","propertyOverrides":{"intensity":1}}]}')| 键 | 类型 | 范围 | 默认值 | 说明 |
|---|---|---|---|---|
| number | 0–1 | | LUT 强度;1 = 完全应用 |
要替换 LUT:删除该效果,并使用另一个 重新添加。要移除:删除该效果项。
assetId用户上传的 LUT 资产采用完全相同的结构——只有 不同。参见下文“应用已有 LUT 资产”。
.cubeassetIdSupported Targets
支持的目标
Effects and transitions apply to , , and items.
videoimagegif效果和转场可应用于 、 和 项。
videoimagegifType Routing
类型路由
Before generating anything, check two non-generation paths first:
- Catalog entry — use for built-in and project effects/transitions.
browse_library - User-uploaded LUT asset that already exists in the project library — bind it instead of generating, see "Applying an Existing LUT Asset" below. It shows up in
.cubeasbrowse_assetswith atype: effect-typed entry inlut.editableProperties
| User wants | |
|---|---|
| Video appearance (color, blur, glow, grain, distortion) | |
| Color grade / look (teal-orange, cinematic, vintage, LUT-style) | |
| Visibility control (mask, reveal, wipe, shape cutout, gradient fade) | |
| Blend between clips (crossfade, dissolve, slide, 3D cube/page flip) | |
"LUT-style" in the table means generating a fresh GLSL color grade that resembles a LUT — only when the user wants something new. If they want to apply a file already in the library, don't generate; bind the existing asset instead.
.cubeNo separate LUT or mask generator for the generation path — those are all .
effect在生成任何内容前,先检查以下两条非生成路径:
- 目录条目——使用 查找内置效果和项目效果/转场。
browse_library - 项目中已存在的用户上传 LUT 资产——直接绑定它,而不是生成;参见下文“应用已有 LUT 资产”。它会在
.cube中显示为browse_assets,并且type: effect中包含一个editableProperties类型的条目。lut
| 用户需求 | |
|---|---|
| 视频外观(颜色、模糊、辉光、颗粒、扭曲) | |
| 调色 / 风格(青橙、电影感、复古、LUT 风格) | |
| 可见性控制(mask、reveal、wipe、shape cutout、gradient fade) | |
| 片段间混合(crossfade、dissolve、slide、3D cube/page flip) | |
表格中的“LUT-style”是指生成一种类似 LUT 的全新 GLSL 调色——仅当用户想要新效果时才这样做。如果用户想应用库中已有的 文件,不要生成;直接绑定已有资产。
.cube对于生成路径,没有独立的 LUT 或蒙版生成器——它们都属于 。
effectApplying an Existing LUT Asset
应用已有 LUT 资产
Default target is the timeline. "Apply this LUT" means an effect on the clip. Only reach for when the user asks for the source itself everywhere it appears — every clip cut from that asset, or a log-to-Rec.709 normalization of the footage — because that changes every instance of the asset on every timeline.
edit_itemedit_asset sourceLut.cubecategory: "lut"edit_itemassetIdtext
edit_item(json: '{"adds":[{"type":"effect","targetItemId":"<clip-id>","assetId":"<lut-effect-asset-id>","propertyOverrides":{"intensity":1}}]}')Key points:
- is the LUT effect asset's real id. There is no literal
assetIdassetId, and no LUT binding nested inside"lut".propertyOverrides - carries only
propertyOverrides(0–1, default 1). Theintensitybinding lives on the asset, not on the effect item..cube - Find the id with : a LUT asset is the one whose
browse_assets type:"effect"contain aeditableProperties-typed key. Built-in LUTs come fromlut.browse_library category:"luts" - defaults to
targetItemType; also supportsvideo,image.gif - To swap: delete the effect and re-add with the other LUT's . To remove: delete the effect item.
assetId - To grade a whole source clip everywhere it appears instead of one timeline item, use update with
edit_asseton the video/image/gif asset;{"sourceLut":{"assetId":"<lut-effect-asset-id>"}}removes it.{"sourceLut":null} - If the is not in the project yet, you cannot get it in: this surface has no LUT import path, and
.cubeis not an accepted chat attachment either, so never ask the user to send you the file. Ask them to drag it into the editor's media pool instead — the editor registers it as a LUT asset and it then shows up in.cube. Do not tell them ChatCut cannot handlebrowse_assets; the editor can..cube
Do not call for this path.
submit_shaderAfter applying, confirm with that the effect is listed on the target clip's track. Do not report success from the response alone.
preview_timelineedit_item默认目标是时间线。“应用这个 LUT”意味着在片段上添加 效果。只有当用户明确要求将该源素材本身应用到它出现的所有位置——由该素材切出的每个片段,或对素材执行 log-to-Rec.709 标准化——才使用 ,因为这会改变该素材在每个时间线上的所有实例。
edit_itemedit_asset sourceLut用户上传的 文件会成为 的效果资产。将其中一个应用到片段属于应用操作,不是生成——其结构与内置 LUT 的 效果完全相同,只是 改为该资产自己的 ID:
.cubecategory: "lut"edit_itemassetIdtext
edit_item(json: '{"adds":[{"type":"effect","targetItemId":"<clip-id>","assetId":"<lut-effect-asset-id>","propertyOverrides":{"intensity":1}}]}')要点:
- 是 LUT 效果资产的真实 ID。不存在字面量
assetId作为"lut",LUT 绑定也不会嵌套在assetId中。propertyOverrides - 只承载
propertyOverrides(0–1,默认 1)。intensity绑定位于资产上,而不是效果项上。.cube - 通过 查找 ID:LUT 资产是
browse_assets type:"effect"中包含editableProperties类型键的资产。内置 LUT 来自lut。browse_library category:"luts" - 默认为
targetItemType;也支持video、image。gif - 要替换:删除效果并使用另一个 重新添加。要移除:删除效果项。
assetId - 要对源素材进行全局调色(应用到它出现的所有位置),而不是只处理一个时间线项,请对 video/image/gif 资产使用 update,并设置
edit_asset;设置{"sourceLut":{"assetId":"<lut-effect-asset-id>"}}可将其移除。{"sourceLut":null} - 如果 尚未进入项目,则无法通过此入口导入:该界面没有 LUT 导入路径,
.cube也不是受支持的聊天附件,因此绝不能让用户发送文件。应请用户将其拖入编辑器的媒体池;编辑器会将其注册为 LUT 资产,随后它会出现在.cube中。不要告诉用户 ChatCut 无法处理browse_assets;编辑器可以处理。.cube
对于此路径,不要调用 。
submit_shader应用后,使用 确认该效果已列在目标片段的轨道上。不要仅根据 的响应就报告成功。
preview_timelineedit_itemUsage
使用方法
Before calling , restate the user's intent in one concrete sentence, then proceed immediately. After returns, state what was produced in one line — do NOT ask "Keep it or regenerate it?".
submit_shadertrack_progressts
submit_shader({
type: "effect",
prompt: "Chromatic aberration with RGB split",
name: "Chromatic Aberration",
});
submit_shader({
type: "transition",
prompt: "Smooth crossfade with soft edge",
name: "Crossfade",
});
submit_shader({
type: "effect",
prompt: "Cinematic teal-orange color grade",
});
submit_shader({
type: "effect",
prompt: "Stronger version",
referenceAssetIds: ["effect_asset_id"],
});调用 前,先用一句具体的话重述用户意图,然后立即执行。 返回后,用一行说明生成了什么——不要询问“保留还是重新生成?”
submit_shadertrack_progressts
submit_shader({
type: "effect",
prompt: "Chromatic aberration with RGB split",
name: "Chromatic Aberration",
});
submit_shader({
type: "transition",
prompt: "Smooth crossfade with soft edge",
name: "Crossfade",
});
submit_shader({
type: "effect",
prompt: "Cinematic teal-orange color grade",
});
submit_shader({
type: "effect",
prompt: "Stronger version",
referenceAssetIds: ["effect_asset_id"],
});Strategy
策略
- Submit, then stop. Tell user the job was created.
- Use the tool for status/wait after submission.
track_progress - Generation always produces a library asset — never refuse because the timeline isn't ready.
- Apply is separate and optional. Only apply when user explicitly asks ("加到视频", "apply", "用到第一段"). When ambiguous, default to library-only.
- 提交后即停止。告知用户任务已创建。
- 使用 工具跟踪状态或等待任务完成。
track_progress - 生成始终会产出一个库资产——绝不要因为时间线尚未就绪而拒绝。
- 应用是独立且可选的。只有当用户明确提出要求(“加到视频”、“apply”、“用到第一段”)时才应用。若意图不明确,默认仅生成到库中。
Editing Existing Properties
编辑已有属性
Any time you're about to edit shader , applied effect/transition , or promote a hardcoded shader value, read first.
asset.propertiesitem.propertyOverridesreferences/property-changes.mdIt reinforces that shader is an array, but the allowed shader property types are only , , , , and . Motion Graphic properties are also arrays, but use a different type set.
propertiesnumberbooleancolorselectvec2每当你准备编辑 Shader 的 、已应用效果/转场的 ,或提升硬编码的 Shader 值时,先阅读 。
asset.propertiesitem.propertyOverridesreferences/property-changes.md该文档强调,Shader 的 是数组,但允许的 Shader 属性类型仅包括 、、、 和 。Motion Graphic 的属性也是数组,但使用不同的类型集合。
propertiesnumberbooleancolorselectvec2Parameters
参数
| Param | Description | Default |
|---|---|---|
| | — |
| Description of the shader (req'd) | — |
| Asset name shown in library | — |
| Asset ids. Image id → model LOOKS AT it for visual inspiration. Effect/transition id → reuse its code as style anchor (≤1 per submit, kind must match | — |
| 参数 | 说明 | 默认值 |
|---|---|---|
| | — |
| Shader 的描述(必填) | — |
| 在库中显示的资产名称 | — |
| 资产 ID。图像 ID → 模型会参考它获取视觉灵感。特效/转场 ID → 复用其代码作为风格锚点(每次提交最多 1 个,类型必须与 | — |
Output
输出
Returns .
{ success, job: { jobId, status }, manage: { status, wait, watch } }返回 。
{ success, job: { jobId, status }, manage: { status, wait, watch } }Applying to Timeline
应用到时间线
Only when user explicitly requests. Refresh the affected timeline with , passing to narrow the read when appropriate.
view:"timeline"track仅在用户明确要求时执行。通过 刷新受影响的时间线,并在适当时传入 以缩小读取范围。
view:"timeline"trackEffect
效果
text
edit_item(json: '{"adds":[{"type":"effect","targetItemId":"<id>","assetId":"<id>","enabled":true,"propertyOverrides":{}}]}')text
edit_item(json: '{"adds":[{"type":"effect","targetItemId":"<id>","assetId":"<id>","enabled":true,"propertyOverrides":{}}]}')Transition
转场
Requires two adjacent same-track endpoints. validates live seam feasibility and refuses durations that would require freeze frames or overlapping neighboring transitions. If the add fails, retry with the suggested , trim the clips to expose handles, delete/shorten neighboring transitions, or keep a hard cut.
edit_itemdurationInFramestext
edit_item(json: '{"adds":[{"type":"transition","assetId":"<id>","outgoingItemId":"<id1>","incomingItemId":"<id2>","durationInFrames":30}]}')需要两个位于同一轨道上的相邻端点。 会验证实时连接点的可行性,并拒绝那些需要定格帧或与相邻转场重叠的持续时间。如果添加失败,请按照建议的 重试,修剪片段以留出操作余量,删除或缩短相邻转场,或者保留硬切。
edit_itemdurationInFramestext
edit_item(json: '{"adds":[{"type":"transition","assetId":"<id>","outgoingItemId":"<id1>","incomingItemId":"<id2>","durationInFrames":30}]}')Validation & Verification
验证与检查
Backend Validation
后端验证
When generating via , the backend handles validation automatically (transpile, AST security, class structure, retry on failure).
generate.ts通过 生成时,后端会自动处理验证(转译、AST 安全检查、类结构、失败后重试)。
generate.tsManual Code Verification
手动代码验证
NEVER write shader code from scratch. Always use for new shaders. This section is ONLY for modifying existing shader code that was already generated.
generate.tsWhen writing shader code manually, read first. If the change touches editable properties, also read .
references/design-principles.mdreferences/property-changes.mdTypical workflow:
- with the shader
inspect_assetandassetId— read the current source.includeCode: true - Edit the source in your own context.
- with
edit_asset, the sameaction=update, and the full replacement source inline inassetId. Validation runs automatically on update — if code is invalid, the update is rejected with error details.json.code
**绝不要从头编写 Shader 代码。**新 Shader 始终使用 。本节仅适用于修改已经生成的现有 Shader 代码。
generate.ts手动编写 Shader 代码时,先阅读 。如果修改涉及可编辑属性,还要阅读 。
references/design-principles.mdreferences/property-changes.md典型工作流:
- 使用 并传入 Shader 的
inspect_asset和assetId——读取当前源代码。includeCode: true - 在你自己的上下文中编辑源代码。
- 使用 ,设置
edit_asset、相同的action=update,并在assetId中内联提供完整的替换源代码。更新时会自动运行验证——如果代码无效,更新将被拒绝并返回错误详情。json.code