Coloring

Color blending #

Blending two colors is implemented by doing a component-wise multiplication between them

CODIGO: blend.frag
precision mediump float;

// uniforms are emitted from the sketch
// https://p5js.org/reference/#/p5.Shader/setUniform
uniform vec4 uMaterial1;
uniform vec4 uMaterial2;

void main() {
  gl_FragColor = uMaterial1 * uMaterial2;
}

Color blending with lightness #

Different blending modes #