Nodes/ComfyUI-KikoTools/Width Height to VEC2
ComfyUI Node

Width Height to VEC2

The node that feeds GLSL shaders

By ComfyAssetsΒ·Created about a year agoΒ·Updated 2 months agoΒ· 19
Width Height to VEC2
    • vec2
    β—„width1024β–Ί
    β—„height1024β–Ί

    Width Height to VEC2

    WidthHeightToVec2 does exactly what its name says: it takes a width and a height, and hands you back a single VEC2 output. It's a two-number-to-one-vector adapter, and for a long time I wouldn't have called it essential. Then I hit my first GLSL shader node and suddenly understood why it exists.

    Some nodes in the ecosystem ask for a VEC2 input instead of two separate width/height integers. The big one is jovi_glsl, which runs GLSL shaders inside ComfyUI - those shaders take vec2 uniforms for things like resolution, and the node wants its inputs pre-shaped. Instead of hand-typing a tuple and hoping it connects, you wire this node in.

    How it works

    Fun fact: VEC2 isn't a native ComfyUI type. ComfyUI's type system is just string matching - a convention WAS Node Suite popularized where a node declares "my output is VEC2" and another node declares "my input is VEC2", and the wires connect. Under the hood this node does the boring but important work: it converts whatever you feed it (the source code handles ints, floats, even strings) to integers, clamps the result to a sane 1–8192 range, and returns the pair as ((width, height),) in ComfyUI's expected return format. Nothing clever, but it's the kind of glue that saves you from a "types don't match" error at 1 a.m.

    The inputs that matter

    Only two, and they're both obvious:

    • width - INT, 1 to 8192, default 1024. The x component of the VEC2.
    • height - INT, 1 to 8192, default 1024. The y component.

    That's the whole input side. The single output is vec2, which wires into any node expecting a VEC2 - typically shader or geometry-style nodes. A nice trick: feed width and height from the pack's Width Height Selector node so you can swap presets and have the shader follow along, instead of hardcoding dimensions in three places.

    Install

    Same as any custom node. Easiest is ComfyUI Manager - search for "ComfyUI-KikoTools" and hit install:

    cd ComfyUI/custom_nodes
    git clone https://github.com/ComfyAssets/ComfyUI-KikoTools.git
    

    Then restart ComfyUI. No model downloads here, and the only entry in requirements.txt is google-generativeai, which is optional and only used by the pack's Gemini Prompt node. This node needs zero extra dependencies.

    Where people get burned

    The catch with this pack is that it isn't just this node. KikoTools ships 21 tools plus an embedding-autocomplete frontend, so installing it to grab a two-input converter brings along a whole toolbox. It's MIT-licensed and the author's own take on "curated essentials" - but if you already run cubiq's ComfyUI_essentials, keep an eye out: the README says the xyz-helpers were adapted from that pack, and having both installed can produce duplicate node-name conflicts. Also remember that VEC2 only connects to nodes that declare VEC2 - if your target node wants two separate INTs, this little adapter won't help you, and you'd be better off wiring the numbers straight through.

    Category🫢 ComfyAssets/πŸ–ΌοΈ Resolution

    Inputs (2)

    NameTypeDefaultDescription
    widthINT10241–8192Width value (x component of VEC2)
    heightINT10241–8192Height value (y component of VEC2)

    Outputs (1)

    NameTypeDescription
    vec2VEC2β€”