Nodes/GLSL Nodes/vec3 (pos)
ComfyUI Node

vec3 (pos)

Vec3 (pos) — a 3D point you set on a widget instead of in three number boxes

By patriciogonzalezvivo·Created 2 years ago·Updated about a year ago· 246
vec3 (pos)
  • pos
  • vec3

vec3 (pos) is the 3D sibling of vec2 (pos): instead of typing x, y, and z into three float fields, you get a small 3D position widget on the node and it outputs the result as a VEC3 for your shader's uniforms. If your shader is doing anything spatial - a light position in a raymarcher, a camera target, an SDF anchor point - this is the most natural way to set it in a graph.

It's one of the GLSL Nodes pack's uniform widgets, and its job is identical to its 2D cousin: take a value that has a visual, spatial meaning and let you set it visually, then hand a clean vector to your shader. Where the plain vec3 node forces you to reason about three raw numbers, this one lets you just move a point around.

Input and output

One input: pos, a VEC3POS widget with a default of [0, 0, 0] - a 3D crosshair/grid you drag a point through.

One output: vec3, typed VEC3, which feeds a glslUniforms node as a u_val* input or directly into any vec3 slot in your shader setup.

The gotcha nobody warns you about

There's a real quirk in this node's shipped code. When the widget value is parsed, the node returns (x, y, y) - the z component is duplicated from y. That's a typo in the pack source (return ((float(pos[0]), float(pos[1]), float(pos[1])), )), which means your z value will silently be whatever y is. If your 3D scene looks like it's been flattened onto a diagonal, that's exactly what you're seeing.

The workaround until it's fixed upstream is to skip the pos widget for anything where z matters and use the plain vec3 node instead - three number boxes are ugly but correct. Worth knowing before you spend an hour fighting a shader that's actually getting bad coordinates.

Install

ComfyUI Manager → search "GLSL Nodes", or cd ComfyUI/custom_nodes && git clone https://github.com/patriciogonzalezvivo/comfyui_glslnodes, then restart. Dependencies (moderngl, numpy, snowy) install on first boot. As with the other widget nodes, if the 3D grid doesn't render or drag in your browser, refresh the ComfyUI frontend before suspecting the shader.

CategoryGLSL

Inputs (1)

NameTypeDefaultDescription
posVEC3POS0,0,0

Outputs (1)

NameTypeDescription
vec3VEC3