模拟PS 的十九种叠加模式【GLSL】

1.变暗

// PS 的叠加模式
#iChannel0 "file://./beard.jpg"
#iChannel1 "file://./CUDA.png"

void main()
{
    // Normalized pixel coordinates (from 0 to 1)
    vec2 uv = gl_FragCoord.xy/iResolution.xy;

    vec4 A = texture(iChannel0, uv)*255.;
    vec4 B = texture(iChannel1, uv)*255.;
    
    vec4 C_A = 255.-A;
    vec4 C_B = 255.-B;
    
    const float INV = 1./255.;
    vec4 color;

    // 变暗
    color = INV*min(A, B);
    

    gl_FragColor = color;
}

2.变亮

猜你喜欢

转载自blog.csdn.net/panda1234lee/article/details/102753936
ps