VFX Utilities
Generate production-ready VFX utility passes from any image or plate in seconds. This workflow creates alphas, depth, and normal maps using prompt-based and point-based segmentation, giving you the core tools for relighting, compositing, and look development without needing a full CG render.
About
Generate production-ready VFX utility passes from any image or plate in seconds. This workflow creates alphas, depth, and normal maps using prompt-based and point-based segmentation, giving you the core tools for relighting, compositing, and look development without needing a full CG render.
What you provide
- Reading the workflow
Runs in ComfyUI. This workflow can't run on this page. Open it in Comfy Cloud with everything loaded, or download it for your own ComfyUI.
Try in CloudTry an example
Inside the workflow
A read-only preview of the node graph. Open it in Comfy Cloud or download it to edit the nodes.
Loading the graph
Open full-size workflow preview- Author
- ComfyUI
Requires custom nodes
- Reading the workflow
Use this workflow from code
Generated from the workflow graph and inputs when possible; stored examples are shown otherwise. Review credentials and endpoints before running code, which may incur charges.
What you need
- Runs on
- Comfy Cloud
- Key
- COMFY_API_KEY
Needs a paid Cloud plan and credits.
# Python 3.10+: pip install comfy-sdk==0.4.0
import os
from comfy_sdk import Comfy
api_key = os.environ.get("COMFY_API_KEY", "").strip()
if not api_key: raise RuntimeError("Set COMFY_API_KEY")
os.environ.setdefault("COMFY_BASE_URL", "https://cloud.comfy.org")
client = Comfy(api_key=api_key)
workflow = client.workflows.from_json({
"1": {
"class_type": "SAM3Segment",
"inputs": {
"background": "Alpha",
"background_color": "#222222",
"confidence_threshold": 0.5,
"device": "Auto",
"image": [
"6",
0
],
"invert_output": False,
"mask_blur": 0,
"mask_offset": 0,
"max_segments": 0,
"output_mode": "Merged",
"prompt": [
"17",
0
],
"segment_pick": 0,
"unload_model": False
},
"_meta": {
"title": "SAM3 Segmentation (RMBG)"
}
},
"2": {
"class_type": "DownloadAndLoadDepthAnythingV2Model",
"inputs": {
"model": "depth_anything_v2_vitl_fp32.safetensors",
"precision": "auto"
},
"_meta": {
"title": "DownloadAndLoadDepthAnythingV2Model"
}
},
"4": {
"class_type": "VHS_VideoCombine",
"inputs": {
"crf": 12,
"filename_prefix": "depth",
"format": "video/h264-mp4",
"frame_rate": [
"7",
0
],
"images": [
"47",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": True,
"trim_to_audio": False
},
"_meta": {
"title": "DEPTH PASS"
}
},
"6": {
"class_type": "VHS_LoadVideo",
"inputs": {
"custom_height": 0,
"custom_width": 0,
"force_rate": 24,
"format": "AnimateDiff",
"frame_load_cap": 0,
"select_every_nth": 1,
"skip_first_frames": 0,
"video": "77fcc9512c2fd37409261685a39f805b8a735e5b4e85a8e9c80e543e6784d531.mp4"
},
"_meta": {
"title": "SOURCE"
}
},
"7": {
"class_type": "VHS_VideoInfo",
"inputs": {
"video_info": [
"6",
3
]
},
"_meta": {
"title": "Video Info 🎥🅥🅗🅢"
}
},
"8": {
"class_type": "DepthAnything_V2",
"inputs": {
"da_model": [
"2",
0
],
"images": [
"6",
0
]
},
"_meta": {
"title": "Depth Anything V2"
}
},
"14": {
"class_type": "VHS_VideoCombine",
"inputs": {
"crf": 12,
"filename_prefix": "alpha_1",
"format": "video/h264-mp4",
"frame_rate": [
"7",
0
],
"images": [
"56",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": True,
"trim_to_audio": False
},
"_meta": {
"title": "MATTE 1"
}
},
"16": {
"class_type": "SAM3VideoSegmentation",
"inputs": {
"frame_idx": 0,
"prompt_mode": "text",
"score_threshold": 0.3,
"text_prompt": [
"17",
0
],
"video_frames": [
"6",
0
]
},
"_meta": {
"title": "SAM3 Video Segmentation"
}
},
"17": {
"class_type": "TextBox1",
"inputs": {
"text1": "person"
},
"_meta": {
"title": "Object Prompt"
}
},
"18": {
"class_type": "SAM3Propagate",
"inputs": {
"direction": "both",
"end_frame": -1,
"offload_model": False,
"sam3_model": [
"19",
0
],
"start_frame": 0,
"video_state": [
"16",
0
]
},
"_meta": {
"title": "SAM3 Propagate"
}
},
"19": {
"class_type": "LoadSAM3Model",
"inputs": {
"model_path": "models/sam3/sam3.pt"
},
"_meta": {
"title": "(down)Load SAM3 Model"
}
},
"20": {
"class_type": "SAM3VideoOutput",
"inputs": {
"masks": [
"18",
0
],
"obj_id": -1,
"plot_all_masks": True,
"scores": [
"18",
1
],
"video_state": [
"18",
2
]
},
"_meta": {
"title": "SAM3 Video Output"
}
},
"25": {
"class_type": "MaskToImage",
"inputs": {
"mask": [
"20",
0
]
},
"_meta": {
"title": "Convert Mask to Image"
}
},
"26": {
"class_type": "VHS_VideoCombine",
"inputs": {
"crf": 12,
"filename_prefix": "alpha_2",
"format": "video/h264-mp4",
"frame_rate": [
"7",
0
],
"images": [
"53",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": True,
"trim_to_audio": False
},
"_meta": {
"title": "MATTE 2"
}
},
"31": {
"class_type": "VHS_VideoCombine",
"inputs": {
"crf": 12,
"filename_prefix": "alpha_3",
"format": "video/h264-mp4",
"frame_rate": [
"7",
0
],
"images": [
"50",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": True,
"trim_to_audio": False
},
"_meta": {
"title": "MATTE 3"
}
},
"37": {
"class_type": "NormalCrafterNode",
"inputs": {
"decode_chunk_size": 4,
"images": [
"6",
0
],
"max_res_dimension": 1024,
"offload_pipe_to_cpu_on_finish": True,
"seed": 5794135798431254,
"time_step_size": 10,
"use_xformers": "auto",
"window_size": 14
},
"_meta": {
"title": "NormalCrafter (Process Video)"
}
},
"39": {
"class_type": "VHS_VideoCombine",
"inputs": {
"crf": 12,
"filename_prefix": "normals",
"format": "video/h264-mp4",
"frame_rate": [
"7",
0
],
"images": [
"44",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": True,
"trim_to_audio": False
},
"_meta": {
"title": "NORMALS PASS"
}
},
"44": {
"class_type": "ImageResizeKJv2",
"inputs": {
"crop_position": "center",
"device": "cpu",
"divisible_by": 2,
"height": [
"7",
4
],
"image": [
"37",
0
],
"keep_proportion": "stretch",
"pad_color": "0, 0, 0",
"upscale_method": "nearest-exact",
"width": [
"7",
3
]
},
"_meta": {
"title": "Resize Image v2"
}
},
"47": {
"class_type": "ImageResizeKJv2",
"inputs": {
"crop_position": "center",
"device": "cpu",
"divisible_by": 2,
"height": [
"7",
4
],
"image": [
"8",
0
],
"keep_proportion": "stretch",
"pad_color": "0, 0, 0",
"upscale_method": "nearest-exact",
"width": [
"7",
3
]
},
"_meta": {
"title": "Resize Image v2"
}
},
"50": {
"class_type": "ImageResizeKJv2",
"inputs": {
"crop_position": "center",
"device": "cpu",
"divisible_by": 2,
"height": [
"7",
4
],
"image": [
"85",
0
],
"keep_proportion": "stretch",
"pad_color": "0, 0, 0",
"upscale_method": "nearest-exact",
"width": [
"7",
3
]
},
"_meta": {
"title": "Resize Image v2"
}
},
"53": {
"class_type": "ImageResizeKJv2",
"inputs": {
"crop_position": "center",
"device": "cpu",
"divisible_by": 2,
"height": [
"7",
4
],
"image": [
"25",
0
],
"keep_proportion": "stretch",
"pad_color": "0, 0, 0",
"upscale_method": "nearest-exact",
"width": [
"7",
3
]
},
"_meta": {
"title": "Resize Image v2"
}
},
"56": {
"class_type": "ImageResizeKJv2",
"inputs": {
"crop_position": "center",
"device": "cpu",
"divisible_by": 2,
"height": [
"7",
4
],
"image": [
"59",
0
],
"keep_proportion": "stretch",
"pad_color": "0, 0, 0",
"upscale_method": "nearest-exact",
"width": [
"7",
3
]
},
"_meta": {
"title": "Resize Image v2"
}
},
"59": {
"class_type": "MaskToImage",
"inputs": {
"mask": [
"1",
1
]
},
"_meta": {
"title": "Convert Mask to Image"
}
},
"60": {
"class_type": "FaceSegment",
"inputs": {
"Earring": False,
"Eyeglasses": False,
"Hair": False,
"Left-ear": False,
"Left-eye": True,
"Left-eyebrow": True,
"Lower-lip": False,
"Mouth": False,
"Neck": False,
"Nose": False,
"Right-ear": False,
"Right-eye": True,
"Right-eyebrow": True,
"Skin": False,
"Upper-lip": False,
"background": "Alpha",
"background_color": "#222222",
"images": [
"6",
0
],
"invert_output": False,
"mask_blur": 0,
"mask_offset": 0,
"process_res": 512
},
"_meta": {
"title": "Face Segment (RMBG)"
}
},
"61": {
"class_type": "VHS_VideoCombine",
"inputs": {
"crf": 12,
"filename_prefix": "alpha_4",
"format": "video/h264-mp4",
"frame_rate": [
"7",
0
],
"images": [
"65",
0
],
"loop_count": 0,
"pingpong": False,
"pix_fmt": "yuv420p",
"save_metadata": True,
"save_output": True,
"trim_to_audio": False
},
"_meta": {
"title": "BEAUTY MATTES"
}
},
"65": {
"class_type": "ImageResizeKJv2",
"inputs": {
"crop_position": "center",
"device": "cpu",
"divisible_by": 2,
"height": [
"7",
4
],
"image": [
"67",
0
],
"keep_proportion": "stretch",
"pad_color": "0, 0, 0",
"upscale_method": "nearest-exact",
"width": [
"7",
3
]
},
"_meta": {
"title": "Resize Image v2"
}
},
"67": {
"class_type": "MaskToImage",
"inputs": {
"mask": [
"60",
1
]
},
"_meta": {
"title": "Convert Mask to Image"
}
},
"85": {
"class_type": "MaskToImage",
"inputs": {
"mask": [
"86",
0
]
},
"_meta": {
"title": "Convert Mask to Image"
}
},
"86": {
"class_type": "SAM3VideoOutput",
"inputs": {
"masks": [
"87",
0
],
"obj_id": -1,
"plot_all_masks": True,
"scores": [
"87",
1
],
"video_state": [
"87",
2
]
},
"_meta": {
"title": "SAM3 Video Output"
}
},
"87": {
"class_type": "SAM3Propagate",
"inputs": {
"direction": "both",
"end_frame": -1,
"offload_model": False,
"sam3_model": [
"92",
0
],
"start_frame": 0,
"video_state": [
"88",
0
]
},
"_meta": {
"title": "SAM3 Propagate"
}
},
"88": {
"class_type": "SAM3VideoSegmentation",
"inputs": {
"frame_idx": 0,
"negative_points": [
"89",
1
],
"positive_points": [
"89",
0
],
"prompt_mode": "point",
"score_threshold": 0.3,
"text_prompt": "",
"video_frames": [
"6",
0
]
},
"_meta": {
"title": "SAM3 Video Segmentation"
}
},
"89": {
"class_type": "SAM3PointCollector",
"inputs": {
"coordinates": "[{\"x\":639.3392401688973,\"y\":161.28468577884667},{\"x\":654.6042907591711,\"y\":281.71285378550704},{\"x\":590.1518549335707,\"y\":290.1937106873845},{\"x\":664.7809911526871,\"y\":376.69845108653493},{\"x\":732.6256604427927,\"y\":308.85159587151503}]",
"image": [
"90",
0
],
"neg_coordinates": "[{\"x\":902.2373336680569,\"y\":229.1315409938666},{\"x\":1095.594641144858,\"y\":329.205652436021},{\"x\":1073.5451236255738,\"y\":505.6074759950728},{\"x\":919.1985009905834,\"y\":595.5045591549742},{\"x\":637.6431234366447,\"y\":624.3394726213577},{\"x\":369.6566797407273,\"y\":546.3155891240847},{\"x\":256.01685867980024,\"y\":412.3180500744204},{\"x\":218.7022905702421,\"y\":276.62433964438054},{\"x\":349.30327895369555,\"y\":173.15788544147514},{\"x\":328.9498781666639,\"y\":134.14594369283867},{\"x\":128.8081037608521,\"y\":193.51194200598113},{\"x\":473.1198004081384,\"y\":520.8730184184523}]",
"points_store": "{\"positive\":[{\"x\":639.3392401688973,\"y\":161.28468577884667},{\"x\":654.6042907591711,\"y\":281.71285378550704},{\"x\":590.1518549335707,\"y\":290.1937106873845},{\"x\":664.7809911526871,\"y\":376.69845108653493},{\"x\":732.6256604427927,\"y\":308.85159587151503}],\"negative\":[{\"x\":902.2373336680569,\"y\":229.1315409938666},{\"x\":1095.594641144858,\"y\":329.205652436021},{\"x\":1073.5451236255738,\"y\":505.6074759950728},{\"x\":919.1985009905834,\"y\":595.5045591549742},{\"x\":637.6431234366447,\"y\":624.3394726213577},{\"x\":369.6566797407273,\"y\":546.3155891240847},{\"x\":256.01685867980024,\"y\":412.3180500744204},{\"x\":218.7022905702421,\"y\":276.62433964438054},{\"x\":349.30327895369555,\"y\":173.15788544147514},{\"x\":328.9498781666639,\"y\":134.14594369283867},{\"x\":128.8081037608521,\"y\":193.51194200598113},{\"x\":473.1198004081384,\"y\":520.8730184184523}]}"
},
"_meta": {
"title": "SAM3 Point Collector"
}
},
"90": {
"class_type": "ImageFromBatch",
"inputs": {
"batch_index": 0,
"image": [
"6",
0
],
"length": 1
},
"_meta": {
"title": "Get Image from Batch"
}
},
"92": {
"class_type": "LoadSAM3Model",
"inputs": {
"model_path": "models/sam3/sam3.pt"
},
"_meta": {
"title": "(down)Load SAM3 Model"
}
}
})
# run() also passes api_key to the partner nodes in this workflow.
job = client.run(workflow, api_key=api_key)