glsl-blend-overlay
npm i glsl-blend-overlay

glsl-blend-overlay

blend mode 'overlay' for GLSL

by Jam3

1.0.5 (see all)License:MITTypeScript:Not Found
npm i glsl-blend-overlay
Readme

glsl-blend-overlay

stable

(click for demo)

Photoshop-like "overlay" blend mode for GLSL.

#pragma glslify: blend = require(../)

void main() {
  vec4 bgColor = texture2D(bg, vUv);
  vec4 fgColor = texture2D(foreground, vUv);

  vec3 color = blend(bgColor.rgb, fgColor.rgb);
  gl_FragColor = vec4(color, 1.0);
}

Usage

NPM

blend(vec3 background, vec3 foreground)

Blends background and foreground with an "overlay" blend mode. The algorithm for each channel is as follows:

bg < 0.5 ? (2.0 * bg * fg) : (1.0 - 2.0 * (1.0 - bg) * (1.0 - fg))

Contributing

See stackgl/contributing.

License

MIT. See LICENSE.md for details.

Downloads/wk

11

GitHub Stars

20

LAST COMMIT

7yrs ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

0

OPEN PRs

0
VersionTagPublished
1.0.5
latest
7yrs ago
No alternatives found
No tutorials found
Add a tutorial