Nodes/ComfyUI-ToyShaders/📝 Shader Code (GLSL)
ComfyUI Node

📝 Shader Code (GLSL)

The pass-through box that hands GLSL to ToyShader (and nothing else)

By jav12z·Created 9 months ago·Updated 8 months ago· 5
📝 Shader Code (GLSL)
    • STRING
    code// Pega aquí tu código de Shadertoy...

    Shader Code Input is the least glamorous node in the ComfyUI-ToyShaders pack, and it's honest about that. It renders nothing, processes nothing, and its entire implementation is return (code,). One multiline text box in, one string out. That's the whole job - and it's still worth knowing, because it's how you keep your GLSL visible in a graph that would otherwise swallow it.

    What it actually is

    It's a plain string pass-through from the ToyShaders pack. You type (or paste) shader code into the single code field - the one input it has - and it hands that text to the output as a STRING wire. Nothing is evaluated, no syntax check, no compile. Whatever you paste is what comes out.

    The default text is in Spanish: "Pega aquí tu código de Shadertoy..." - "paste your Shadertoy code here." The author, jav12z (who posts on Reddit as striking-Long), is Spanish-speaking, so don't read that as an error; just type over it.

    Why you'd bother

    You pair it with the pack's other node, ToyShader Render. The render node takes GLSL in two optional string slots: main_code (the shader body) and buffer_a_code (the Buffer A pass for multipass effects). You can type straight into those widgets, and for a one-off render that's simpler. Shader Code Input earns its keep in two specific situations:

    • You want the code visible on the graph. A shader is a block of text; buried in a widget it's invisible when you look at a screenshot of a workflow. In a boxed, labeled node, anyone you share the workflow with can see what the shader does at a glance.
    • You want to reuse one shader across several render nodes. Wire this node's STRING output into multiple main_code inputs and every render stays in sync - change it once, they all update.

    That's it. It's an ergonomics node, not a clever one. Honestly, that's fine; ComfyUI is full of these, and they're what keep big graphs readable.

    A couple of gotchas

    • The output is a raw STRING, so it only feeds string slots like main_code or buffer_a_code. Don't point it at an image input and wonder why nothing happens.
    • If the code you wire in is shorter than about ten characters, ToyShader Render ignores it and silently falls back to its preset dropdown. An empty or stub box looks like it should work and does nothing.
    • One licensing note that applies to the whole pack: the engine is MIT, but shader code you copy from shadertoy.com is usually CC BY-NC-SA. Fine for personal projects; respect the original author if you ship it commercially.

    Install

    You don't install this node alone - it ships with ComfyUI-ToyShaders. In ComfyUI Manager, search "ToyShaders," or do it by hand:

    cd ComfyUI/custom_nodes
    git clone https://github.com/jav12z/ComfyUI-ToyShaders
    cd ComfyUI-ToyShaders
    pip install -r requirements.txt
    

    Restart ComfyUI and it appears under the ToyShaders category, right next to ToyShader Render. No extra model downloads, no API keys, nothing heavy to fetch.

    CategoryToyShaders

    Inputs (1)

    NameTypeDefaultDescription
    codeSTRING// Pega aquí tu código de Shadertoy...

    Outputs (1)

    NameTypeDescription
    STRINGSTRING