Reference filterColor

filterColor

A shader hook block that sets the color for each pixel in a filter shader. This hook can be used inside buildFilterShader() to control the output color for each pixel.

filterColor has the following properties:

  • texCoord: a two-component vector representing the texture coordinates (u, v).
  • canvasSize: a two-component vector representing the canvas size in pixels (width, height).
  • texelSize: a two-component vector representing the size of a single texel in texture space.
  • canvasContent: a texture containing the sketch's contents before the filter is applied.

Call .set() on the hook with a vector with four components (red, green, blue, alpha) to update the final color.

This hook is available in:

Examples

Notice any errors or typos? Please let us know. Please feel free to edit src/strands/p5.strands.js and open a pull request!

Related References