ComfyTV/VideoFXgenerated

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

video
depth_image
depth_video
video
invert_depth
ComfyTV

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

NameTypeRequiredDefaultMeaning
invert_depthBOOLEANYesfalseReverses the interpretation of the incoming depth signal before it drives the defocus.
videoCOMFYTV_VIDEONononeThe source video to process.
depth_imageCOMFYTV_IMAGENononeA still depth map used to drive the defocus for the whole clip.
depth_videoCOMFYTV_VIDEONononeA 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

NameTypeMeaning
COMFYTV_VIDEOCOMFYTV_VIDEOThe processed video with the depth-driven defocus applied.

Usage Notes

  • A depth source (depth_image or depth_video) is needed to drive the effect; without one there is no depth information to shape the blur.
  • Use depth_video for shots with movement and depth_image for static setups where a single depth map is sufficient.
  • If the sharp and blurred regions come out reversed from what you intended, toggle invert_depth rather 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/VideoFX in the node menu.

Comments

Sign in with GitHub to join the discussion.

Loading comments…