kubakub mask field
Turn a facade into a grey ramp so masks can travel across it
- regions
- mask
- field
- mask
- report
What it's for
A mask is on-or-off. A building isn't. You want a wave to set off at one corner of the facade and arrive at the other end two seconds later, window by window - and for that, every pixel needs a position along the path, not a binary.
That's what this node produces. It turns your regions into a grey ramp: black where the move starts, white where it ends. Feed the ramp to kubakub mask animate and a reveal, a band or rings run along it. The docs put it well - this is the vector field, that node is the thing travelling on it.
It also stands alone. As a soft mask it's a better feather than a blur, because the gradient follows the architecture rather than the image: it's 0 on the edge of a window and 1 at its deepest point, so an iris-opening window is a real visual rather than a blurred blob. Or export it and use it as a time-offset map in After Effects, Houdini or TouchDesigner - the same trick escapes ComfyUI happily.
How it works
Five field types, and picking the right one is 90% of using this node:
edge distance- black on the edge of a region, white at its deepest point. A reveal along it closes from the outline to the middle (invert to grow outward from the middle). This is the one that makes windows look like they're filling up.direction- black to white alongangle, 0 = left to right, 90 = top to bottom, 180 = right to left. A wipe.radial- black at a centre you place withcentre_x/centre_y, white furthest out. An iris.region order- one flat grey per region, sequenced byorder: left, right, top, bottom, centre (middle out), outside (inward), size (biggest first), random. This is the "one more window per beat" machine when it's driven by a beat curve.noise- soft random greys, every grey used about equally often. A dissolve that looks hand-made.
per decides whether the ramp is local or global. each region gives every region its own black-to-white run, so all windows open simultaneously. all together makes one ramp across the whole facade, which is what turns the same reveal into a single wipe. per has no effect on region order and noise, which are already discrete or random.
select filters by name in the region plan's syntax: W_F1_*, group:Windows, tag:front, comma for or, space for and, ! for not. Same syntax the region plan and the samplers use, so one vocabulary across the pack.
Inputs and outputs
regions- from any kubakub regions node. Connect nothing at all (and no mask) and it uses the windows of the sample facade, so you can play with it before you own a facade.mask(optional) - regions from a mask batch instead, one region per mask, or per separate shape withsplit_shapes(on by default).select,field,per,angle,order,centre_x/centre_y,noise_px,seed,invert- the shape of the ramp, as above.
Outputs: field - the 0-1 ramp inside the regions, 0 outside, also drawn on the node; mask - 1 on the regions the field covers, which is the one you wire into mask animate's mask input; report - region count, size, and what it fell back to when you connected nothing.
Install
Manager → kubakub nodes → install → restart. Manual:
cd ComfyUI/custom_nodes
git clone https://github.com/kubakubkub/ComfyUI_KubaNodes
python -m pip install -r ComfyUI_KubaNodes/requirements.txt
ComfyUI 0.37.0+, OpenCV as the only added dependency (keep yours if you have one). No models needed - this is pure array work. It arrived in pack version 0.3.0 along with mask animate, and needs no new packages.
Common issues
- The reveal runs the wrong way.
invert. Both field and animate have their own; changing one may be all you need. - All the windows behave identically when you wanted a sweep. That's
per: switch toall togetherfor one ramp across the building. selectmatched nothing. The report says so. It's almost always a name that isn't in your region table - checkregions_jsonrather than guessing at the naming.- The ramp is too abrupt inside a window. Blend it: the field output is a mask, so
Bluror a soft combine before mask animate widens the transition without changing where the move starts and ends.
Inputs (14)
| Name | Type | Default | Description |
|---|---|---|---|
| select | STRING | * | The regions the field is made for. * = all. Written as in kubakub region plan: names with wildcards ('W_F1_*'), 'group:Windows', 'tag:front', 'region:3-7'; comma or Enter = or, space = and, '!' = not. |
| field | COMBO | edge distance | edge distance: black on the edge of a region, white at its deepest point. direction: black to white along 'angle'. radial: black at the centre, white farthest out. region order: one flat grey per region, in 'order'. noise: soft random greys. |
| per | COMBO | each region | each region: every region runs from black to white on its own (all windows open at once). all together: one ramp over all of them (a wipe across the facade). No effect on region order and noise. |
| angle | FLOAT | 0-360–360 | direction: degrees. 0 = left to right, 90 = top to bottom, 180 = right to left. |
| order | COMBO | left | region order: which region comes first. left / right / top / bottom = from that side; centre = from the middle out; outside = towards the middle; size = the biggest first; random. |
| centre_x | FLOAT | 0.50-1–2 | radial, all together: the centre, 0 = left edge of the picture, 1 = right edge. |
| centre_y | FLOAT | 0.50-1–2 | radial, all together: the centre, 0 = top edge, 1 = bottom edge. |
| noise_px | FLOAT | 642–4096 | noise: the size of the blobs in pixels. |
| seed | INT | 10–2147483647 | noise and region order = random: another pattern. |
| invert | BOOLEAN | false | Black and white swapped: the move runs the other way. |
| regionsopt | KUBA_REGIONS | From any kubakub regions node. Empty (and no mask) = the windows of the sample facade. | |
| maskopt | MASK | Instead of regions: a mask or a mask batch. Each mask is a region; with split_shapes each separate shape is one. | |
| split_shapesopt | BOOLEAN | true | mask input: on = every separate shape is its own region; off = one region per mask. |
| vectoropt | STRING | An arrow instead of angle and centre: draw it on the node (drag on the picture under 'draw the direction'), or type x, y of its start and x, y of its end, each 0 to 1 of the picture. direction, all together: the ramp starts at the arrow's start and ends at its end. direction, each region: its angle. radial, all together: its start is the centre, its length how far out the ramp reaches. Empty = angle and centre_x / centre_y. |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| field | MASK | The grey ramp, 0 to 1 inside the regions, 0 outside. |
| mask | MASK | 1 on the regions the field covers. Connect it to 'mask' of kubakub mask animate. |
| report | STRING | How many regions, the size, and what was used when nothing was connected. |