Nodes/kubakub nodes/kubakub mosaic grid from camera (old)
ComfyUI Node

kubakub mosaic grid from camera (old)

No camera, just arithmetic you'd otherwise get wrong

By kubakubkub·Created about a month ago·Updated 2 days ago· 10
kubakub mosaic grid from camera (old)
    • tile_px
    • info
    ◄facade_width_m33.93►
    ◄feature_width_m0.100►
    ◄render_width_px3200►
    ◄divide1►

    Two inputs, two outputs, no model, no images. kubakub mosaic grid from camera takes real-world sizes and gives you the tile size in pixels for kubakub mosaic illusion. If you already know tile_px by eye, you don't need it. If your mosaic is going onto a real building where a "tile" is a 10 cm stone, you absolutely do - because the number that looks right on screen and the number that matches the building are rarely the same, and the difference is the whole illusion.

    The inputs

    facade_width_m - the real width the image covers on the building, in metres. Default 33.93 is the pack's test facade, which tells you the author built this for a specific job.

    feature_width_m - the real width of one tile on the building: a brick, a stone, a roof tile. Default 0.1, i.e. a 10 cm stone.

    render_width_px - the width in pixels of the image you're making the mosaic at. Default 3200.

    divide - how many tiles you want across each real feature. 1 = one tile per stone. 2 or 3 gives you finer control of the hidden picture at the cost of smaller tiles, which is sometimes necessary when the motif is subtle and one tile per stone doesn't have enough levels to render it.

    The outputs

    tile_px is an INT and it plugs directly into the tile_px input of kubakub mosaic illusion. The maths is trivial - pixels per metre is render_width_px / facade_width_m, then the tile is feature_width_m × px_per_m / divide, rounded, with a floor of 2 px. What you're buying with this node is that you didn't do it by hand, and that your tile_px stays consistent when you change the render width later.

    info is a string with all three numbers: pixels per metre, tile size, and how many tiles across. Print it with a note node or leave it visible - it's the sanity check. If it says "9.4 px/m", you've typed the facade width in the wrong unit.

    Why the name says "camera"

    It doesn't use one, and the author is explicit about that in the description: no camera is involved. The context is video mapping, where the original version of this calculation came off a calibrated projector - pixels per metre was a property of the projector's throw and the wall, and the "camera" in the name is a leftover from that framing. Here it's just a scale ratio.

    Install

    It's part of the pack, in the lab group:

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

    Or ComfyUI Manager → kubakub nodes. The lab group is the one people switch off first - if you've been tidying your node menu with kubakub.ini, check lab isn't off before you conclude the node is missing, because the mosaic nodes live there and the console only says lab off (N nodes hidden) once at startup.

    When you'd actually use it

    The mosaic illusion only works if the tiles are the size of real material. Get that wrong and you get a picture with an invisible grid painted over it - which reads as a bad Photoshop job, not as a mosaic. If your output is a projection onto actual stonework, the tiles must land on the stones.

    So: measure the stonework once, put the number in here, and let the node keep the grid honest across every render size you try. It's three seconds of arithmetic that saves you from re-rendering a 3200 px mosaic because you eyeballed the tile at 48 px when the stones wanted 34.

    Categorykubakub/lab/mosaic

    Inputs (4)

    NameTypeDefaultDescription
    facade_width_mFLOAT33.930.1–500Real width of the facade the image covers, in metres.
    feature_width_mFLOAT0.1000.001–50Real width of one tile on the building, in metres (e.g. a brick or a stone).
    render_width_pxINT32008–16384Width in pixels of the image the mosaic is made at.
    divideINT11–16Split each real feature into this many tiles across. 1 = one tile per feature.

    Outputs (2)

    NameTypeDescription
    tile_pxINTTile size in pixels, for the mosaic illusion's tile_px.
    infoSTRINGPixels per metre, tile size and tiles across, as text.