vec2 (pos)
Vec2 (pos) — a vec2 you set by dragging a point on a grid
- pos
- vec2
Sometimes a pair of number boxes is just wrong, and a shader parameter that's really "a point on a screen" should be set like a point on a screen. That's what vec2 (pos) is for: it hands you a little 2D grid widget on the node and outputs the position you drag around as a VEC2 for your shader's uniforms.
It's part of the GLSL Nodes pack's family of uniform-value widgets, alongside vec3 (pos) and vec4 (color). Where the plain vec2 node makes you type x and y, this one is for when the value has a natural visual meaning - a light position, a direction, a focal point, the center of a gradient or a warp. Drag the dot, the shader moves. It's the most intuitive of the pack's value nodes to use, and the least useful if your value is anything abstract.
Input, output, and the coordinate system
One input: pos, a VEC2POS widget with a default of [0, 0]. The node renders a grid, a crosshair, and a draggable point; drag it and the widget value updates.
One output: vec2, typed VEC2, which feeds straight into a glslUniforms node as a u_val* input (or into a shader input slot that accepts a vec2).
The coordinate range is the GLSL default: values run from roughly -1 to 1 in both axes, with [0, 0] dead center - not 0-to-1 cornered UVs. So if your shader expects UVs, vec2 (pos) output of [0.5, 0.5] will sit in the top-right, not the middle, until you map it yourself. The widget stores the raw value as a comma-separated string under the hood and the node parses it back out, so the value you see in the widget is the value your shader gets.
Install and caveats
ComfyUI Manager → search "GLSL Nodes", or cd ComfyUI/custom_nodes && git clone https://github.com/patriciogonzalezvivo/comfyui_glslnodes, then restart - same as the rest of the pack.
The one caveat is that the widget is a frontend widget: it lives in the browser. If the grid shows up but dragging does nothing, or the dot vanishes, that's a frontend/extensions load problem rather than a shader problem - hard-refresh the ComfyUI page before you go hunting in your GLSL. Otherwise this is about as frictionless as a parameter node gets: drag, wire, watch.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| pos | VEC2POS | 0,0 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| vec2 | VEC2 | — |