ComfyUI Node
FILTER RANGE (JOV_GL)
Select pixels from start color through end color. Maintains alpha/mask.
FILTER RANGE (JOV_GL)
- image
- start
- end
- RGBA
- RGB
- MASK
◄FRAGMENT// name: FILTER RANGE
// desc: Select pixels from start color through end color. Maintains alpha/mask.
// category: FILTER
uniform sampler2D image; // | RGB(A) image
uniform vec3 start; // 0,0,0; 0; 1; 0.01; rgb | Start of the Range
uniform vec3 end; // 1,1,1; 0; 1; 0.01; rgb | End of the Range
void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
vec2 uv = fragCoord / iResolution.xy;
vec4 color = texture(image, uv);
bool isInside = all(greaterThanEqual(color.rgb, start)) && all(lessThanEqual(color.rgb, end));
fragColor = vec4(vec3(isInside ? 1.0 : 0.0), color.a);
}►
CategoryJOV_GL 🌈/FILTER
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| imageopt | IMAGE | RGB(A) image | |
| startopt | VEC3 | 0,0,0 | Start of the Range |
| endopt | VEC3 | 1,1,1 | End of the Range |
| FRAGMENTopt | STRING | // name: FILTER RANGE // desc: Select pixels from start color through end color. Maintains alpha/mask. // category: FILTER uniform sampler2D image; // | RGB(A) image uniform vec3 start; // 0,0,0; 0; 1; 0.01; rgb | Start of the Range uniform vec3 end; // 1,1,1; 0; 1; 0.01; rgb | End of the Range void mainImage( out vec4 fragColor, in vec2 fragCoord ) { vec2 uv = fragCoord / iResolution.xy; vec4 color = texture(image, uv); bool isInside = all(greaterThanEqual(color.rgb, start)) && all(lessThanEqual(color.rgb, end)); fragColor = vec4(vec3(isInside ? 1.0 : 0.0), color.a); } | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| RGBA | IMAGE | Full channel [RGBA] image. If there is an alpha, the image will be masked out with it when using this output. |
| RGB | IMAGE | Three channel [RGB] image. There will be no alpha. |
| MASK | MASK | Single channel mask output. |