ComfyUI Node
glslEditor
This node is a simple GLSL editor. You can choose your GLSL version. Watch out, not all drivers support all versions: Ex. 130, 420, 430 and 440 are not supported in macOS. In types for the moment we only support fragment shaders. "fragment (ShaderToy)" creates wrappes so it follows the ShaderToy specs.
glslEditor
- GLSL_CODE
◄version140►
◄code
// <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;
}
►
◄typefragment►
CategoryGLSL
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| version | COMBO | 140 | 12 options: 100, 120, 130, 140, 150, 330, +6 |
| code | 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; } | — |
| type | COMBO | fragment | 2 options: fragment, fragment (shadertoy) |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| GLSL_CODE | GLSL_CODE | — |