Nodes/GLSL Nodes/glslEditorPro
ComfyUI Node

glslEditorPro

GlslEditorPro — the GLSL editor with a real code editor in it

By patriciogonzalezvivo·Created 2 years ago·Updated about a year ago· 246
glslEditorPro
  • code
  • GLSL_CODE
version140
typefragment

This is the version of glslEditor you actually want to use. Functionally the two are twins - same inputs, same GLSL_CODE output, same shader wrapping - but glslEditorPro swaps the plain text box for a full ACE code editor embedded right in the node. Syntax highlighting, line numbers, bracket matching, even vim and emacs keybindings if that's your thing. For anything longer than a doodle, editing GLSL in a bare ComfyUI string widget is miserable; this is the difference between writing code and squinting at it.

What changed

The inputs are identical to glslEditor, just with the code field upgraded to a GLSL_STRING that renders as the editor:

  • version - GLSL version, default 140. Same warning as always: 130, 420, 430, and 440 aren't supported on macOS, so stick to 140/330 unless you know your driver.
  • type - fragment or fragment (shadertoy). Shadertoy mode forces GLSL 400 and aliases the uniforms to Shadertoy names (iTime, iResolution, iFrame, iChannel0-3), so you can drop in code from the site and have it run.
  • code - the shader source, opening in the embedded ACE editor.

The output is a GLSL_CODE that feeds glslViewer's fragment_code input, and #include directives get resolved the same way - local files or a fetch from LYGIA's server at lygia.xyz when you reference lygia/... paths.

The part worth paying attention to

The Pro node is where the LYGIA integration actually shines. The editor pulls https://lygia.xyz/glsl.json and uses it for autocomplete - start typing and it suggests LYGIA's shader functions by name. Combined with the #include resolver, that turns a ComfyUI node into a surprisingly competent environment for writing procedural shaders. It's still a single editor pane, not a real IDE; don't expect debuggers or live reload. But for shader work inside a workflow, it's comfortably the better of the two editor nodes.

Install and gotchas

ComfyUI Manager → search "GLSL Nodes", or cd ComfyUI/custom_nodes && git clone https://github.com/patriciogonzalezvivo/comfyui_glslnodes, then restart. Dependencies moderngl, numpy, and snowy install on first boot.

Two things to know. First, the editor assets (ACE plus the GLSL mode) are loaded client-side in your browser, so if the editor shows up blank or as plain text, it's a frontend load issue - hard-refresh, and make sure you're not on an ancient ComfyUI frontend. Second, the LYGIA autocomplete list is fetched from the network; offline, autocomplete goes quiet but your code still compiles.

One more real-world note: the pack was announced to r/StableDiffusion with a good bit of fanfare back in mid-2024, and the crowd that showed up was mostly the demoscene/creative-coding crowd rather than the checkpoint-chasers. That's a good signal for what this pack is: if your idea of a fun afternoon is metaballs and SDF raymarching, this is your node.

CategoryGLSL

Inputs (3)

NameTypeDefaultDescription
versionCOMBO14012 options: 100, 120, 130, 140, 150, 330, +6
typeCOMBOfragment2 options: fragment, fragment (shadertoy)
codeGLSL_STRING // <NAME>_TYPE: have the uniform type //uniform U_TEX0_TYPE u_tex0; //uniform U_TEX0_TYPE u_val0; uniform vec4 u_date; uniform vec2 u_resolution; uniform float u_delta; uniform float u_time; uniform float u_fps; uniform int u_frame; void main() { vec4 color = vec4(0.0, 0.0, 0.0, 1.0); vec2 pixel = 1.0 / u_resolution; vec2 st = gl_FragCoord.xy * pixel; color.rgb = vec3(st, 0.5 + 0.5 * cos(u_time)); // texture arrays have this <NAME>_TOTALFRAMES //#ifdef U_TEX0_TOTALFRAMES //color = texture(u_tex0, vec3(st, float(u_frame))); //#else //color = texture(u_tex0, st); //#endif gl_FragColor = color; }

Outputs (1)

NameTypeDescription
GLSL_CODEGLSL_CODE