> For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt.

# GLSL 着色器（GLSLShader）

<div class="node-meta"><code>GLSLShader</code><span>image/shader</span><span>角色：图像处理</span></div>

The **GLSL Shader** node lets you write custom fragment shaders in **GLSL ES 3.00** (WebGL 2.0 compatible) to process images directly on the GPU. You can create image effects like blurs, color grading, film grain, glow, and much more - all running at GPU speed.  The GLSL Shader node is currently marked as **experimental**, so the node may be updated and extended in future releases.  The simplest possible shader - a passthrough that outputs the input image unchanged: #version 300 es precision highp float; uniform sampler2D u_image0; in vec2 v_texCoord; layout(location = 0) out vec4 fragColor0; void main() \{ fragColor0 = texture(u_image0, v_texCoord); }  **Why GLSL ES 3.00?** Shaders need to run in two environments: the **browser** (via WebGL 2.0, which only supports GLSL ES 3.00) for live preview in the ComfyUI frontend, and the **Python backend** (via desktop OpenGL) when the workflow executes. GLSL ES 3.00 is the common denominator that works in both places.  These uniforms are automatically set by ComfyUI. You don't need to declare all of them - only declare the ones you use. ### Images

## 参数

| 参数                | 类型                    | 默认 / 范围 | 说明                  |
| ----------------- | --------------------- | ------- | ------------------- |
| `fragment_shader` | STRING                | 多行文本    | —                   |
| `size_mode`       | COMFY_DYNAMICCOMBO_V3 | —（连线输入） | 目标边长或缩放尺寸。          |
| `images`          | COMFY_AUTOGROW_V3     | —（连线输入） | IMAGE 张量批次，可一次处理多张。 |
| `floats`          | COMFY_AUTOGROW_V3     | —（连线输入） | —                   |
| `ints`            | COMFY_AUTOGROW_V3     | —（连线输入） | —                   |
| `bools`           | COMFY_AUTOGROW_V3     | —（连线输入） | —                   |
| `curves`          | COMFY_AUTOGROW_V3     | —（连线输入） | —                   |

## 输出

| 输出     | 类型    | 说明 |
| ------ | ----- | -- |
| IMAGE0 | IMAGE | 图像 |
| IMAGE1 | IMAGE | 图像 |
| IMAGE2 | IMAGE | 图像 |
| IMAGE3 | IMAGE | 图像 |

## 怎么接

- **上游**：LoadImage / VAEDecode / 上一个图像节点
- **下游**：VAEEncode / SaveImage / 下一个图像节点
- **接线**：接在 LoadImage 或 VAEDecode 之后，处理结果再交给 VAEEncode（重绘）、SaveImage（出图）或下一个图像节点；这类节点可以任意串联成处理流水线。

## 使用案例

属于「图像处理」类节点，向下游提供图像数据。从 `fragment_shader`（#version 300 es
precision highp float;

uniform sampler2D u_image0;
uniform vec2 u_resolution;

in vec2 v_texCoord;
layout(location = 0) out vec4 fragColor0;

void main() \{
fragColor0 = texture(u_image0, v_texCoord);
}）、`size_mode`、`images` 开始填就能跑起来。典型接法：`LoadImage` → 本节点 → `VAEEncode`。输出类型是 IMAGE，只能接同类型的输入端口，颜色对不上就是接错了。

## 端口与连线示意

![GLSLShader 端口与连线示意](/svg/GLSLShader.svg)
