Z Defocus(ZDefocusStage)
Z Defocus is a video effect stage that applies a depth-driven defocus (depth of field) effect to a video.
Z Defocus Stage
Description
Z Defocus is a video effect stage that applies a depth-driven defocus (depth of field) effect to a video. A depth source, either a still depth image or a per-frame depth video, is used to decide how strongly each part of the frame is blurred. This lets you keep one depth range sharp while softly defocusing nearer or farther regions, producing a shallow-focus or rack-focus look. Because the node is a stage in the ComfyTV video effect pipeline, its single output is a processed video that can be chained into other stages.
Inputs
| Name | Type | Required | Default | Meaning |
|---|---|---|---|---|
invert_depth | BOOLEAN | Yes | false | Reverses the interpretation of the incoming depth signal before it drives the defocus. |
video | COMFYTV_VIDEO | No | none | The source video to process. |
depth_image | COMFYTV_IMAGE | No | none | A still depth map used to drive the defocus for the whole clip. |
depth_video | COMFYTV_VIDEO | No | none | A per-frame depth video used to drive the defocus over time. |
invert_depth
Controls how depth values are read. With invert_depth set to false the depth signal is used as-is; setting it to true flips the depth values before the defocus is applied. Use this when your depth source uses the opposite convention to what the effect expects (for example, a source where near is dark rather than bright), which otherwise would apply the blur to the wrong part of the frame.
video
The source video to be processed. Although this input is optional, it is the footage the defocus is applied to, so a video is normally supplied here. Omitting it leaves nothing to process.
depth_image
An optional still depth map. Providing a single image drives the defocus uniformly across every frame, which is convenient when the scene and camera do not move and a constant depth map is enough.
depth_video
An optional per-frame depth video. This is the choice for moving shots, since each frame receives its own depth information and the defocus can follow subjects and camera motion over time. Supply either depth_image or depth_video to drive the effect; the depth input is what determines which regions are blurred.
Outputs
| Name | Type | Meaning |
|---|---|---|
COMFYTV_VIDEO | COMFYTV_VIDEO | The processed video with the depth-driven defocus applied. |
Usage Notes
- A depth source (
depth_imageordepth_video) is needed to drive the effect; without one there is no depth information to shape the blur. - Use
depth_videofor shots with movement anddepth_imagefor static setups where a single depth map is sufficient. - If the sharp and blurred regions come out reversed from what you intended, toggle
invert_depthrather than regenerating the depth source. - The single video output makes this node easy to place in a chain of ComfyTV video effect stages.
- The category is
ComfyTV/VideoFXin the node menu.
Comments
Sign in with GitHub to join the discussion.