Nodes/IG Interpolation Nodes/🌐 IG PointCloud From Depth
ComfyUI Node

🌐 IG PointCloud From Depth

Turn an RGB image and a metric depth map into a real 3D point cloud

By IDGallagherΒ·Created 3 years agoΒ·Updated about a year agoΒ· 3
🌐 IG PointCloud From Depth
  • rgb_image
  • depth_image
  • pointcloud
β—„focal_length_px-1β–Ί
β—„principal_x_px-1β–Ί
β—„principal_y_px-1β–Ί
β—„stride1β–Ί

IG PointCloud From Depth is where this pack stops being about images and starts being about geometry. It takes an RGB image plus a metric depth map and projects every pixel into 3D space, producing a point cloud tensor - [N, 6] of (x, y, z, r, g, b) - that you can save as a PLY and open in any 3D viewer. It's the node that turns a flat frame and its depth estimate into something you can walk around.

The model is a plain pinhole camera. For each pixel (u, v) with depth d, it computes X = (u - c_x) Β· d / f, Y = (v - c_y) Β· d / f, Z = d, where f is the focal length in pixels and (c_x, c_y) is the principal point. If you leave the intrinsics at their defaults (-1), the node fills them in sensibly: focal length defaults to the image width, and the principal point defaults to the image center. Depth values are used as radial distance in whatever unit your depth map carries - typically meters.

Inputs:

  • rgb_image - IMAGE, color channels in 0–1.
  • depth_image - IMAGE, metric depth in the same resolution.
  • focal_length_px - FLOAT, default -1 (= image width). Lower focal length = wider field of view and more apparent distortion at the edges.
  • principal_x_px / principal_y_px - INT, default -1 (= image center).
  • stride - INT, default 1. Sub-sample every Nth pixel in each direction; stride = 2 gives you a quarter of the points. This is your point-count governor - full-res depth maps produce millions of points, and dropping to stride = 4 often looks identical in a viewer.

Output: pointcloud - the [N, 6] tensor (RGB scaled to 0–255). Batch size must be 1 and the two images must match resolution, or it raises.

The dependency that matters is upstream: you need a metric depth estimator, not a relative one. MiDaS gives relative depth (ordering, not meters), which will produce a squashed, wrong-looking cloud. Depth Anything v2 and ZoeDepth output real metric values - that's the family you want. The KB's own history here is instructive: the community found metric models geometrically more accurate but softer-edged than MiDaS for ControlNet work - for point clouds, you want the metric side of that tradeoff. ComfyUI's ControlNet Auxiliary Preprocessors can produce the depth map; this node does the projection, it never estimates depth itself.

Install is the pack standard:

cd ComfyUI/custom_nodes
git clone https://github.com/IDGallagher/ComfyUI-IG-Nodes
cd ComfyUI-IG-Nodes && pip install -r requirements.txt

Or ComfyUI Manager β†’ search "IG Interpolation Nodes" β†’ Install, restart. Then pair it with IG Save PLY PointCloud to write the result to disk. The README is :), so the camera math above is straight from nodes/pointcloud_from_depth.py.

CategoryπŸ“ IG Nodes/IO

Inputs (6)

NameTypeDefaultDescription
rgb_imageIMAGEβ€”
depth_imageIMAGEβ€”
focal_length_pxFLOAT-1-1–99999999β€”
principal_x_pxINT-1-1–99999999β€”
principal_y_pxINT-1-1–99999999β€”
strideINT1β€”

Outputs (1)

NameTypeDescription
pointcloudPOINTCLOUDβ€”