New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

glsl-blend-soft-light

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glsl-blend-soft-light

blend mode 'overlay' for GLSL

1.0.5
latest
Source
npm
Version published
Weekly downloads
8.1K
12.85%
Maintainers
1
Weekly downloads
 
Created
Source

glsl-blend-soft-light

stable

(click for demo)

Photoshop-like "soft light" 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 base, vec3 blend)

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

(blend < 0.5) ? (2.0 * base * blend + base * base * (1.0 - 2.0 * blend)) : (sqrt(base) * (2.0 * blend - 1.0) + 2.0 * base * (1.0 - blend))

Contributing

See stackgl/contributing.

License

MIT. See LICENSE.md for details.

Keywords

ecosystem:stackgl

FAQs

Package last updated on 26 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts