Nodes/Jovi_GLSL/NORMAL BLEND (JOV_GL)
ComfyUI Node

NORMAL BLEND (JOV_GL)

Blend two Normal maps

By Amorano·Created 2 years ago·Updated 12 months ago· 20
NORMAL BLEND (JOV_GL)
  • imageA
  • imageB
  • RGBA
  • RGB
  • MASK
blend0.50
FRAGMENT// name: NORMAL BLEND // desc: Blend two Normal maps // category: COMPOSE uniform sampler2D imageA; // | Input image A to blend with image B uniform sampler2D imageB; // | Input image B to blend with image A uniform float blend; // 0.5; 0; 1; 0.01 | Intensity of blend void mainImage( out vec4 fragColor, in vec2 fragCoord ) { vec2 uv = fragCoord / iResolution.xy; vec3 normalA = texture(imageA, uv).rgb * 2.0 - 1.0; normalA = normalize(normalA); vec3 normalB = texture(imageB, uv).rgb * 2.0 - 1.0; normalB = normalize(normalB); vec3 blendedNormal = normalize(mix(normalA, normalB, blend)); fragColor = vec4((blendedNormal * 0.5) + 0.5, 1.0); }
CategoryJOV_GL 🌈/COMPOSE

Inputs (4)

NameTypeDefaultDescription
imageAoptIMAGEInput image A to blend with image B
imageBoptIMAGEInput image B to blend with image A
blendoptFLOAT0.500–1Intensity of blend
FRAGMENToptSTRING// name: NORMAL BLEND // desc: Blend two Normal maps // category: COMPOSE uniform sampler2D imageA; // | Input image A to blend with image B uniform sampler2D imageB; // | Input image B to blend with image A uniform float blend; // 0.5; 0; 1; 0.01 | Intensity of blend void mainImage( out vec4 fragColor, in vec2 fragCoord ) { vec2 uv = fragCoord / iResolution.xy; vec3 normalA = texture(imageA, uv).rgb * 2.0 - 1.0; normalA = normalize(normalA); vec3 normalB = texture(imageB, uv).rgb * 2.0 - 1.0; normalB = normalize(normalB); vec3 blendedNormal = normalize(mix(normalA, normalB, blend)); fragColor = vec4((blendedNormal * 0.5) + 0.5, 1.0); }

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.