Nodes/kubakub nodes/kubakub form height
ComfyUI Node

kubakub form height

How far the generated forms stick out of the real wall, as a picture

By kubakubkub·Created 19 days ago·Updated about 18 hours ago· 10
kubakub form height
  • scene
  • model
  • height
  • forms
  • depth
  • report
  • colour
◄wall_m0.50►
◄smallest_form_m0.50►
◄counted_fromthe wall's plane►
◄white_at_m0.00►
◄model_file►
◄upauto►
◄coloursfalse►

A mesh from an image-to-3D model is one merged piece - wall, windows and ornament fused into a single surface, so there's nothing in it you can move on its own. You can't push the stones out, you can't animate the ornaments, because the stones aren't objects. But once the model lies on your real building (that's kubakub align 3d model's job), the two can be compared, and everything standing in front of the real wall is a form.

kubakub form height turns that comparison into an image: black on the wall, white where a form stands furthest out, in the projection view - the same framing your projector and your scene render use. It's a picture, which is the point. Pictures can be raised from black, driven by a mask field or a beat, fed to a depth shader, or sent to Houdini as a displacement map.

How it works

You give it the scene of your real building (from kubakub scene render) and the generated model. The model is drawn from the scene's camera on the graphics card - the same GL context the pack's shaders use, so no Blender run of its own; the docs quote about 2 s for a 350k-face model at 2048×1536 - and then the real wall the scene render saw is subtracted from it. What's left is metres: zero on the wall, positive where a form is in front of it.

Because the wall is your wall and not the generated one, windows the generator drew half a metre beside your real ones simply don't show up. That's the trick that makes this usable on real generated geometry instead of clean test meshes.

Inputs that matter

scene is required and comes from kubakub scene render (that's the Blender-side node, so you do need Blender 4.x installed for this workflow).

wall_m (default 0.5) is the one you'll tune every time. Anything standing out less than this counts as wall. A generated wall never sits exactly on the real one - 0.2 to 0.3 m off on a 30 m facade in the author's measurements - so raise wall_m until the wall goes black, lower it if you're losing flat forms. The docs' real-world example: at 0.3 parts of the cornice still showed, at 0.6 only the forms were left, standing up to 4 m out.

smallest_form_m drops the specks and the thin lines along cornices and window edges where the generated wall sits a little off. Set it to 0 and you keep everything, including the noise.

counted_from decides what you measure from: the wall's plane counts from the flat main wall, so your real cornices and window niches don't show inside the forms - the clean picture. the real surface counts from the real model under each pixel, which is what you want if you're displacing the real model.

white_at_m sets which height is white: 0 means the highest point of this model, or set a number to put several models on the same scale. up handles the y-up vs z-up mismatch between .glb/.obj and the scene (auto tries both and takes the one that lies on the building), and colours makes the colour output show the forms in the model's own texture colours over the clay render.

model takes the mesh straight from align 3d model, or put its file output path into model_file. Nothing at all connected gives you a sample form on the wall, which is enough to build the rest of the graph against.

Outputs - and where they go

height is the money output: grey, black wall, white furthest out, and the report tells you how many metres white is. forms is the matching mask (1 where a form stands in front of the wall). depth is the real building with the forms on it as grey depth, near = white - the input for the depth presets of kubakub shader (hard shadow, sheet of light, contour lines), for kubakub height animate, or as a displacement map in Houdini or Blender. colour is the clay render alone, or with the forms in the model's colours when colours is on. report covers how well the model lies on the building, how high the forms stand, how much of the picture they cover - and warns you when the model isn't lying on the building, which usually means the template and the scene aren't the same coordinates.

The wiring that matters: height into height animate (and colour into its image, with the clay render on wall_image, so the forms bring their own colours as they rise) or into a shader's depth input.

Install

Standard for the pack - ComfyUI Manager, search kubakub nodes; or:

cd ComfyUI/custom_nodes
git clone https://github.com/kubakubkub/ComfyUI_KubaNodes
python -m pip install -r ComfyUI_KubaNodes/requirements.txt

Restart after. Only OpenCV is added by that file; the pack wants ComfyUI 0.37.0+ (V3 node API). For this node specifically you need Blender 4.x for kubakub scene render upstream, and trimesh if you use model_file - the file reader here is trimesh, which isn't in requirements.txt. python -m pip install trimesh if it complains.

Traps worth knowing

The template and the scene must be the same model in the same place: give align 3d model the same file as template_file that your scene render reads, or the forms get measured against the wrong wall - and the report will say so. A dark, patchy height map usually means wall_m is too low, with the generated wall still leaking through as thin forms. And height is a relative height in metres-of-this-model by default; when you stack several generated models on one building, pin white_at_m so they grow to a common scale.

Categorykubakub/3d/scene

Inputs (9)

NameTypeDefaultDescription
sceneKUBA_SCENEFrom kubakub scene render of the real model: its camera is the view, its wall is where the height is counted from.
wall_mFLOAT0.500–20What stands out less than this (metres) is the wall. A generated wall never lies exactly on the real one; raise it until the wall is black, lower it to keep flat forms. The height is counted from here.
smallest_form_mFLOAT0.500–50What is thinner than this (metres) is dropped: specks, and the lines along cornices and window edges where the generated wall sits a little off. 0 keeps everything.
counted_fromCOMBOthe wall's planethe wall's plane: the height is counted from the flat main wall, so the real wall's own cornices and window niches do not show inside the forms; the clean picture. the real surface: counted from the real model under each pixel, which is what a displacement of the real model needs.
white_at_mFLOAT0.000–100The height (metres) that is white. 0 = the highest point of this model. Set a number to give several models the same scale.
modeloptMESHThe model that lies on the building, e.g. 'model' of kubakub align 3d model. Or give a file in model_file.
model_fileoptSTRINGThe model as a file (.glb, .gltf, .obj, .ply, .stl), e.g. 'file' of kubakub align 3d model. Empty and nothing connected: a sample form on the wall.
upoptCOMBOautoWhich way is up in the model. .glb and .obj files count y as up and Blender turns them when it opens them; the scene counts z. auto tries both and takes the one that lies on the building.
coloursoptBOOLEANfalseOn: the 'colour' output shows the forms in the model's own colours (its texture, or the colours on its points), seen from the scene's camera, on the clay render of the real building. Off: 'colour' is the clay render alone.

Outputs (5)

NameTypeDescription
heightIMAGEThe height map: black = the wall, white = white_at_m (or the highest point). The report says how many metres white is.
formsMASK1 where a form stands in front of the wall.
depthIMAGEThe real building with the forms on it as grey depth, near = white: for depth shaders and for displacement.
reportSTRINGHow well the model lies on the building, how high the forms stand, how much of the picture they cover.
colourIMAGEWith 'colours' on: the real building as clay with the forms in the model's own colours, no light on them. Connect it to 'image' of kubakub height animate and the forms grow in colour.