Image To Points (Torch)
Turn any photo plus its depth map into a point cloud you can spin
- image
- depth_image
- Points3D
This is the node that makes the whole pack make sense. Give it a normal image and its depth map, and it hands you back a point cloud - thousands of little 3D points, each carrying its RGB color. Once you have that, every other node in ComfyUI_depthMapOperation is just something you do to the cloud: rotate it, crop it, render it back to a flat picture.
It's the ComfyUI answer to the old "photo in, 3D out" trick. Get your depth map from any depth estimator - Depth Anything V2 via comfyui_controlnet_aux is the community default, and it works fine here since this node only cares about relative depth, which is exactly what those models output - then feed both in and you've got geometry.
How it works
The depth image is turned into a grayscale map, and each pixel becomes a point. X and Y are just the pixel's column and row; Z is the depth value scaled by the depth parameter. Colors come straight from the source image, and the alpha channel does double duty as a mask - fully transparent pixels are dropped instead of becoming points.
The "Torch" in the name is the point. This version does everything as GPU tensors, so a 1024×1024 image becomes a million-point cloud in a second or two, and it keeps gradient flow if you're doing anything differentiable with it. There's a non-Torch variant in the pack's history that ran on CPU numpy; this is the one you want.
The inputs that matter
- image - your color photo or rendered image.
- depth_image - the matching depth map. It doesn't need to be the same resolution; the node resizes the color to fit.
- depth (1–1024, default 1) - how deep the cloud gets along Z. This is a scale factor, not a distance. Low values give a flatter relief, high values exaggerate it into a canyon. Start at 1 and crank up when the render looks too flat.
- quality (1–16, default 1) - point density. At 1 you get one point per pixel; higher values bilinearly interpolate extra points between pixels. Only raise it if the cloud looks too sparse to render cleanly - it multiplies your point count.
Output: Points3D - an N×6 cloud of (x, y, z, r, g, b). Heads-up: Points3D is this pack's own custom wire type, so it only plugs into the other nodes in ComfyUI_depthMapOperation (Transform, Cube Limit, the Points To Image renderers, PLY import/export). You can't wire it straight into an arbitrary node.
Install
ComfyUI Manager → search "ComfyUI_depthMapOperation", or the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/chri002/ComfyUI_depthMapOperation
Then restart ComfyUI. No model downloads, no API keys. The whole pack is one Python file, and its dependencies (torch, numpy, opencv-python, scipy, pandas) are ones ComfyUI already ships with.
Where people get burned
The big one: batch size 1 only. The node throws if you feed it a batch of more than one image. Keep the image and depth map as single frames, not a batch. And because this is a small, one-maintainer pack, the README's own TODO admits "artifacts with some extreme values" - if your depth map has wild values, normalize it or back off the depth scale before blaming yourself.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| depth_image | IMAGE | — | |
| depth | INT | 11–1024 | — |
| quality | INT | 11–16 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Points3D | Points3D | — |