Nodes/Jovi_GLSL/FILTER RANGE (JOV_GL)
ComfyUI Node

FILTER RANGE (JOV_GL)

Select pixels from start color through end color. Maintains alpha/mask.

By Amorano·Created 2 years ago·Updated 12 months ago· 20
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)

NameTypeDefaultDescription
imageoptIMAGERGB(A) image
startoptVEC30,0,0Start of the Range
endoptVEC31,1,1End of the Range
FRAGMENToptSTRING// 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)

NameTypeDescription
RGBAIMAGEFull channel [RGBA] image. If there is an alpha, the image will be masked out with it when using this output.
RGBIMAGEThree channel [RGB] image. There will be no alpha.
MASKMASKSingle channel mask output.