Cube Limit
Crop your point cloud down to a box, percentages and all
- points
- Points3D
Cube Limit is the scissors of the pack. It keeps only the points inside a box you define, and drops everything outside it. Feed it a point cloud, tell it where the box walls are, and you get back a smaller, focused cloud. That's the whole job - and it's a genuinely useful one when your cloud is cluttered with stuff you don't want.
Where it earns its keep: you've turned a photo of a room into a point cloud and you only want the person in the middle. You've rotated a cloud and the background is now full of stray points you want gone before rendering. Or you're doing the classic inpaint-mask trick and need to isolate one region of the depth geometry. In all those cases, a crop beats trying to mask the rendered 2D image later, because you're removing geometry at the source.
How it works
Here's the neat part: the six range values aren't coordinates - they're percentages of the cloud's own bounding box. The node measures the cloud's min/max along each axis, converts your 0–100 values into positions inside that range, and keeps only points inside the resulting box. That makes it resolution-independent: a crop set at 25–75 on X crops the middle half of the cloud whether the image was 512×512 or 1024×1024.
The inputs that matter
- points - the
Points3Dcloud to crop. - x_min / x_max (0–100) - where the box starts and stops on X. Default 0/100 keeps everything.
- y_min / y_max (0–100) - same for Y.
- z_min / z_max (0–100) - same for Z. This is the fun one, because Z is depth: trim the background by lowering
z_max, or shave off the foreground by raisingz_min.
To crop to the middle half: 25 on every _min, 75 on every _max. To keep only the front of the scene: leave X/Y alone, set z_max to 50.
Output: Points3D - the surviving points, same format as the input, ready for a renderer, another transform, or export.
Install
Pack-standard: Manager → "ComfyUI_depthMapOperation", or:
cd ComfyUI/custom_nodes
git clone https://github.com/chri002/ComfyUI_depthMapOperation
Restart. No models, no keys; deps (torch, numpy, opencv-python, scipy, pandas) are already in a stock install.
Where people get burned
Two things. First, the whole "percent of bounding box" thing surprises people who assume the values are absolute coordinates - you're not. If you set 50 on z_max expecting "half the depth range in metres," you get "everything shallower than the middle of the range," which is usually close enough but not identical.
Second, a real quirk I found reading the source: the Y-axis upper bound is computed with a minus sign where every other axis uses a plus (y_max * pct - min instead of y_max * pct + min). In plain terms, y_max doesn't behave like x_max and z_max when your cloud's minimum Y is far from zero - the upper crop lands lower than you asked for. So if your Y crop looks off, don't fight it; nudge the other axes first or treat y_max as approximate. Minor, but it's exactly the kind of thing that eats an hour when you're new to the node.
Inputs (7)
| Name | Type | Default | Description |
|---|---|---|---|
| points | Points3D | — | |
| x_min | FLOAT | 0.0000–100 | — |
| x_max | FLOAT | 100.0000–100 | — |
| y_min | FLOAT | 0.0000–100 | — |
| y_max | FLOAT | 100.0000–100 | — |
| z_min | FLOAT | 0.0000–100 | — |
| z_max | FLOAT | 100.0000–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| Points3D | Points3D | — |