mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-03-06 01:37:45 +08:00
* adds support for executing simple glsl shaders using moderngl package * tidy * Support multiple outputs * Try fix build * fix casing * fix line endings * convert to using PyOpenGL and glfw * remove cpu support * tidy * add additional support for egl & osmesa backends * fix ci perf: only read required outputs * add diagnostics, update mac initialization * GLSL glueprints + node fixes (#12492) * Add image operation blueprints * Add channels * Add glow * brightness/contrast * hsb * add glsl shader update system * shader nit iteration * add multipass for faster blur * more fixes * rebuild blueprints * print -> logger * Add edge preserving blur * fix: move _initialized flag to end of GLContext.__init__ Prevents '_vao' attribute error when init fails partway through and subsequent calls skip initialization due to early _initialized flag. * update valid ranges - threshold 0-100 - step 0+ * fix value ranges * rebuild node to remove extra inputs * Fix gamma step * clamp saturation in colorize instead of wrapping * Fix crash on 1x1 px images * rework description * remove unnecessary f Co-authored-by: Jedrzej Kosinski <kosinkadink1@gmail.com> Co-authored-by: Hunter Senft-Grupp <hunter@comfy.org>
28 lines
924 B
GLSL
28 lines
924 B
GLSL
#version 300 es
|
||
precision highp float;
|
||
|
||
uniform sampler2D u_image0;
|
||
uniform vec2 u_resolution;
|
||
uniform float u_float0; // strength [0.0 – 2.0] typical: 0.3–1.0
|
||
|
||
in vec2 v_texCoord;
|
||
layout(location = 0) out vec4 fragColor0;
|
||
|
||
void main() {
|
||
vec2 texel = 1.0 / u_resolution;
|
||
|
||
// Sample center and neighbors
|
||
vec4 center = texture(u_image0, v_texCoord);
|
||
vec4 top = texture(u_image0, v_texCoord + vec2( 0.0, -texel.y));
|
||
vec4 bottom = texture(u_image0, v_texCoord + vec2( 0.0, texel.y));
|
||
vec4 left = texture(u_image0, v_texCoord + vec2(-texel.x, 0.0));
|
||
vec4 right = texture(u_image0, v_texCoord + vec2( texel.x, 0.0));
|
||
|
||
// Edge enhancement (Laplacian)
|
||
vec4 edges = center * 4.0 - top - bottom - left - right;
|
||
|
||
// Add edges back scaled by strength
|
||
vec4 sharpened = center + edges * u_float0;
|
||
|
||
fragColor0 = vec4(clamp(sharpened.rgb, 0.0, 1.0), center.a);
|
||
} |